API Coinbase

Coinbase

 

APIs supported

 

 

Most common uses

 

WebSockets API

The WebSocket feed is publicly available and provides real-time market data updates for orders and trades. Two endpoints are supported in production:

 

 

You can subscribe to the following channels:

 

Method Arguments Description
SubscribeHeartBeat   Real-time server pings to keep all connections open
SubscribeStatus aProductId: id of the product Sends all products and currencies on a preset interval
SubscribeCandles aProductId: id of the product Real-time updates on product candles
SubscribeTicker aProductId: id of the product Real-time price updates every time a match happens
SubscribeTickerBatch aProductId: id of the product Real-time price updates every 5000 milli-seconds
SubscribeLevel2 aProductId: id of the product All updates and easiest way to keep order book snapshot
SubscribeMarketTrades aProductId: id of the product Real-time updates every time a market trade happens
SubscribeUser aProductId: id of the product Only sends messages that include the authenticated user
SubscribeFuturesBalanceSummary   Real-time updates every time a user's futures balance changes

 

The User and FuturesBalanceSummary requires authentication, so first request your API keys in your Coinbase account and then set the values in the property Coinbase of the component:

 

 

Authentication will result in a couple of benefits:

  1. Messages where you're one of the parties are expanded and have more useful fields
  2. You will receive private messages, such as lifecycle information about stop orders you placed

 

 

 

REST API

Private Endpoints

Private endpoints are available for order management, and account management.

Before being able to sign any requests, you must create an API key via the Coinbase Pro website. The API key will be scoped to a specific profile. Upon creating a key you will have 3 pieces of information which you must remember:

 

 

The Key and Secret will be randomly generated and provided by Coinbase Pro; the Passphrase will be provided by you to further secure your API access. Coinbase Pro stores the salted hash of your passphrase for verification, but cannot recover the passphrase if you forget it.

 

You can restrict the functionality of API keys. Before creating the key, you must choose what permissions you would like the key to have. The permissions are:

 

 

Accounts

 

Method Arguments Description
ListAccounts   Get a list of trading accounts from the profile of the API key.
GetAccount aAccountId: id of the account Information for a single account. Use this endpoint when you know the account_id. API key must belong to the same profile as the account.

 

Orders

 

Method Arguments Description
PlaceNewOrder aOrder: class that contains all possible fields of an order Places a new order. Use only if you need to access to advanced order options.
PlaceMarketOrder

aSide: buy or sell

aProductId: id of the product

aQuoteSize: The amount of the second Asset in the Trading Pair.

aBaseSize: The amount of the first Asset in the Trading Pair

aClient_oid: Order ID selected by you to identify your order

Places a new Market order.
PlaceLimitOrder

aSide: buy or sell

aProductId: id of the product

aQuoteSize: The amount of the second Asset in the Trading Pair.

aBaseSize: The amount of the first Asset in the Trading Pair

aLimitPrice: price limit

Client_oid: Order ID selected by you to identify your order

Places a new Limit order.  
PlaceStopOrder

aSide: buy or sell

ProductId: id of the product

aBaseSize: The amount of the first Asset in the Trading Pair

StopPrice: price of the stop

aLimitPrice: price limit

aStopDirection: loss or entry

Client_oid: Order ID selected by you to identify your order

Places a new Stop Order
CancelOrder aOrderId: id of the order Cancel a previously placed order. Order must belong to the profile that the API key belongs to.
EditOrder

aOrderId: id of the order

aPrice: price

aSize: Amount

Edit an order with a specified new size, or new price
EditOrderPreview

aOrderId: id of the order

aPrice: price

aSize: Amount

Preview an edit order request with a specified new size, or new price.
ListOrders   Get a list of orders filtered by optional query parameters (product_id, order_status, etc).
GetOrder aOrderId: id of the order Get a single order by order ID.
PreviewOrder   Preview an order.
ClosePosition

aOrderId: id of the order

aProductId: id of the product

aSize: amount

Places an order to close any open positions for a specified product_id.

 

 

 

 

Market Data

 

Method Arguments Description
GetPublicProducts   Get a list of the available currency pairs for trading.
GetPublicProduct

aProductId: id of the product

Get information on a single product by product ID.
GetPublicProductBook aProductId: id of the product Get a list of bids/asks for a single product. The amount of detail shown can be customized with the limit parameter.
GetPublicProductCandles

aProductId: id of the product

aStart: start of the time interval

aEnd: end of the time interval

aGranularity: The timeframe each candle represents.

Get rates for a single product by product ID, grouped in buckets.
GetTrades aProductId: id of the product Get snapshot information by product ID about the last trades (ticks) and best bid/ask.
GetTime

 

Get the current time from the Coinbase Advanced API.

 

 

Fills

 

Method Arguments Description
GetFillsByOrderId   Get a list of fills filtered by order id
GetFillsByProductId

 

Get a list of fills filtered by product id
GetFillsByTradeId   Get a list of fills filtered by trade id