Liking cljdoc? Tell your friends :D

coinbase-pro-clj.core

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.**
raw docstring

cancel-allclj

(cancel-all client)
(cancel-all client product-id)

API docs

(cancel-all client "BTC-USD")
[API docs](https://docs.pro.coinbase.com/#cancel-all)
```clojure
(cancel-all client "BTC-USD")
```
sourceraw docstring

cancel-orderclj

(cancel-order client order-id)

API docs

(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")
```
sourceraw docstring

closeclj

(close connection)

connection is created with create-websocket-connection.

`connection` is created with [[create-websocket-connection]].
sourceraw docstring

create-websocket-connectionclj

(create-websocket-connection opts)

API docs

  • 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))}))
```
sourceraw docstring

deposit-from-coinbaseclj

(deposit-from-coinbase client opts)

API docs

(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"})
```
sourceraw docstring

deposit-from-payment-methodclj

(deposit-from-payment-method client opts)

API docs

(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"})
```
sourceraw docstring

generate-reportclj

(generate-report client opts)

API docs

(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"})
```
sourceraw docstring

get-24hour-statsclj

(get-24hour-stats client product-id)

API docs

(get-24hour-stats client "BTC-USD")
[API docs](https://docs.pro.coinbase.com/#get-24hr-stats)
```clojure
(get-24hour-stats client "BTC-USD")
```
sourceraw docstring

get-accountclj

(get-account client account-id)

API docs

(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")
```
sourceraw docstring

get-account-historyclj

(get-account-history client account-id)
(get-account-history client account-id paging-opts)

API docs

(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})
```
sourceraw docstring

get-account-holdsclj

(get-account-holds client account-id)
(get-account-holds client account-id paging-opts)

API docs

(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})
```
sourceraw docstring

get-accountsclj

(get-accounts client)
[API docs](https://docs.pro.coinbase.com/#list-accounts)
sourceraw docstring

get-coinbase-accountsclj

(get-coinbase-accounts client)
[API docs](https://docs.pro.coinbase.com/#list-accounts54)
sourceraw docstring

get-currenciesclj

(get-currencies client)
[API docs](https://docs.pro.coinbase.com/#get-currencies)
sourceraw docstring

get-fillsclj

(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})
```
sourceraw docstring

get-historic-ratesclj

(get-historic-rates client product-id)
(get-historic-rates client product-id opts)

API docs

(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})
```
sourceraw docstring

get-orderclj

(get-order client order-id)

API docs

(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")
```
sourceraw docstring

get-order-bookclj

(get-order-book client product-id)
(get-order-book client product-id level)

API docs

(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)
```
sourceraw docstring

get-ordersclj

(get-orders client)
(get-orders client opts)

API docs

(get-orders client {:status ["open" "pending"]})
[API docs](https://docs.pro.coinbase.com/#list-orders)
```clojure
(get-orders client {:status ["open" "pending"]})
```
sourceraw docstring

get-payment-methodsclj

(get-payment-methods client)
[API docs](https://docs.pro.coinbase.com/#list-payment-methods)
sourceraw docstring

get-productsclj

(get-products client)
[API docs](https://docs.pro.coinbase.com/#products)
sourceraw docstring

get-report-statusclj

(get-report-status client report-id)

API docs

(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")
```
sourceraw docstring

get-tickerclj

(get-ticker client product-id)
(get-ticker client product-id opts)

API docs

(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})
```
sourceraw docstring

get-timeclj

(get-time client)
[API docs](https://docs.pro.coinbase.com/#time)
sourceraw docstring

get-tradesclj

(get-trades client product-id)
(get-trades client product-id opts)

API docs

(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})
```
sourceraw docstring

get-trailing-volumeclj

(get-trailing-volume client)
[API docs](https://docs.pro.coinbase.com/#trailing-volume)
sourceraw docstring

place-orderclj

(place-order client opts)

API docs

(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})
```
sourceraw docstring

rest-urlclj

The rest URL for Coinbase Pro.

The rest URL for Coinbase Pro.
sourceraw docstring

sandbox-rest-urlclj

The sandbox rest URL for Coinbase Pro.

The sandbox rest URL for Coinbase Pro.
sourceraw docstring

sandbox-websocket-urlclj

The sandbox websocket URL for Coinbase Pro.

The sandbox websocket URL for Coinbase Pro.
sourceraw docstring

subscribeclj

(subscribe connection opts)

API docs

{: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"]})
```
sourceraw docstring

unsubscribeclj

(unsubscribe connection opts)

API docs

(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"]})
```
sourceraw docstring

websocket-urlclj

The websocket URL for Coinbase Pro.

The websocket URL for Coinbase Pro.
sourceraw docstring

withdraw-to-coinbaseclj

(withdraw-to-coinbase client opts)

API docs

(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"})
```
sourceraw docstring

withdraw-to-crypto-addressclj

(withdraw-to-crypto-address client opts)

API docs

(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"})
```
sourceraw docstring

withdraw-to-payment-methodclj

(withdraw-to-payment-method client opts)

API docs

(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"})  
```
sourceraw docstring

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

× close