This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn wrapper | |
[cb] | |
(reify | |
com.ib.client.EWrapper | |
(^void tickOptionComputation [this ^int tickerId ^int field ^double | |
impliedVol ^double delta ^double optPrice | |
^double pvDividend ^double gamma ^double | |
vega ^double theta ^double undPrice] | |
(cb {:field field, | |
:type :tickOptionComputation, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn client | |
"Takes one or more message handler functions and returns a map which | |
represents an IB api client." | |
[& handlers] | |
(let [handlers (atom (set handlers)) | |
handle-message (fn [msg] | |
(doseq [f @handlers] | |
(try (f (unqualify-msg msg)) | |
(catch Throwable t | |
(log/error t "Error handling message"))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn mkput [a p rf cbs] | |
(fn [x] | |
(if (realized? p) | |
false | |
(let [result (rf a x)] | |
(if (reduced? result) | |
(let [x @@result] | |
;;run callbacks then deliver | |
(doseq [cb @cbs] (cb x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.core.async :as a]) | |
(do | |
(def conn1 {:handlers (atom #{})}) | |
(def on? (atom true)) | |
;;;keep passing random ints to every handler | |
(def process | |
(future (while @on? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns iboga.impl.convert | |
(:require [clojure.string :as str] | |
[iboga.meta :as meta] | |
[iboga.util :as u] | |
[medley.core :as m]) | |
(:import [java.time LocalDate LocalDateTime] | |
java.time.format.DateTimeFormatter)) | |
(defmulti to-ib* (fn [k v] k)) | |
(defmulti from-ib* (fn [k v] k)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns iboga.impl.convert-old | |
(:require [clojure.spec.alpha :as s] | |
[clojure.string :as str] | |
[iboga.meta :as meta] | |
[iboga.util :as u] | |
[iboga.specs] | |
[medley.core :as m]) | |
(:import [java.time LocalDate LocalDateTime] | |
java.time.format.DateTimeFormatter)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.index | |
(:require [cljs.core.async :as a] | |
[lib.dom :as d :refer-macros [tpl-let tpl-with tpl=]])) | |
;;EXAMPLE USAGE | |
(enable-console-print!) | |
(def todos-db (atom {})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mult | |
(:require[clojure.core.async :as a])) | |
(defprotocol MultFn | |
:extend-via-metadata true | |
(add-tap [this-fn f] [this-fn xf f] | |
"Adds a function `f` to 'tapset', a set of functions which are | |
each called on every value passed to `this-fn`. If a transducer `xf` | |
is supplied, subjects all values to `xf` before calling `f` on the | |
result. When a value is reduced, the function is removed from the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mult | |
(:require [clojure.core.async :as a])) | |
(defprotocol MultFn | |
:extend-via-metadata true | |
(add-tap [this-fn f] [this-fn xf f] | |
"Adds a function `f` to 'tapset', a set of functions which are | |
each called on every value passed to `this-fn`. If a transducer `xf` | |
is supplied, subjects all values to `xf` before calling `f` on the | |
result. When a value is reduced, the function is removed from the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:paths ["."] | |
:deps {time-literals/time-literals {:mvn/version "0.1.5"} | |
com.cognitect/transit-clj {:mvn/version "0.8.319"} | |
com.cognitect/transit-cljs {:mvn/version "0.8.256"} | |
}} |