npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-api-coinbase

v0.1.14

Published

Non-official implementation of Coinbase's Advanced Trade API's

Downloads

3

Readme

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

| API | DESCRIPTION | | :---- | :---- | | listAccounts | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccounts | | getAccount | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getaccount |

Orders

| API | DESCRIPTION | | :---- | :---- | | createOrder | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder | | cancelOrders | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_cancelorders | | editOrder | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_editorder | | editOrderPreview | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_previeweditorder | | listOrders | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorders | | listFills | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getfills | | getOrder | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gethistoricalorder |

Products

| API | DESCRIPTION | | :---- | :---- | | getBest | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getbestbidask | | getOrderBook | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproductbook | | listProducts | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproducts | | getProduct | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getproduct | | getCandles | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getcandles | | getTrades | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getmarkettrades |

Fees

| API | DESCRIPTION | | :---- | :---- | | getTransactions | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gettransactionsummary |

Convert

| API | DESCRIPTION | | :---- | :---- | | createQuote | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_createconvertquote | | commitConvert | https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_commitconverttrade | | getConvert | https://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
  };

| API | HANDLER | DESCRIPTION | | :---- | :---- | :---- | | subscribe* unsubscribe* | subscriptions | | | subscribeHeartbeats unsubscribeHeartbeats | heartbeats | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#heartbeats-channel | | subscribeCandles unsubscribeCandles | candles.snapshot candles.update | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#candles-channel | | subscribeStatus unsubscribeStatus | status.snapshot status.update(?) | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#status-channel | | subscribeTicker unsubscribeTicker | ticker.snapshot ticker.update | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#ticker-channel | | subscribeTickerBatch unsubscribeTickerBatch | ticker_batch.snapshot ticker_batch.update | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#ticker-batch-channel | | subscribeOrderbook unsubscribeOrderbook | l2_data.snapshot l2_data.update | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#level2-channel | | subscribeUser unsubscribeUser | user.snapshot user.update(?) | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#user-channel | | subscribeTrades unsubscribeTrades | market_trades.snapshot market_trades.update | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-channels#market-trades-channel |