{"_id":"coinbase-pro","_rev":"8-a69302850d84dc915ecde197a6ded1e1","name":"coinbase-pro","dist-tags":{"latest":"0.9.0"},"versions":{"0.0.0-draft.0":{"name":"coinbase-pro","version":"0.0.0-draft.0","_id":"coinbase-pro@0.0.0-draft.0","maintainers":[{"name":"ivoputzer","email":"ivo.putzer@gmail.com"}],"dist":{"shasum":"bff90247310a359b292f5c126efee9bcbc65ae96","tarball":"https://registry.npmjs.org/coinbase-pro/-/coinbase-pro-0.0.0-draft.0.tgz","fileCount":1,"integrity":"sha512-RrTk2iC5m2W9CtWRbWUutRhufRlN3jnl4lhgKAhxUgAASaaTbfahFRharZqmFfzBBi6sB6D+hLpnKBS20Ns4WQ==","signatures":[{"sig":"MEQCIDWM/E+E6ur26b0P/NXEEVVZw3VVlJLMbmGKCUkHrB2SAiBmhLnSVYEIvq4wLQOE+O8rkO+i7Bpj/NH1NhyPohPYYg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbLq/ACRA9TVsSAnZWagAALBMQAJiCsXtV+5G1P5iBVs5i\nR6flfAdTxUypIVYz6yBhFsZkq95IGwgakWDl9urRe2LeU+DgD0Tv50acMsoD\nkNZ2OsuqP5nqcy/wckuFFowP7q5nnzcVkhXnJJd7eAqoU0flF7sWUjZr8gm0\nr7GvWBP8T1xnJIbuWS59txnQUVougpcRgOLyk2j4YyeprbYqDRSv8pd9REgs\nx7y8EkGbLM9XiOfkdTUZOXX7BNxZlMq6wWGsUQavyOZE/fq3dgxn4/e22ifU\nWRkSoSTOhwc14r9W+oMAcyPZlvmcFcGZZFFlL78TLwXwP3g+N7qirXBp36Bm\nqrj0ivTJgBsBXxvBdd3YPTK5IS6uqHIsnsMYCgoR0xjJMuf8xeu97CyRi5UI\nvPQuIfeR26hhvVWdxP8SQMHG+48aLJJ+ZIEScOA5ShavkkmNazblGK7n9nht\nWXc/d/dqV2Lkuf5F7un6rwtu1e6NIpoxguAojYv/Qh+8pMXzCgw881rlFVgB\nGkwZqC35AFoe0E7ThBgjBn+Cqb7BLTxcRl0soK7+NzCZWNvsfOqjOmM+5Ffw\n5K/EvtsFa1rFJSJs9ahYhSDaTnIWliEvh+dXaA99c+dgTqlaHtNHPt7s9lWO\n0XQvpVAeT85H0HDCGZIdDRwCPiZ3dA2hWVD22JDPP2LFcVxUCytcIY+6JG6C\n11GU\r\n=7MU+\r\n-----END PGP SIGNATURE-----\r\n"},"gitHead":"0b1925e2a80caa065c6e09b8b6626f473aa2dda7","_npmUser":{"name":"ivoputzer","email":"ivo.putzer@gmail.com"},"deprecated":"Please use a supported version (>= 0.9.0)","_npmVersion":"5.6.0","directories":{},"_nodeVersion":"8.11.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/coinbase-pro_0.0.0-draft.0_1529786304263_0.3728416794990914","host":"s3://npm-registry-packages"}},"0.0.0-draft.1":{"name":"coinbase-pro","version":"0.0.0-draft.1","keywords":["gdax","coinbase","api","client"],"author":{"name":"Ivo"},"license":"MIT","_id":"coinbase-pro@0.0.0-draft.1","maintainers":[{"name":"ivoputzer","email":"ivo.putzer@gmail.com"}],"homepage":"https://github.com/ivoputzer/coinbase-pro#readme","bugs":{"url":"https://github.com/ivoputzer/coinbase-pro/issues"},"dist":{"shasum":"6758ec529005b10db1be6287ddc3496df1e2d4f9","tarball":"https://registry.npmjs.org/coinbase-pro/-/coinbase-pro-0.0.0-draft.1.tgz","fileCount":3,"integrity":"sha512-lGxv6nfTRAfMCQULP5XnSo1mNPmgHhL6FSZrI6LAQuRSB9Kbg8f+EQnuQ6htmEgZy6PLpSQB3+2ton1Zbsj9iQ==","signatures":[{"sig":"MEYCIQDsvAARNjsDJFfoIR+wKXYC17y4s11WZPy6HC6mccWN+AIhANQN8CcbpjooG0vaf1cUSOhiboX20lhdyx64+r7YMyvh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbLrKgCRA9TVsSAnZWagAAYY0P/3WrYxGGwy482uH9LzQX\ndvJzzsesX20g44XDJcsMEj2CSLYO3mWaIbWaO7jrrVinbfAQaOfZsMy9j12i\nwztPUjelB7VJbL9dmNPb4AIg8oBh5QrggIiflGvS/9MbtIRGGsFlC/h08Q41\n/WqbPXHiVuCF1fP/8XvCM0OOdUaEnWE4O5YHlT4bbcTwWNHuOIlBF9pE91nU\nX9vuEN2rN5m1r2yHDdc1ih8VWxQ90wuz2mGgwsayNjyOefGQA82R5OOOw/Gs\ncoCSRs2t+EnhDr7qNdEhtPUrkPJ1jo7U5BGEIB7F5ilT/Fnbqb2yQpkjh+gl\nPVYcXy/BrJliM+N/2R0QVsKoXwp9gMrOP3UxUN8rMsI5jn5Aovjot9t3AjmZ\nXaVusSt77m/esuK/DRBAR2ZhMrOAxqM59l9QfDgjE3KFof+GCsKlhJ7bHiV3\nSjyMT0LhQ3ZVt2XywEd5KRRipYc1JjPCPUkK3L6WU3YPfi5i4ntwdVm0qeob\nRkCcTJQHcTBBSOmi5S24DQgPUI9CPwncNi40zZ8m7Eba/tAt9mK6A0ftEp5/\n5qd85vxG2GE2qrEOOI58K0FgsZq284s02I4nG7sR3SAtwzfOS4D1VUEfvUjs\n32gC5HHDC/DKqycREN7kXl+m2E/05VTKu04lk8TiDT3u8YuTN6IQqwWLO8OG\nwg/y\r\n=I6Qa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"e52acb905621f9a47ea0c9964d0e81c13bc8a028","scripts":{"test":"m.test"},"_npmUser":{"name":"ivoputzer","email":"ivo.putzer@gmail.com"},"standard":{"global":["test"]},"deprecated":"Please use a supported version (>= 0.9.0)","repository":{"url":"git+https://github.com/ivoputzer/coinbase-pro.git","type":"git"},"_npmVersion":"5.6.0","description":"alias of the official library for Coinbase's GDAX API.","directories":{"test":"test"},"_nodeVersion":"8.11.3","dependencies":{"gdax":"*"},"_hasShrinkwrap":false,"devDependencies":{"m.test":"0.0.57","standard":"^11.0.1"},"_npmOperationalInternal":{"tmp":"tmp/coinbase-pro_0.0.0-draft.1_1529787040111_0.6349892134605852","host":"s3://npm-registry-packages"}},"0.9.0":{"name":"coinbase-pro","version":"0.9.0","keywords":["API","bitcoin","coinbase","exchange","real-time","trading","websockets","coinbase-pro","ethereum"],"author":{"name":"Coinbase"},"license":"MIT","_id":"coinbase-pro@0.9.0","maintainers":[{"name":"feedic","email":"me@feedic.com"}],"contributors":[{"url":"http://peterdowns.com","name":"Peter Downs","email":"peterldowns@gmail.com"},{"url":"http://maksim.ms","name":"Maksim Stepanenko","email":"maksimus16@gmail.com"},{"url":"http://miha.rebernik.info","name":"Miha Rebernik","email":"miha@rebernik.info"}],"homepage":"https://github.com/coinbase/coinbase-pro-node","bugs":{"url":"https://github.com/coinbase/coinbase-pro-node/issues"},"dist":{"shasum":"7653f805839010b2fddc96b12810f71636235215","tarball":"https://registry.npmjs.org/coinbase-pro/-/coinbase-pro-0.9.0.tgz","fileCount":27,"integrity":"sha512-mSzXOdYvP3WTMA64rZNLiDxdTUCHVxQrn5y7NDa7L0w6JmTfaOyxz9QwQRgrYwstfdprIsp8FRz7waXEC5W8SA==","signatures":[{"sig":"MEUCIQD6g+hinnWIrVmIXgu7QkmwcwZ9JivHc4huSFnvrc6D0AIgXNdrveyC6bz8Sxtyd3uzHbEiIy0PJbvKlbr6HSFP+ns=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":690360,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcx3IOCRA9TVsSAnZWagAARI8P/0EYnwqS9rRPKvCCzJQf\nLBSR0iL3sEQMH54PR129j3YOaHL+KNMnGLjp8BRlPx1Dt4s56hcPZWLEvWfh\nhW5ML2Be7zRXvEKmvYIVzfp/YRTGFsIiEtx1ENTnzBeEuWyGRyrBzmF6OmKO\nqukuAa7mVgXgtwpTzXj5BWHJGly58i+g8rNN3zGoKVA6fpwC4+s9v29I9iQa\nKsenBRha+OqT4C+TRJD+0OyCAc1pQNm3S4N/tPngxWZxtfN9Hmk7KTkyjFe0\nQtU13rn+bg6SqdBihdJfAjknwdJIXuhWXotav2KpPA5V7cS1jJRYsBXGTZog\nnRMrv0kU24RYB14a6ZRpk+K+apMLwsGZuS1qtHft/7GxEUeQRWo3RqRyfWpo\nN0hKtctr9PUobpEleXuRUSoSaaeDZql2myKwqZOiR6tp8XWGcQVq33ThL7Ew\nYmUTGvZ+j5/CVrnGwKEBn1KdHVM0Gwz1pAl3+4VwdrdbRFdRHIeIdMWYY/Og\njmjYlqovdwbhvQKXVNns4rfywPZSxnwH2ACzsHjMWCUxNJwn1FfuO2oMISfJ\nWYndR0fkzUaUNwU4+8em+nU8HWtrJ0IfmMK4QInNpIt0mxR0jPOouml//Zj/\nN7tHZrnIZkc57I/yih8RLnfxk81smPQ87wLHm336M/3DTjieMm03tL1NU7Ow\naUCn\r\n=JcuH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"index.d.ts","engines":{"node":">=6.0.0"},"gitHead":"f40a6984535540be95980dccab115a20ede0710c","scripts":{"lint":"eslint --ext .js ./","test":"mocha --full-trace --ui tdd --bail --reporter spec tests/*.js","prettier":"prettier -l *.js **/*.js","prettier-write":"npm run prettier -- --write"},"_npmUser":{"name":"feedic","email":"me@feedic.com"},"repository":{"url":"git://github.com/coinbase/coinbase-pro-node.git","type":"git"},"_npmVersion":"6.9.0","description":"Client for the coinbase-pro API","directories":{"lib":"./lib"},"lint-staged":{"*.{js}":["eslint --fix","prettier --write","git add"],"*.{json,md}":["prettier --write","git add"]},"_nodeVersion":"11.14.0","dependencies":{"ws":"^4.0.0","request":"^2.81.0","bintrees":"^1.0.1","bignumber.js":"^6.0.0","@types/request":"2.47.0"},"_hasShrinkwrap":false,"devDependencies":{"nock":"^9.0.13","husky":"^2.1.0","mocha":"^5.0.0","eslint":"^5.16.0","prettier":"~1.13.5","lint-staged":"^8.1.5"},"_npmOperationalInternal":{"tmp":"tmp/coinbase-pro_0.9.0_1556574733884_0.2776257203135364","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-06-23T20:38:24.262Z","modified":"2026-02-21T19:30:42.693Z","0.0.0-draft.0":"2018-06-23T20:38:24.350Z","0.0.0-draft.1":"2018-06-23T20:50:40.172Z","0.9.0":"2019-04-29T21:52:14.012Z"},"bugs":{"url":"https://github.com/coinbase/coinbase-pro-node/issues"},"author":{"name":"Coinbase"},"license":"MIT","homepage":"https://github.com/coinbase/coinbase-pro-node","keywords":["API","bitcoin","coinbase","exchange","real-time","trading","websockets","coinbase-pro","ethereum"],"repository":{"url":"git://github.com/coinbase/coinbase-pro-node.git","type":"git"},"description":"Client for the coinbase-pro API","contributors":[{"url":"http://peterdowns.com","name":"Peter Downs","email":"peterldowns@gmail.com"},{"url":"http://maksim.ms","name":"Maksim Stepanenko","email":"maksimus16@gmail.com"},{"url":"http://miha.rebernik.info","name":"Miha Rebernik","email":"miha@rebernik.info"}],"maintainers":[{"email":"me@feedic.com","name":"fb55"}],"readme":"# Coinbase Pro [![CircleCI](https://circleci.com/gh/coinbase/coinbase-pro-node.svg?style=svg)](https://circleci.com/gh/coinbase/coinbase-pro-node) [![npm version](https://badge.fury.io/js/coinbase-pro.svg)](https://badge.fury.io/js/coinbase-pro)\n\n**Note**: The `gdax` package is deprecated and might have to be removed from NPM.\nPlease migrate to the `coinbase-pro` package to ensure future compatibility.\n\nThe official Node.js library for Coinbase's [Pro API](https://docs.pro.coinbase.com/).\n\n## Features\n\n- Easy functionality to use in programmatic trading\n- A customizable, websocket-synced Order Book implementation\n- API clients with convenient methods for every API endpoint\n- Abstracted interfaces – don't worry about HMAC signing or JSON formatting; the\n  library does it for you\n\n## Installation\n\n```bash\nnpm install coinbase-pro\n```\n\nYou can learn about the API responses of each endpoint [by reading our\ndocumentation](https://docs.pro.coinbase.com/#market-data).\n\n## Quick Start\n\nThe Coinbase Pro API has both public and private endpoints. If you're only interested in\nthe public endpoints, you should use a `PublicClient`.\n\n```js\nconst CoinbasePro = require('coinbase-pro');\nconst publicClient = new CoinbasePro.PublicClient();\n```\n\nAll methods, unless otherwise specified, can be used with either a promise or\ncallback API.\n\n### Using Promises\n\n```js\npublicClient\n  .getProducts()\n  .then(data => {\n    // work with data\n  })\n  .catch(error => {\n    // handle the error\n  });\n```\n\nThe promise API can be used as expected in `async` functions in ES2017+\nenvironments:\n\n```js\nasync function yourFunction() {\n  try {\n    const products = await publicClient.getProducts();\n  } catch (error) {\n    /* ... */\n  }\n}\n```\n\n### Using Callbacks\n\nYour callback should accept three arguments:\n\n- `error`: contains an error message (`string`), or `null` if no error was\n  encountered\n- `response`: a generic HTTP response abstraction created by the [`request`\n  library](https://github.com/request/request)\n- `data`: contains data returned by the Coinbase Pro API, or `undefined` if an error was\n  encountered\n\n```js\npublicClient.getProducts((error, response, data) => {\n  if (error) {\n    // handle the error\n  } else {\n    // work with data\n  }\n});\n```\n\n**NOTE:** if you supply a callback, no promise will be returned. This is to\nprevent potential `UnhandledPromiseRejectionWarning`s, which will cause future\nversions of Node to terminate.\n\n```js\nconst myCallback = (err, response, data) => {\n  /* ... */\n};\n\nconst result = publicClient.getProducts(myCallback);\n\nresult.then(() => {\n  /* ... */\n}); // TypeError: Cannot read property 'then' of undefined\n```\n\n### Optional Parameters\n\nSome methods accept optional parameters, e.g.\n\n```js\npublicClient.getProductOrderBook('BTC-USD', { level: 3 }).then(book => {\n  /* ... */\n});\n```\n\nTo use optional parameters with callbacks, supply the options as the first\nparameter(s) and the callback as the last parameter:\n\n```js\npublicClient.getProductOrderBook(\n  'ETH-USD',\n  { level: 3 },\n  (error, response, book) => {\n    /* ... */\n  }\n);\n```\n\n### The Public API Client\n\n```js\nconst publicClient = new CoinbasePro.PublicClient(endpoint);\n```\n\n- `productID` _optional_ - defaults to 'BTC-USD' if not specified.\n- `endpoint` _optional_ - defaults to 'https://api.pro.coinbase.com' if not specified.\n\n#### Public API Methods\n\n- [`getProducts`](https://docs.pro.coinbase.com/#get-products)\n\n```js\npublicClient.getProducts(callback);\n```\n\n- [`getProductOrderBook`](https://docs.pro.coinbase.com/#get-product-order-book)\n\n```js\n// Get the order book at the default level of detail.\npublicClient.getProductOrderBook('BTC-USD', callback);\n\n// Get the order book at a specific level of detail.\npublicClient.getProductOrderBook('LTC-USD', { level: 3 }, callback);\n```\n\n- [`getProductTicker`](https://docs.pro.coinbase.com/#get-product-ticker)\n\n```js\npublicClient.getProductTicker('ETH-USD', callback);\n```\n\n- [`getProductTrades`](https://docs.pro.coinbase.com/#get-trades)\n\n```js\npublicClient.getProductTrades('BTC-USD', callback);\n\n// To make paginated requests, include page parameters\npublicClient.getProductTrades('BTC-USD', { after: 1000 }, callback);\n```\n\n- [`getProductTradeStream`](https://docs.pro.coinbase.com/#get-trades)\n\nWraps around `getProductTrades`, fetches all trades with IDs `>= tradesFrom` and\n`<= tradesTo`. Handles pagination and rate limits.\n\n```js\nconst trades = publicClient.getProductTradeStream('BTC-USD', 8408000, 8409000);\n\n// tradesTo can also be a function\nconst trades = publicClient.getProductTradeStream(\n  'BTC-USD',\n  8408000,\n  trade => Date.parse(trade.time) >= 1463068e6\n);\n```\n\n- [`getProductHistoricRates`](https://docs.pro.coinbase.com/#get-historic-rates)\n\n```js\npublicClient.getProductHistoricRates('BTC-USD', callback);\n\n// To include extra parameters:\npublicClient.getProductHistoricRates(\n  'BTC-USD',\n  { granularity: 3600 },\n  callback\n);\n```\n\n- [`getProduct24HrStats`](https://docs.pro.coinbase.com/#get-24hr-stats)\n\n```js\npublicClient.getProduct24HrStats('BTC-USD', callback);\n```\n\n- [`getCurrencies`](https://docs.pro.coinbase.com/#get-currencies)\n\n```js\npublicClient.getCurrencies(callback);\n```\n\n- [`getTime`](https://docs.pro.coinbase.com/#time)\n\n```js\npublicClient.getTime(callback);\n```\n\n### The Authenticated API Client\n\nThe [private exchange API endpoints](https://docs.pro.coinbase.com/#private) require you\nto authenticate with a Coinbase Pro API key. You can create a new API key [in your\nexchange account's settings](https://pro.coinbase.com/profile/api). You can also specify\nthe API URI (defaults to `https://api.pro.coinbase.com`).\n\n```js\nconst key = 'your_api_key';\nconst secret = 'your_b64_secret';\nconst passphrase = 'your_passphrase';\n\nconst apiURI = 'https://api.pro.coinbase.com';\nconst sandboxURI = 'https://api-public.sandbox.pro.coinbase.com';\n\nconst authedClient = new CoinbasePro.AuthenticatedClient(\n  key,\n  secret,\n  passphrase,\n  apiURI\n);\n```\n\nLike `PublicClient`, all API methods can be used with either callbacks or will\nreturn promises.\n\n`AuthenticatedClient` inherits all of the API methods from\n`PublicClient`, so if you're hitting both public and private API endpoints you\nonly need to create a single client.\n\n#### Private API Methods\n\n- [`getCoinbaseAccounts`](https://docs.pro.coinbase.com/#coinbase-accounts)\n\n```javascript\nauthedClient.getCoinbaseAccounts(callback);\n```\n\n- [`getPaymentMethods`](https://docs.pro.coinbase.com/#payment-methods)\n\n```javascript\nauthedClient.getPaymentMethods(callback);\n```\n\n- [`getAccounts`](https://docs.pro.coinbase.com/#list-accounts)\n\n```js\nauthedClient.getAccounts(callback);\n```\n\n- [`getAccount`](https://docs.pro.coinbase.com/#get-an-account)\n\n```js\nconst accountID = '7d0f7d8e-dd34-4d9c-a846-06f431c381ba';\nauthedClient.getAccount(accountID, callback);\n```\n\n- [`getAccountHistory`](https://docs.pro.coinbase.com/#get-account-history)\n\n```js\nconst accountID = '7d0f7d8e-dd34-4d9c-a846-06f431c381ba';\nauthedClient.getAccountHistory(accountID, callback);\n\n// For pagination, you can include extra page arguments\nauthedClient.getAccountHistory(accountID, { before: 3000 }, callback);\n```\n\n- [`getAccountTransfers`](https://docs.pro.coinbase.com/#get-account-transfers)\n\n```js\nconst accountID = '7d0f7d8e-dd34-4d9c-a846-06f431c381ba';\nauthedClient.getAccountTransfers(accountID, callback);\n\n// For pagination, you can include extra page arguments\nauthedClient.getAccountTransfers(accountID, { before: 3000 }, callback);\n```\n\n- [`getAccountHolds`](https://docs.pro.coinbase.com/#get-holds)\n\n```js\nconst accountID = '7d0f7d8e-dd34-4d9c-a846-06f431c381ba';\nauthedClient.getAccountHolds(accountID, callback);\n\n// For pagination, you can include extra page arguments\nauthedClient.getAccountHolds(accountID, { before: 3000 }, callback);\n```\n\n- [`buy`, `sell`](https://docs.pro.coinbase.com/#place-a-new-order)\n\n```js\n// Buy 1 BTC @ 100 USD\nconst buyParams = {\n  price: '100.00', // USD\n  size: '1', // BTC\n  product_id: 'BTC-USD',\n};\nauthedClient.buy(buyParams, callback);\n\n// Sell 1 BTC @ 110 USD\nconst sellParams = {\n  price: '110.00', // USD\n  size: '1', // BTC\n  product_id: 'BTC-USD',\n};\nauthedClient.sell(sellParams, callback);\n```\n\n- [`placeOrder`](https://docs.pro.coinbase.com/#place-a-new-order)\n\n```js\n// Buy 1 LTC @ 75 USD\nconst params = {\n  side: 'buy',\n  price: '75.00', // USD\n  size: '1', // LTC\n  product_id: 'LTC-USD',\n};\nauthedClient.placeOrder(params, callback);\n```\n\n- [`cancelOrder`](https://docs.pro.coinbase.com/#cancel-an-order)\n\n```js\nconst orderID = 'd50ec984-77a8-460a-b958-66f114b0de9b';\nauthedClient.cancelOrder(orderID, callback);\n```\n\n- [`cancelOrders`](https://docs.pro.coinbase.com/#cancel-all)\n\n```js\n// Cancels \"open\" orders\nauthedClient.cancelOrders(callback);\n```\n\n- [`cancelAllOrders`](https://docs.pro.coinbase.com/#cancel-all)\n\n```js\n// `cancelOrders` may require you to make the request multiple times until\n// all of the \"open\" orders are deleted.\n\n// `cancelAllOrders` will handle making these requests for you asynchronously.\n// Also, you can add a `product_id` param to only delete orders of that product.\n\n// The data will be an array of the order IDs of all orders which were cancelled\nauthedClient.cancelAllOrders({ product_id: 'BTC-USD' }, callback);\n```\n\n- [`getOrders`](https://docs.pro.coinbase.com/#list-open-orders)\n\n```js\nauthedClient.getOrders(callback);\n// For pagination, you can include extra page arguments\n// Get all orders of 'open' status\nauthedClient.getOrders({ after: 3000, status: 'open' }, callback);\n```\n\n- [`getOrder`](https://docs.pro.coinbase.com/#get-an-order)\n\n```js\nconst orderID = 'd50ec984-77a8-460a-b958-66f114b0de9b';\nauthedClient.getOrder(orderID, callback);\n```\n\n- [`getFills`](https://docs.pro.coinbase.com/#list-fills)\n\n```js\nconst params = {\n  product_id: 'LTC-USD',\n};\nauthedClient.getFills(params, callback);\n// For pagination, you can include extra page arguments\nauthedClient.getFills({ before: 3000 }, callback);\n```\n\n- [`getFundings`](https://docs.pro.coinbase.com/#list-fundings)\n\n```js\nauthedClient.getFundings({}, callback);\n```\n\n- [`repay`](https://docs.pro.coinbase.com/#repay)\n\n```js\nconst params = {\n  amount: '2000.00',\n  currency: 'USD',\n};\nauthedClient.repay(params, callback);\n```\n\n- [`marginTransfer`](https://docs.pro.coinbase.com/#margin-transfer)\n\n```js\nconst params =\n  'margin_profile_id': '45fa9e3b-00ba-4631-b907-8a98cbdf21be',\n  'type': 'deposit',\n  'currency': 'USD',\n  'amount': 2\n};\nauthedClient.marginTransfer(params, callback);\n```\n\n- [`closePosition`](https://docs.pro.coinbase.com/#close)\n\n```js\nconst params = {\n  repay_only: false,\n};\nauthedClient.closePosition(params, callback);\n```\n\n- [`convert`](https://docs.pro.coinbase.com/#create-conversion)\n\n```js\nconst params = {\n  from: 'USD',\n  to: 'USDC',\n  amount: '100',\n};\nauthedClient.convert(params, callback);\n```\n\n- [`deposit`, `withdraw`](https://docs.pro.coinbase.com/#deposits)\n\n```js\n// Deposit to your Exchange USD account from your Coinbase USD account.\nconst depositParamsUSD = {\n  amount: '100.00',\n  currency: 'USD',\n  coinbase_account_id: '60680c98bfe96c2601f27e9c', // USD Coinbase Account ID\n};\nauthedClient.deposit(depositParamsUSD, callback);\n\n// Withdraw from your Exchange USD account to your Coinbase USD account.\nconst withdrawParamsUSD = {\n  amount: '100.00',\n  currency: 'USD',\n  coinbase_account_id: '60680c98bfe96c2601f27e9c', // USD Coinbase Account ID\n};\nauthedClient.withdraw(withdrawParamsUSD, callback);\n\n// Deposit to your Exchange BTC account from your Coinbase BTC account.\nconst depositParamsBTC = {\n  amount: '2.0',\n  currency: 'BTC',\n  coinbase_account_id: '536a541fa9393bb3c7000023', // BTC Coinbase Account ID\n};\nauthedClient.deposit(depositParamsBTC, callback);\n\n// Withdraw from your Exchange BTC account to your Coinbase BTC account.\nconst withdrawParamsBTC = {\n  amount: '2.0',\n  currency: 'BTC',\n  coinbase_account_id: '536a541fa9393bb3c7000023', // BTC Coinbase Account ID\n};\nauthedClient.withdraw(withdrawParamsBTC, callback);\n\n// Fetch a deposit address from your Exchange BTC account.\nconst depositAddressParams = {\n  currency: 'BTC',\n};\nauthedClient.depositCrypto(depositAddressParams, callback);\n\n// Withdraw from your Exchange BTC account to another BTC address.\nconst withdrawAddressParams = {\n  amount: 10.0,\n  currency: 'BTC',\n  crypto_address: '15USXR6S4DhSWVHUxXRCuTkD1SA6qAdy',\n};\nauthedClient.withdrawCrypto(withdrawAddressParams, callback);\n```\n\n- [`depositPayment`](https://docs.pro.coinbase.com/#payment-method)\n\n```js\n// Schedule Deposit to your Exchange USD account from a configured payment method.\nconst depositPaymentParamsUSD = {\n  amount: '100.00',\n  currency: 'USD',\n  payment_method_id: 'bc6d7162-d984-5ffa-963c-a493b1c1370b', // ach_bank_account\n};\nauthedClient.depositPayment(depositPaymentParamsUSD, callback);\n```\n\n- [`withdrawPayment`](https://docs.pro.coinbase.com/#payment-method47)\n\n```js\n// Withdraw from your Exchange USD account to a configured payment method.\nconst withdrawPaymentParamsUSD = {\n  amount: '100.00',\n  currency: 'USD',\n  payment_method_id: 'bc6d7162-d984-5ffa-963c-a493b1c1370b', // ach_bank_account\n};\nauthedClient.withdrawPayment(withdrawPaymentParamsUSD, callback);\n```\n\n- [`getTrailingVolume`](https://docs.pro.coinbase.com/#user-account)\n\n```js\n// Get your 30 day trailing volumes\nauthedClient.getTrailingVolume(callback);\n```\n\n### Websocket Client\n\nThe `WebsocketClient` allows you to connect and listen to the [exchange\nwebsocket messages](https://docs.pro.coinbase.com/#messages).\n\n```js\nconst websocket = new CoinbasePro.WebsocketClient(['BTC-USD', 'ETH-USD']);\n\nwebsocket.on('message', data => {\n  /* work with data */\n});\nwebsocket.on('error', err => {\n  /* handle error */\n});\nwebsocket.on('close', () => {\n  /* ... */\n});\n```\n\nThe client will automatically subscribe to the `heartbeat` channel. By\ndefault, the `full` channel will be subscribed to unless other channels are\nrequested.\n\n```javascript\nconst websocket = new CoinbasePro.WebsocketClient(\n  ['BTC-USD', 'ETH-USD'],\n  'wss://ws-feed-public.sandbox.pro.coinbase.com',\n  {\n    key: 'suchkey',\n    secret: 'suchsecret',\n    passphrase: 'muchpassphrase',\n  },\n  { channels: ['full', 'level2'] }\n);\n```\n\nOptionally, [change subscriptions at runtime](https://docs.pro.coinbase.com/#subscribe):\n\n```javascript\nwebsocket.unsubscribe({ channels: ['full'] });\n\nwebsocket.subscribe({ product_ids: ['LTC-USD'], channels: ['ticker', 'user'] });\n\nwebsocket.subscribe({\n  channels: [\n    {\n      name: 'user',\n      product_ids: ['ETH-USD'],\n    },\n  ],\n});\n\nwebsocket.unsubscribe({\n  channels: [\n    {\n      name: 'user',\n      product_ids: ['LTC-USD'],\n    },\n    {\n      name: 'user',\n      product_ids: ['ETH-USD'],\n    },\n  ],\n});\n```\n\nThe following events can be emitted from the `WebsocketClient`:\n\n- `open`\n- `message`\n- `close`\n- `error`\n\n### Orderbook\n\n`Orderbook` is a data structure that can be used to store a local copy of the\norderbook.\n\n```js\nconst orderbook = new CoinbasePro.Orderbook();\n```\n\nThe orderbook has the following methods:\n\n- `state(book)`\n- `get(orderId)`\n- `add(order)`\n- `remove(orderId)`\n- `match(match)`\n- `change(change)`\n\n### Orderbook Sync\n\n`OrderbookSync` creates a local mirror of the orderbook on Coinbase Pro using\n`Orderbook` and `WebsocketClient` as described\n[here](https://docs.pro.coinbase.com/#real-time-order-book).\n\n```js\nconst orderbookSync = new CoinbasePro.OrderbookSync(['BTC-USD', 'ETH-USD']);\nconsole.log(orderbookSync.books['ETH-USD'].state());\n```\n\n## Testing\n\n```bash\nnpm test\n\n# test for known vulnerabilities in packages\nnpm install -g nsp\nnsp check --output summary\n```\n","readmeFilename":"README.md"}