Skip to content

Instantly share code, notes, and snippets.

@hmanish
hmanish / pos_reverse_lookup.clj
Last active August 29, 2015 14:10
pos reverse lookup
=> (def trade {:id 123 :stl_idx_1 {}.....})
=> (compute-positions trade)
=> {["NG NYMEX" nil] {111111111 {:long 10000}
222222222 {:long 10000}
}
["IF For LD1 CG" nil] {111111111 {:short 100000}
222222222 {:short 100000}
}
@hmanish
hmanish / output.clj
Last active August 29, 2015 14:09
Sample outputs of calling computePosition on different trade types
(defn compute-position
"returns a map
key is a vector -[ <settlement index name> <power primitive name>]
value is a map - {<Millis corresponding to yyyy-MM> {<:long|:short> <Double: the positon>} }
For non power trades, primitive name will be nil"
[trade]
;;compute postion code)