0.1.14 • Published 5 months ago

node-api-coinbase v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

node-api-coinbase

WARNING: This package is still early beta! Expect breaking changes until this sees a major release.

Non-official implementation of Coinbase's Advanced Trade API's. Developed for personal use.

For support on using the API's or development issues, please refer to the official API documentation. For questions regarding this package, please consult the code first.

PUBLIC API

Nothing here

PRIVATE API

  const coinbase=require('node-api-coinbase');

  const auth = {
    apikey: 'MY_API_KEY',
    secret: 'MY_API_SECRET'
  };

  const privateAPI=new coinbase.privateApi(auth);

Accounts

APIDESCRIPTION
listAccountshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts
getAccounthttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccount

Orders

APIDESCRIPTION
createOrderhttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder
cancelOrdershttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_cancelorders
editOrderhttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_editorder
editOrderPreviewhttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_previeweditorder
listOrdershttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders
listFillshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getfills
getOrderhttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorder

Products

APIDESCRIPTION
getBesthttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getbestbidask
getOrderBookhttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproductbook
listProductshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts
getProducthttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproduct
getCandleshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getcandles
getTradeshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getmarkettrades

Fees

APIDESCRIPTION
getTransactionshttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gettransactionsummary

Convert

APIDESCRIPTION
createQuotehttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_createconvertquote
commitConverthttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_commitconverttrade
getConverthttps://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_commitconverttrade

WEBSOCKET API

  const coinbase=require('node-api-coinbase');

  const auth = {
    apikey: 'MY_API_KEY',
    secret: 'MY_API_SECRET'
  };

  const tradingAPI=new coinbase.sockets.tradingApi(auth);
  tradingAPI.setHandler('user.snapshot', (method,data,symbol,option) => { updateOrder(method,data.orders,user,api,handler); });
  tradingAPI.setHandler('user.update', (method,data,symbol,option) => { updateOrder(method,data.orders,user,api,handler); });

  tradingAPI.socket._ws.on('authenticated', async () => {
    await tradingAPI.subscribeUser(['ETH-BTC','BTC-USDT']);

  });

  tradingAPI.socket._ws.on('closed', async () => {
    // do something, like clean-up and reconnect
  });

  function updateOrder(symbol,method,data) {
    // do something
  };
APIHANDLERDESCRIPTION
subscribe unsubscribesubscriptions
subscribeHeartbeats unsubscribeHeartbeatsheartbeatshttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#heartbeats-channel
subscribeCandles unsubscribeCandlescandles.snapshot candles.updatehttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#candles-channel
subscribeStatus unsubscribeStatusstatus.snapshot status.update(?)https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#status-channel
subscribeTicker unsubscribeTickerticker.snapshot ticker.updatehttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#ticker-channel
subscribeTickerBatch unsubscribeTickerBatchticker_batch.snapshot ticker_batch.updatehttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#ticker-batch-channel
subscribeOrderbook unsubscribeOrderbookl2_data.snapshot l2_data.updatehttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#level2-channel
subscribeUser unsubscribeUseruser.snapshot user.update(?)https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#user-channel
subscribeTrades unsubscribeTradesmarket_trades.snapshot market_trades.updatehttps://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#market-trades-channel
0.1.13

5 months ago

0.1.14

5 months ago

0.1.10

5 months ago

0.1.11

5 months ago

0.1.12

5 months ago

0.1.8

5 months ago

0.1.7

7 months ago

0.1.9

5 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago

0.0.1

9 months ago