This file contains 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 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 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 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 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 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 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 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 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 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
;;The goal of this is to specify a query format which clients can use to request | |
;;time series data from a server. The two primary operations are `:seek`s, which | |
;;are database lookups, and `:calc`s which tell the server to calculate | |
;;something using a previous seek as an argument. The result of either a seek or | |
;;a calc can be either a vector of data points or a map of columns (column name | |
;;-> vector). | |
;;Queries are either maps of names to subqueries, or just a vector of | |
;;subqueries. In either case, the response mirrors the shape of the query, with |