{"id":17744398,"url":"https://github.com/jxm262/btc-stats","last_synced_at":"2025-05-08T07:32:08.821Z","repository":{"id":25663325,"uuid":"29098979","full_name":"jxm262/btc-stats","owner":"jxm262","description":"Bitcoin price api to calculate statistics on spot prices across exchanges.","archived":false,"fork":false,"pushed_at":"2017-06-10T19:33:22.000Z","size":28,"stargazers_count":30,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-28T14:07:33.381Z","etag":null,"topics":["bitcoin","exchange","javascript"],"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/jxm262.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-01-11T17:09:28.000Z","updated_at":"2022-10-26T00:47:42.000Z","dependencies_parsed_at":"2022-08-24T06:40:27.607Z","dependency_job_id":null,"html_url":"https://github.com/jxm262/btc-stats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jxm262%2Fbtc-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jxm262%2Fbtc-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jxm262%2Fbtc-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jxm262%2Fbtc-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jxm262","download_url":"https://codeload.github.com/jxm262/btc-stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253021173,"owners_count":21841709,"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":["bitcoin","exchange","javascript"],"created_at":"2024-10-26T06:43:42.776Z","updated_at":"2025-05-08T07:32:08.798Z","avatar_url":"https://github.com/jxm262.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"btc-stats  [![Build Status](https://travis-ci.org/jxm262/btc-stats.svg?branch=master)](https://travis-ci.org/jxm262/btc-stats)  \n=========\nBitcoin price api to calculate statistics on spot prices across exchanges.  Uses the [xchange.js](https://github.com/jxm262/xchange.js) module to retrieve current ticker prices.\n   \nNote!!  This is highly in the Alpha stage.  \n  \nThis project currently supports the following exchanges  \n+ bitfinex\n+ bitstamp\n+ okcoin\n+ btce\n+ bter\n+ hitbtc\n+ ccex\n  \nNote: these are all using btc-usd  \n  \n## Download\n\nThe source is available for download from npm or here on github (master branch)\n\n    npm install btc-stats\n    \nIf preferred, you can specify a range of exchanges by calling the .exchanges() function.  Otherwise, the functions will run across all the exchanges mentioned above.  \n\n```js  \n//example - use only these 3 exchanges\nbtcstats.exchanges([\"bitfinex\", \"bitstamp\", \"okcoin\"]);\n```\n\n\n#### Quick Examples  \n```js  \nvar btcstats = require(\"btc-stats\");\n\n//if this line isn't specified, it runs the avg function across all exchanges, not just these 3\nbtcstats.exchanges([\"bitfinex\", \"bitstamp\", \"okcoin\"]);\n\n//Example print the average price across 3 exchanges (bitfinex, bitstamp, okcoin)\nbtcstats.avg(function(error, resp) {\n\tif (!error) {\n\t\tconsole.log(resp);\n\t}\n});  \n```\n  \n## Documentation\n\n* [`avg`](#avg)\n* [`weightedAvg`](#weightedAvg)\n* [`min`](#min)\n* [`max`](#max)\n* [`minVolume`](#minVolume)\n* [`maxVolume`](#maxVolume)\n* [`minSpread`](#minSpread)\n* [`maxSpread`](#maxSpread)\n* [`exchangeMinSpread`](#exchangeMinSpread)\n* [`exchangeMaxSpread`](#exchangeMaxSpread)\n  \nAll Functions accept a callback argument\n\n* `callback(err, results)` - Called when the process completes, or an error occurs. \n\n\u003ca name=\"avg\" /\u003e\n### avg(callback)\n\nCalculates average midpoint price across exchanges.  Midpoint is defined as mid-price between bid vs ask.  \n\n```js\nbtcstats.avg(function(error, resp) {\n    //response format { price: xxx }\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"weightedAvg\" /\u003e\n### weightedAvg(callback)\n\nCalculates average midpoint price across exchanges, weighted by volume.\n\n```js\nbtcstats.weightedAvg(function(error, resp) {\n    //response format { price: xxx }\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"min\" /\u003e\n### min(callback)\n\nCalculates the exchange with the minimum price.  \n\n```js\nbtcstats.min(function(error, resp) {\n    //response format { price: xxx , exchange: xxx}\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"max\" /\u003e\n### max(callback)\n\nCalculates the exchange with the maximum price.  \n\n```js\nbtcstats.max(function(error, resp) {\n    //response format { price: xxx , exchange: xxx }\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"minVolume\" /\u003e\n### minVolume(callback)\n\nCalculates the exchange with the minimum volume.\n\n```js\nbtcstats.minVolume(function(error, resp) {\n    //response format { volume: xxx , exchange: xxx }\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"maxVolume\" /\u003e\n### maxVolume(callback)\n\nCalculates the exchange with the maximum volume.\n\n```js\nbtcstats.maxVolume(function(error, resp) {\n    //response format { volume: xxx , exchange: xxx }\n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"minSpread\" /\u003e\n### minSpread(callback)\n\nCalculates minimum spread between all exchanges.  Defined as the exchange with the lowest asking price vs the exchange with the highest bidding price.  This result may often be a negative number if 1 exchange has a higher bid vs an exchange with a lower ask (potential arbitrage maybe ?  :)\n\n```js\nbtcstats.minSpread(function(error, resp) {\n    //response format { spread: xxx, bid: xxx, ask: xxx, bidExchange: xxx, askExchange: xxx } \n});\n```\n\n---------------------------------------\n  \n\u003ca name=\"maxSpread\" /\u003e\n### maxSpread(callback)\n\nCalculates maximum spread between all exchanges.  Defined as the exchange with the highest asking price vs the exchange with the lowest bidding price.  \n\n```js\nbtcstats.maxSpread(function(error, resp) {\n    //response format { spread: xxx, bid: xxx, ask: xxx, bidExchange: xxx, askExchange: xxx } \n});\n```\n  \n---------------------------------------\n  \n\u003ca name=\"exchangeMinSpread\" /\u003e\n### exchangeMinSpread(callback)\n\nCalculates the exchange (within the list of exchanges) , with the minimum spread.  Defined as the exchange with the highest asking price vs the lowest bidding price.  \n\n```js\nbtcstats.exchangeMinSpread(function(error, resp) {\n    //response format { spread: xxx, bid: xxx, ask: xxx, bidExchange: xxx, askExchange: xxx } \n});\n```\n\n---------------------------------------  \n       \n\u003ca name=\"exchangeMaxSpread\" /\u003e\n### exchangeMinSpread(callback)\n\nCalculates the exchange (within the list of exchanges) , with the minimum spread.  Defined as the exchange with the highest asking price vs the lowest bidding price.  \n\n```js\nbtcstats.exchangeMinSpread(function(error, resp) {\n    //response format { spread: xxx, bid: xxx, ask: xxx, bidExchange: xxx, askExchange: xxx } \n});\n```\n\n---------------------------------------  \n\n     \nWorking on btc-stats\n====================\n\nTo help work on btc-stats, you'll need to \n- have Node installed.  \n- Then clone the repo  \n- install dependencies  \n\n```\ngit clone https://github.com/jxm262/btc-stats.git\ncd btc-stats\nnpm install\n```\n  \n\n## To run tests (using mocha chai)\n\n```\nnpm test\n```  \n  \n  \nAbout the Project\n=================\nThis project utilizes my earlier project - [xchange.js](https://github.com/jxm262/xchange.js).  Please please feel free to join in and help contribute.  I'm also very open to suggestions or code reviews :)  \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjxm262%2Fbtc-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjxm262%2Fbtc-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjxm262%2Fbtc-stats/lists"}