Package: cb-advanced-trade
cb-advanced-tradeCoinbase Advanced Trade API client library.Installation:python -m pip install [--upgrade] cb-advanced-tradeEndpoints:INFO:Advanced Trade endpoints require authentication using anAPI Key authenticationscheme.
You can generate API keyshere.AccountsOrdersProductsTransactionSummaryRequired parameters:key: str - The API key;secret: str - The API secret.Optional parameters:cache: bool - Use caching (defaults to:True);retries: int - Total number of retries to allow (defaults to:3);backoff: int - A backoff factor to apply between attempts after the second try (defaults to:1);timeout: int - How long to wait for the server to send data before giving up (defaults to:30);debug: bool - Set to True to log all requests/responses to/from server (defaults to:False);logger: Logger - The handler to be used for logging (defaults to:None).Any of the endpoints can be instantiated or used as a context-manager:fromcb_advanced_tradeimportAccountscredentials:dict={"key":"KEY","secret":"SECRET",}# be careful where you keep your credentials!if__name__=='__main__':endpoint=Accounts(**credentials)account=endpoint.get_account("2ca72458-ade9-45fd-83f2-e1f468b70026")endpoint.close()# orwithAccounts(**credentials)asendpoint:account=endpoint.get_account("2ca72458-ade9-45fd-83f2-e1f468b70026")Resources:For each mapped resource you must read thedocumentation.
All the parameters these resources can take are described in the official documentation.Accountsget_accounts()Get a list of authenticated accounts for the current user.get_account()Get a list of information about an account, given an account UUID.Orderscreate_order()Create an order with a specifiedproduct_id(asset-pair),side(buy/sell), etc.Maximum Open Orders Per ProductThe maximum number ofOPENorders you can have for a givenproduct_idis 500. If you have 500 open orders for aproduct_idat submission, new orders placed for that product enter a failed state immediately.del_order()Initiate cancel requests for one or more orders.get_orders()Get a list of orders filtered by optional query parameters (product_id,order_status, etc).Maximum Open Orders ReturnedThe maximum number ofOPENorders returned is 1000.CAUTIONIf you have more than 1000 open, is recommended theWebSocket User channelto retrieve allOPENorders.get_fills()Get a list of fills filtered by optional query parameters (product_id,order_id, etc).get_order()Get a single order by order ID.Productsget_products()Get a list of the available currency pairs for trading.get_product()Get information on a single product by product ID.get_product_candles()Get rates for a single product by product ID, grouped in buckets.get_market_trades()Get snapshot information, by product ID, about the last trades (ticks), best bid/ask, and 24h volume.TransactionSummaryget_transaction_summary()Get a summary of transactions with fee tiers, total volume, and fees.Websocket client:Required parameters:key: The API key;secret: The API secret;channel: The channel to subscribe to;product_ids: Product IDs as list of strings.Optional parameters:debug: Set to True to log all requests/responses to/from server (defaults to:False).logger: The handler to be used for logging. If given, and level is aboveDEBUG,
all debug messages will be ignored.Note:For information about Websocket feed channels visit thedocumentation.Examples:MarketDatafromcb_advanced_tradeimportMarketDatacredentials={"key":"YOUR KEY","secret":"YOUR SECRET",}# be careful where you keep this!if__name__=='__main__':client=MarketData(**credentials,channel="ticker",product_ids=["BTC-USD"],debug=True)client.listen()try:fortickinclient.queue:print(tick)exceptKeyboardInterrupt:client.close()