Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
(weekly-csp
(->> (accounts)
first
:securitiesAccount
:currentBalances
:buyingPowerNonMarginableTrade)
["HOOD" "COIN" "TSM"])
{:high ["HOOD" 104.85 105.0 4.97 2 1416],
:low ["HOOD" 104.85 104.0 4.45 2 1277],
(ns u.schwab
(:require
[cheshire.core :as json]
[hato.websocket :as ws]
[clj-http.client :as http]
[clojure.string :as str]
[clojure.walk :as walk]
[integrant.core :as ig]
[ring.util.codec :as codec]
[ring.util.response :as response]))
(defn between [from target to]
(and (<= from target) (<= target to)))
(defn calculate-loan-size
[loan-amount]
(cond
(between 1 loan-amount 10000) :small
(between 10001 loan-amount 50000) :modest
(between 50001 loan-amount 150000) :large
(>= loan-amount 150001) :jumbo))
(defn calculate-loan-size
[loan-amount]
(cond
#d (between 1 loan-amount 10000) :small
#d (between 10001 loan-amount 50000) :modest
#d (between 50001 loan-amount 150000) :large
#d (>= loan-amount 150001) :jumbo))
[{0 [[1 :same-values (between 1 loan-amount 10000)] false]}
{1 [[1 :same-values (between 10001 loan-amount 50000)] false]}
{2 [[1 :same-values (between 50001 loan-amount 150000)] false]}
{3 [[1 :same-values (>= loan-amount 150001)] false]}]
(def log-store (atom {}))
(defn debug [tag val]
(swap! log-store update-in [tag] #(conj (or % []) val))
val)
(defn logs
[tag & functions]
(let [tag (if (number? tag)
(nth (keys @log-store) tag)
{d user/debug-data-reader}
{:aliases {:dev {:extra-paths ["/Users/dliman/.clojure"]}}}
(use-package! smartparens
:init
(map! :map smartparens-mode-map
...
"s-5" #'user-reset-log-store
"s-6" #'user-tags
"s-7" #'user-logs))
;; or
(defun user-reset-log-store ()
(interactive)
(cider-interactive-eval "(reset! user/log-store {})"))
(defun user-tags ()
(interactive)
(cider--pprint-eval-form "(user/tags)"))
(defun user-logs (&optional index-or-name)
(interactive)