Liking cljdoc? Tell your friends :D

BitMEX clients

(require '[polvo.utils.exchanges.bitmex :as bitmex])

REST Client

Check the map bitmex/routes for complete correspondence between keywords and endpoints.

(def client (bitmex/rest-client {:key api-key :secret api-secret}))

@(client ::bitmex/funding {} {})
@(client ::bitmex/trade {:symbol "XBTUSD"} {})

Websocket client

Basic operations are authenticate!, subscribe! and unsubscribe!.

Subscriptions are automatically expanded using expand so you can use keywords for topic subscriptions.

(def client @(bitmex/ws-client {:key api-key :secret api-secret}))


(bitmex/subscribe! client ["quote"])
(bitmex/expand [:order-book-l2-25 :xbtusd]) ; => "orderBookL2_25:XBTUSD"
(bitmex/subscribe! client [[:order-book-l2-25 :xbtusd] :trade]) ; using implicit expand
(bitmex/unsubscribe! client [:quote:trade])

Multiplex client

Basic operations are mp-open-stream!, mp-close-stream!, mp-authenticate!, mp-subscribe! and mp-unsubscribe!. You can pass an empty vector to mp-client to get a raw connection and manage it using the above functions or pass a vector of ::bitmex/account to let us initialize it.

(def client @(bitmex/mp-client [{:id "1" :topic "public" :subscriptions [:quote :trade]}
                                {:id "2" :topic "private" :subscriptions [:order :position]
                                 :key api-key :secret api-secret}]))

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close