Public and private endpoint functions and websocket feed functionality. In all function signatures, client
takes the following shape:
{:url
:key (optional)
:secret (optional)
:passphrase (optional)}
key
, secret
, and passphrase
are only required if the request is authenticated. These values can be created in the API settings of your Coinbase Pro account.
Remember not to store these values in an online repository as this will give others access to your account. You could use something like environ
to store these values locally outside of your code.Public and private endpoint functions and websocket feed functionality. In all function signatures, `client` takes the following shape: ```clojure {:url :key (optional) :secret (optional) :passphrase (optional)} ``` - `key`, `secret`, and `passphrase` are only required if the request is authenticated. These values can be created in the [API settings](https://pro.coinbase.com/profile/api) of your Coinbase Pro account. **Remember not to store these values in an online repository as this will give others access to your account. You could use something like [environ](https://github.com/weavejester/environ) to store these values locally outside of your code.**
(cancel-all client)
(cancel-all client product-id)
(cancel-all client "BTC-USD")
[API docs](https://docs.pro.coinbase.com/#cancel-all) ```clojure (cancel-all client "BTC-USD") ```
(cancel-order client order-id)
(cancel-order client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
[API docs](https://docs.pro.coinbase.com/#cancel-an-order) ```clojure (cancel-order client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") ```
(close connection)
connection
is created with create-websocket-connection
.
`connection` is created with [[create-websocket-connection]].
(create-websocket-connection opts)
opts
takes the following shape:{:url
:product_ids
:channels (optional)
:key (optional)
:secret (optional)
:passphrase (optional)
:on-connect (optional)
:on-receive (optional)
:on-close (optional)
:on-error (optional)}
key
, secret
, and passphrase
are only required if you want an authenticated feed. See the Coinbase Pro API docs for details on authenticated feeds.channels
is a vector of channel names (strings) . If no channels are passed, the "heartbeat" channel is subscribed to.on-connect
, on-receive
, on-close
, and on-error
are callback functions. Coinbase-pro-clj uses gniazdo for its websocket client. See the gniazdo readme for details on the callback functions.(def conn (create-websocket-connection {:product_ids ["BTC-USD"]
:url "wss://ws-feed.pro.coinbase.com"
:on-receive (fn [x] (prn 'received x))}))
[API docs](https://docs.pro.coinbase.com/#websocket-feed) - `opts` takes the following shape: ```clojure {:url :product_ids :channels (optional) :key (optional) :secret (optional) :passphrase (optional) :on-connect (optional) :on-receive (optional) :on-close (optional) :on-error (optional)} ``` - `key`, `secret`, and `passphrase` are only required if you want an authenticated feed. See the Coinbase Pro API docs for details on authenticated feeds. - `channels` is a vector of channel names (strings) . If no channels are passed, the "heartbeat" channel is subscribed to. - `on-connect`, `on-receive`, `on-close`, and `on-error` are callback functions. Coinbase-pro-clj uses gniazdo for its websocket client. See the [gniazdo readme](https://github.com/stalefruits/gniazdo#gniazdocoreconnect-uri--options) for details on the callback functions. ```clojure (def conn (create-websocket-connection {:product_ids ["BTC-USD"] :url "wss://ws-feed.pro.coinbase.com" :on-receive (fn [x] (prn 'received x))})) ```
(deposit-from-coinbase client opts)
(deposit-from-coinbase client {:amount 2
:currency "BTC"
:coinbase_account_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"})
[API docs](https://docs.pro.coinbase.com/#coinbase) ```clojure (deposit-from-coinbase client {:amount 2 :currency "BTC" :coinbase_account_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"}) ```
(deposit-from-payment-method client opts)
(deposit-from-payment-method client {:amount 10
:currency "USD"
:payment_method_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"})
[API docs](https://docs.pro.coinbase.com/#payment-method) ```clojure (deposit-from-payment-method client {:amount 10 :currency "USD" :payment_method_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"}) ```
(generate-report client opts)
(generate-report client {:type "fills"
:start_date "2018-6-1"
:end_date "2018-6-30"
:product_id "BTC-USD"})
[API docs](https://docs.pro.coinbase.com/#create-a-new-report) ```clojure (generate-report client {:type "fills" :start_date "2018-6-1" :end_date "2018-6-30" :product_id "BTC-USD"}) ```
(get-24hour-stats client product-id)
(get-24hour-stats client "BTC-USD")
[API docs](https://docs.pro.coinbase.com/#get-24hr-stats) ```clojure (get-24hour-stats client "BTC-USD") ```
(get-account client account-id)
(get-account client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
[API docs](https://docs.pro.coinbase.com/#get-an-account) ```clojure (get-account client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") ```
(get-account-history client account-id)
(get-account-history client account-id paging-opts)
(get-account-history client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
(get-account-history client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba" {:before 2 :limit 5})
[API docs](https://docs.pro.coinbase.com/#get-account-history) ```clojure (get-account-history client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") (get-account-history client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba" {:before 2 :limit 5}) ```
(get-account-holds client account-id)
(get-account-holds client account-id paging-opts)
(get-account-holds client "BTC-USD" "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
(get-account-holds client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba" {:before 2 :limit 5})
[API docs](https://docs.pro.coinbase.com/#get-holds) ```clojure (get-account-holds client "BTC-USD" "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") (get-account-holds client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba" {:before 2 :limit 5}) ```
(get-accounts client)
[API docs](https://docs.pro.coinbase.com/#list-accounts)
(get-coinbase-accounts client)
[API docs](https://docs.pro.coinbase.com/#list-accounts54)
(get-currencies client)
[API docs](https://docs.pro.coinbase.com/#get-currencies)
(get-fills client opts)
API docs Opts must contain either :order_id or :product_id.
(get-fills client {:product_id "BTC-USD" :before 2})
[API docs](https://docs.pro.coinbase.com/#list-fills) Opts must contain either :order_id or :product_id. ```clojure (get-fills client {:product_id "BTC-USD" :before 2}) ```
(get-historic-rates client product-id)
(get-historic-rates client product-id opts)
(get-historic-rates client "BTC-USD")
(get-historic-rates client "BTC-USD" {:start "2018-06-01"
:end "2018-06-30"
:granularity 86400})
[API docs](https://docs.pro.coinbase.com/#get-historic-rates) ```clojure (get-historic-rates client "BTC-USD") (get-historic-rates client "BTC-USD" {:start "2018-06-01" :end "2018-06-30" :granularity 86400}) ```
(get-order client order-id)
(get-order client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
[API docs](https://docs.pro.coinbase.com/#get-an-order) ```clojure (get-order client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") ```
(get-order-book client product-id)
(get-order-book client product-id level)
(get-order-book client "BTC-USD")
(get-order-book client "BTC-USD" 2)
[API docs](https://docs.pro.coinbase.com/#get-product-order-book) ```clojure (get-order-book client "BTC-USD") (get-order-book client "BTC-USD" 2) ```
(get-orders client)
(get-orders client opts)
(get-orders client {:status ["open" "pending"]})
[API docs](https://docs.pro.coinbase.com/#list-orders) ```clojure (get-orders client {:status ["open" "pending"]}) ```
(get-payment-methods client)
[API docs](https://docs.pro.coinbase.com/#list-payment-methods)
(get-products client)
[API docs](https://docs.pro.coinbase.com/#products)
(get-report-status client report-id)
(get-report-status client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba")
[API docs](https://docs.pro.coinbase.com/#get-report-status) ```clojure (get-report-status client "7d0f7d8e-dd34-4d9c-a846-06f431c381ba") ```
(get-ticker client product-id)
(get-ticker client product-id opts)
(get-ticker client "BTC-USD")
(get-ticker client "BTC-USD" {:before 2 :limit 5})
[API docs](https://docs.pro.coinbase.com/#get-product-ticker) ```clojure (get-ticker client "BTC-USD") (get-ticker client "BTC-USD" {:before 2 :limit 5}) ```
(get-trades client product-id)
(get-trades client product-id opts)
(get-trades client "BTC-USD")
(get-trades client "BTC-USD" {:before 2 :limit 5})
[API docs](https://docs.pro.coinbase.com/#get-trades) ```clojure (get-trades client "BTC-USD") (get-trades client "BTC-USD" {:before 2 :limit 5}) ```
(get-trailing-volume client)
[API docs](https://docs.pro.coinbase.com/#trailing-volume)
(place-order client opts)
(place-order client {:side "buy"
:product_id "BTC-USD"
:price 5000
:size 1})
[API docs](https://docs.pro.coinbase.com/#place-a-new-order) ```clojure (place-order client {:side "buy" :product_id "BTC-USD" :price 5000 :size 1}) ```
The sandbox rest URL for Coinbase Pro.
The sandbox rest URL for Coinbase Pro.
The sandbox websocket URL for Coinbase Pro.
The sandbox websocket URL for Coinbase Pro.
(subscribe connection opts)
API docs
connection
is created with create-websocket-connection
.
opts
takes the following shape:
{:product_ids
:channels (optional)
:key (optional)
:secret (optional)
:passphrase (optional)}
key
, secret
, and passphrase
are only required if you want an authenticated feed. See the Coinbase Pro API docs for details on authenticated feeds.channels
is a vector of channel names (strings). If no channels are passed, the "heartbeat" channel is subscribed to.(subscribe connection {:product_ids ["BTC-USD"]})
[API docs](https://docs.pro.coinbase.com/#subscribe) `connection` is created with [[create-websocket-connection]]. `opts` takes the following shape: ```clojure {:product_ids :channels (optional) :key (optional) :secret (optional) :passphrase (optional)} ``` - `key`, `secret`, and `passphrase` are only required if you want an authenticated feed. See the Coinbase Pro API docs for details on authenticated feeds. - `channels` is a vector of channel names (strings). If no channels are passed, the "heartbeat" channel is subscribed to. ```clojure (subscribe connection {:product_ids ["BTC-USD"]}) ```
(unsubscribe connection opts)
connection
is created with create-websocket-connection
.opts
takes the equivalent shape as subscribe
.(unsubscribe connection {:product_ids ["BTC-USD"]})
[API docs](https://docs.pro.coinbase.com/#subscribe) - `connection` is created with [[create-websocket-connection]]. - `opts` takes the equivalent shape as [[subscribe]]. ```clojure (unsubscribe connection {:product_ids ["BTC-USD"]}) ```
The websocket URL for Coinbase Pro.
The websocket URL for Coinbase Pro.
(withdraw-to-coinbase client opts)
(withdraw-to-coinbase client {:amount 2
:currency "BTC"
:coinbase_account_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"})
[API docs](https://docs.pro.coinbase.com/#coinbase49) ```clojure (withdraw-to-coinbase client {:amount 2 :currency "BTC" :coinbase_account_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"}) ```
(withdraw-to-crypto-address client opts)
(withdraw-to-crypto-address client {:amount 2
:currency "BTC"
:crypto_address "15USXR6S4DhSWVHUxXRCuTkD1SA6qAdy"})
[API docs](https://docs.pro.coinbase.com/#crypto) ```clojure (withdraw-to-crypto-address client {:amount 2 :currency "BTC" :crypto_address "15USXR6S4DhSWVHUxXRCuTkD1SA6qAdy"}) ```
(withdraw-to-payment-method client opts)
(withdraw-to-payment-method client {:amount 10
:currency "BTC-USD"
:payment_method_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"})
[API docs](https://docs.pro.coinbase.com/#payment-method48) ```clojure (withdraw-to-payment-method client {:amount 10 :currency "BTC-USD" :payment_method_id "7d0f7d8e-dd34-4d9c-a846-06f431c381ba"}) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close