{"id":21298623,"url":"https://github.com/passabilities/crypto-exchange","last_synced_at":"2025-04-05T22:03:48.930Z","repository":{"id":54000340,"uuid":"97649710","full_name":"passabilities/crypto-exchange","owner":"passabilities","description":"Pulls together list of crypto exchanges to interact with their API's in a uniform fashion.","archived":false,"fork":false,"pushed_at":"2018-07-21T17:53:59.000Z","size":180,"stargazers_count":265,"open_issues_count":2,"forks_count":73,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-29T21:04:00.214Z","etag":null,"topics":["altcoin","api","balance","bitcoin","bitfinex","bittrex","btc-e","crypto","crypto-exchange","depth","exchange","gdax","gemini","kraken","liquid","pair","poloniex","ticker","yunbi"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/passabilities.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-18T22:35:32.000Z","updated_at":"2025-01-22T02:58:36.000Z","dependencies_parsed_at":"2022-08-13T05:50:53.176Z","dependency_job_id":null,"html_url":"https://github.com/passabilities/crypto-exchange","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passabilities%2Fcrypto-exchange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passabilities%2Fcrypto-exchange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passabilities%2Fcrypto-exchange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passabilities%2Fcrypto-exchange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/passabilities","download_url":"https://codeload.github.com/passabilities/crypto-exchange/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406085,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["altcoin","api","balance","bitcoin","bitfinex","bittrex","btc-e","crypto","crypto-exchange","depth","exchange","gdax","gemini","kraken","liquid","pair","poloniex","ticker","yunbi"],"created_at":"2024-11-21T14:56:12.161Z","updated_at":"2025-04-05T22:03:48.912Z","avatar_url":"https://github.com/passabilities.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypto-exchange [![npm](https://img.shields.io/npm/v/crypto-exchange.svg)](https://www.npmjs.com/package/crypto-exchange)\n\nPulls together list of crypto exchanges to interact with their API's in a uniform fashion.\n\nThe goal of this project is to be able to interact with a number of different cryptocurrency exchange markets with one standardized package.\n\n## Available Exchanges\n\n* Binance\n* Bitfinex\n* Bitstamp\n* Bittrex\n* ~~BTC-e~~ ***shutdown***\n* GDAX\n* Gemini\n* Kraken\n* Liqui\n* Poloniex\n* ~~Yunbi~~\n\n## Usage\n\n* ***NOTE*: Pairs are expected to be in the format *BASE_QUOTE***\n* All methods return a promise with the result passed.\n\n### Top Level\n\n#### Exchange List\n\nList of all available exchanges from the package:\n\n```javascript\n  const Exchanges = require('crypto-exchange')\n  console.log(Object.keys(Exchanges))\n  // [\n  //   'bittrex',\n  //   'gdax'\n  //   'kraken',\n  //   'poloniex',\n  //   ...\n  // ]\n```\n\n#### pairs\n\nQuickly fetch all available pairs and which exchanges support them.\n\n```javascript\n  const Exchanges = require('crypto-exchange')\n  Exchanges.pairs()\n    .then(console.log)\n  // {\n  //   BTC_USD: [ 'bitfinex', 'gdax', 'gemini', 'kraken' ],\n  //   LTC_USD: [ 'bitfinex', 'gdax', 'kraken' ],\n  //   LTC_BTC: [ 'bitfinex', 'bittrex', 'gdax', 'kraken', 'liqui', 'poloniex' ],\n  //   ETH_USD: [ 'bitfinex', 'gdax', 'gemini', 'kraken' ],\n  //   ETH_BTC: [ 'bitfinex', 'bittrex', 'gdax', 'gemini', 'kraken', 'liqui', 'poloniex' ],\n  //   ETC_BTC: [ 'bitfinex', 'bittrex', 'kraken', 'poloniex' ],\n  //   ETC_USD: [ 'bitfinex', 'kraken' ],\n  //   RRT_USD: [ 'bitfinex' ],\n  //   ...\n  // }\n```\n\n#### assets\n\nQuickly fetch all available assets and which exchanges support them.\n\n```javascript\n  const Exchanges = require('crypto-exchange')\n  Exchanges.assets()\n    .then(console.log)\n  // {\n  //   BTC: [ 'bitfinex', 'bittrex', 'gdax', 'gemini', 'kraken', 'liqui', 'poloniex' ],\n  //   USD: [ 'bitfinex', 'gdax', 'gemini', 'kraken' ],\n  //   LTC: [ 'bitfinex', 'bittrex', 'gdax', 'kraken', 'liqui', 'poloniex' ],\n  //   ETH: [ 'bitfinex', 'bittrex', 'gdax', 'gemini', 'kraken', 'liqui', 'poloniex' ],\n  //   ETC: [ 'bitfinex', 'bittrex', 'kraken', 'poloniex' ],\n  //   RRT: [ 'bitfinex' ],\n  //   ...\n  // }\n```\n\n### Public Methods\n\nAll public methods are both accessible via a static function and an instance method.\nIf only working with public methods, it is not neccessary to create an instance of the exchange class (one is created internally).\n\nBoth examples call the same method:\n```javascript\n  const Exchanges = require('crypto-exchange')\n\n  Exchanges.poloniex.ticker('BTC_USDT')\n  // =\u003e Promise { \u003cpending\u003e }\n\n  const poloniex = new Exchanges.poloniex(apiKeys)\n  poloniex.ticker('BTC_USDT')\n  // =\u003e Promise { \u003cpending\u003e }\n```\n\n#### ticker\n\nReturn current ticker information for a given pair on an exchange.\n\n```javascript\n  ticker(pairs) {\n  }\n```\n\n###### Arguments\n\n* `pairs` string, array - One or more pairs to fetch the current ticker for.\n\n###### Response\n\n```javascript\n  {\n    'BTC_USD': {\n      last: 2336.00001284,\n      ask: 2337.9,\n      bid: 2337,\n      high: 2380,\n      low: 2133,\n      volume: 6597.97852916,\n      timestamp: 1500461237647 // in milliseconds\n    },\n    ...\n  }\n```\n\n#### assets\n\nReturns the available assets on an exchange. If the asset is disabled/frozen, it is not included.\n\n```javascript\n  assets() {\n  }\n```\n\n###### Response\n\n```javascript\n  [\n    'AMP',\n    'ARDR',\n    'BCY',\n    'BELA',\n    'BLK',\n    'BTC',\n    ...\n  ]\n```\n\n#### pairs\n\nReturns the available pairs on an exchange.\n\n```javascript\n  pairs() {\n  }\n```\n\n###### Response\n\n```javascript\n  [\n    'BCN_BTC',\n    'BELA_BTC',\n    'BLK_BTC',\n    'BTCD_BTC',\n    'BTM_BTC',\n    ...\n  ]\n```\n\n#### depth\n\nReturns the depth of available buy and sell orders.\n\n```javascript\n  depth(pairs[, count = 50]) {\n  }\n```\n\n###### Arguments\n\n* `pairs` string, array - One or more pairs to fetch the order book for.\n* `depth` number (optional) - How big of an order book to return in each direction. DEFAULT: 50\n\n###### Response\n\n```javascript\n  {\n    'ETH_BTC': {\n      'asks': [\n        [\n          0.06773,    // price\n          10.30181086 // volume\n        ],\n        ...\n      ],\n      'bids': [\n        [\n          0.0676,     // price\n          7.59674753  // volume\n        ],\n        ...\n      ]\n    },\n    ...\n  }\n```\n\n### Authenticated Methods\n\nTo use authenticated methods, you will need to pass any necessary authentication data needed from the exchange in the constructor of the exchange.\n\nAll exchanges require a minimum of 2 items:\n* `key`\n* `secret`\n\nSpecial case authentication:\n* GDAX\n  * `passphrase`\n\nExample:\n```javascript\n  const Exchanges = require('crypto-exchange')\n\n  let bittrex = new Exchanges.bittrex({\n    key: '',\n    secret: ''\n  })\n\n  let gdax = new Exchanges.gdax({\n    key: '',\n    secret: '',\n    passphrase: ''\n  })\n```\n\n#### buy/sell\n\nPlace a buy or sell order on an exchange.\n\n```javascript\n  buy(pair, amount[, rate[, type[, extra]]]) {\n  }\n```\n\n###### Arguments\n\n* `pair` string - A pair value to trade against.\n* `amount` number - Number representing the amount of ***BASE*** to buy/sell.\n* `rate` number (optional) - Pass a specific rate of the pair to execute.\n  * Only optional if exchange API allows \"market orders.\" Must set `type` accordingly.\n* `type` string (optional) - Define type of order to execute.\n  * Not all exchanges allow to change order type (i.e. market orders).\n  * For exchanges that `rate` is required, it will default to a limit order.\n* `extra` object (optional) - Extra parameters that are REQUIRED by the exchange, if applicable.\n\n###### Response\n\n```javascript\n\n```\n\n#### balances\n\nReturn current total, available, and pending balances for an exchange.\n\n***NOTE***: **Bitfinex** requires a wallet type to fetch. The underlying method fetches all wallet types on request and will refresh, if called, every 2 minutes to allow immediate subsequent calls.\n\n```javascript\n  balances([opts]) {\n  }\n```\n\n###### Arguments\n\n* `opts` object (optional) - Additional options.\n  * `type` string (**Bitfinex**) - Wallet type ('deposit', 'exchange', 'trading').\n\n###### Response\n\n```javascript\n  {\n    'BTC': {\n      balance: 0.0000,\n      available: 0.0000,\n      pending: 0.0000\n    },\n    ...\n  }\n```\n\n#### address\n\nReturn or create a new address to which funds can be deposited.\n\n***Note:*** Due to how **Coinbase** and GDAX are intertwined, you must pass aditional authentication in order to interact with outside resources.\n\n***Note:*** **Bitfinex** requires a wallet type.\n\n```javascript\n  address(sym[, opts]) {\n  }\n```\n\n###### Arguments\n\n* `sym` string - The asset symbol of the address to fetch.\n* `opts` object (optional) - Additional options.\n  * `auth` object (**Coinbase**) - Secondary API authentication.\n  * `type` string (**Bitfinex**) - Wallet type ('deposit', 'exchange', 'trading').\n\n###### Response\n\n```javascript\n  \"0xae89158b43000e07e76b205b870a1e34653d2668\"\n```\n\n## Donate\n\nThis project is a work in progress as I'm adding more exchanges and functions. Help support this project with a :coffee: or PR!\n\nBTC: `161kbECzKtDKfLXnC5Lwk2hgsQLtg7BNXd`\n\nETH: `0xae89158b43000e07e76b205b870a1e34653d2668`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpassabilities%2Fcrypto-exchange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpassabilities%2Fcrypto-exchange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpassabilities%2Fcrypto-exchange/lists"}