@jmparsons/ccxt
Version:
A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges
256 lines (206 loc) • 57.4 kB
Markdown
# CCXT – CryptoCurrency eXchange Trading Library
[](https://travis-ci.org/ccxt/ccxt) [](https://npmjs.com/package/ccxt) [](https://pypi.python.org/pypi/ccxt) [](https://www.npmjs.com/package/ccxt) [](https://nodesecurity.io/orgs/ccxt/projects/856d3088-8b46-4515-9324-6b7cd2470522) [](https://gitter.im/ccxt-dev/ccxt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [](https://opencollective.com/ccxt)
A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.
The **CCXT** library is used to connect and trade with cryptocurrency / altcoin exchanges and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, webshop integration and related software engineering.
It is intended to be used by **coders, developers, technically-skilled traders, data-scientists and financial analysts** for building trading algorithms on top of it.
Current feature list:
- support for many exchange markets, even more upcoming soon
- fully implemented public and private APIs for all exchanges
- all currencies, altcoins and symbols, prices, order books, trades, tickers, etc...
- optional normalized data for cross-exchange or cross-currency analytics and arbitrage
- an out-of-the box unified all-in-one API extremely easy to integrate
- works in Node 7.6+, Python 2 and 3, PHP 5.3+, web browsers
[ccxt on GitHub](https://github.com/ccxt/ccxt) | [Install](#install) | [Usage](#usage) | [Manual](https://github.com/ccxt/ccxt/wiki)| [FAQ](https://github.com/ccxt/ccxt/wiki/FAQ) | [Examples](https://github.com/ccxt/ccxt/tree/master/examples) | [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md) | [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md)
## Supported Cryptocurrency Exchange Markets
The ccxt library currently supports the following 115 cryptocurrency exchange markets and trading APIs:
| | id | name | ver | doc | countries |
|---------------------------------------------------------------------------------------------------------------------------|--------------------|------------------------------------------------------------------------------|:---:|:--------------------------------------------------------------------------------------------:|-----------------------------------------|
| | _1broker | [1Broker](https://1broker.com) | 2 | [API](https://1broker.com/?c=en/content/api-documentation) | US |
| | _1btcxe | [1BTCXE](https://1btcxe.com) | * | [API](https://1btcxe.com/api-docs.php) | Panama |
| | acx | [ACX](https://acx.io) | 2 | [API](https://acx.io/documents/api_v2) | Australia |
| | allcoin | [Allcoin](https://www.allcoin.com) | 1 | [API](https://www.allcoin.com/About/APIReference) | Canada |
| | anxpro | [ANXPro](https://anxpro.com) | 2 | [API](http://docs.anxv2.apiary.io) | Japan, Singapore, Hong Kong, New Zealand|
| | bibox | [Bibox](https://www.bibox.com) | 1 | [API](https://github.com/Biboxcom/api_reference/wiki/home_en) | China, US, South Korea |
| | binance | [Binance](https://www.binance.com) | * | [API](https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md) | Japan |
| | bit2c | [Bit2C](https://www.bit2c.co.il) | * | [API](https://www.bit2c.co.il/home/api) | Israel |
| | bitbank | [bitbank](https://bitbank.cc/) | 1 | [API](https://docs.bitbank.cc/) | Japan |
| | bitbay | [BitBay](https://bitbay.net) | * | [API](https://bitbay.net/public-api) | Poland, EU |
| | bitfinex | [Bitfinex](https://www.bitfinex.com) | 1 | [API](https://bitfinex.readme.io/v1/docs) | British Virgin Islands |
| | bitfinex2 | [Bitfinex v2](https://www.bitfinex.com) | 2 | [API](https://bitfinex.readme.io/v2/docs) | British Virgin Islands |
| | bitflyer | [bitFlyer](https://bitflyer.jp) | 1 | [API](https://bitflyer.jp/API) | Japan |
| | bithumb | [Bithumb](https://www.bithumb.com) | * | [API](https://www.bithumb.com/u1/US127) | South Korea |
| | bitkk | [bitkk](https://www.bitkk.com) | 1 | [API](https://www.bitkk.com/i/developer) | China |
| | bitlish | [Bitlish](https://bitlish.com) | 1 | [API](https://bitlish.com/api) | UK, EU, Russia |
| | bitmarket | [BitMarket](https://www.bitmarket.pl) | * | [API](https://www.bitmarket.net/docs.php?file=api_public.html) | Poland, EU |
| | bitmex | [BitMEX](https://www.bitmex.com) | 1 | [API](https://www.bitmex.com/app/apiOverview) | Seychelles |
| | bitso | [Bitso](https://bitso.com) | 3 | [API](https://bitso.com/api_info) | Mexico |
| | bitstamp | [Bitstamp](https://www.bitstamp.net) | 2 | [API](https://www.bitstamp.net/api) | UK |
| | bitstamp1 | [Bitstamp v1](https://www.bitstamp.net) | 1 | [API](https://www.bitstamp.net/api) | UK |
| | bittrex | [Bittrex](https://bittrex.com) | 1.1 | [API](https://bittrex.com/Home/Api) | US |
| | bitz | [Bit-Z](https://www.bit-z.com) | 1 | [API](https://www.bit-z.com/api.html) | Hong Kong |
| | bl3p | [BL3P](https://bl3p.eu) | 1 | [API](https://github.com/BitonicNL/bl3p-api/tree/master/docs) | Netherlands, EU |
| | bleutrade | [Bleutrade](https://bleutrade.com) | 2 | [API](https://bleutrade.com/help/API) | Brazil |
| | braziliex | [Braziliex](https://braziliex.com/) | * | [API](https://braziliex.com/exchange/api.php) | Brazil |
| | btcbox | [BtcBox](https://www.btcbox.co.jp/) | 1 | [API](https://www.btcbox.co.jp/help/asm) | Japan |
| | btcchina | [BTCChina](https://www.btcchina.com) | 1 | [API](https://www.btcchina.com/apidocs) | China |
| | btcexchange | [BTCExchange](https://www.btcexchange.ph) | * | [API](https://github.com/BTCTrader/broker-api-docs) | Philippines |
| | btcmarkets | [BTC Markets](https://btcmarkets.net/) | * | [API](https://github.com/BTCMarkets/API) | Australia |
| | btctradeim | [BtcTrade.im](https://www.btctrade.im) | * | [API](https://www.btctrade.im/help.api.html) | Hong Kong |
| | btctradeua | [BTC Trade UA](https://btc-trade.com.ua) | * | [API](https://docs.google.com/document/d/1ocYA0yMy_RXd561sfG3qEPZ80kyll36HUxvCRe5GbhE/edit) | Ukraine |
| | btcturk | [BTCTurk](https://www.btcturk.com) | * | [API](https://github.com/BTCTrader/broker-api-docs) | Turkey |
| | btcx | [BTCX](https://btc-x.is) | 1 | [API](https://btc-x.is/custom/api-document.html) | Iceland, US, EU |
| | bxinth | [BX.in.th](https://bx.in.th) | * | [API](https://bx.in.th/info/api) | Thailand |
| | ccex | [C-CEX](https://c-cex.com) | * | [API](https://c-cex.com/?id=api) | Germany, EU |
| | cex | [CEX.IO](https://cex.io) | * | [API](https://cex.io/cex-api) | UK, EU, Cyprus, Russia |
| | chbtc | [CHBTC](https://trade.chbtc.com/api) | 1 | [API](https://www.chbtc.com/i/developer) | China |
| | chilebit | [ChileBit](https://chilebit.net) | 1 | [API](https://blinktrade.com/docs) | Chile |
| | cobinhood | [COBINHOOD](https://cobinhood.com) | * | [API](https://cobinhood.github.io/api-public) | Taiwan |
| | coincheck | [coincheck](https://coincheck.com) | * | [API](https://coincheck.com/documents/exchange/api) | Japan, Indonesia |
| | coinegg | [CoinEgg](https://www.coinegg.com) | * | [API](https://www.coinegg.com/explain.api.html) | China, UK |
| | coinex | [CoinEx](https://www.coinex.com) | 1 | [API](https://github.com/coinexcom/coinex_exchange_api/wiki) | China |
| | coinexchange | [CoinExchange](https://www.coinexchange.io) | * | [API](https://coinexchangeio.github.io/slate/) | India, Japan, South Korea, Vietnam, US |
| | coinfloor | [coinfloor](https://www.coinfloor.co.uk) | * | [API](https://github.com/coinfloor/api) | UK |
| | coingi | [Coingi](https://coingi.com) | * | [API](http://docs.coingi.apiary.io/) | Panama, Bulgaria, China, US |
| | coinmarketcap | [CoinMarketCap](https://coinmarketcap.com) | 1 | [API](https://coinmarketcap.com/api) | US |
| | coinmate | [CoinMate](https://coinmate.io) | * | [API](http://docs.coinmate.apiary.io) | UK, Czech Republic, EU |
| | coinnest | [coinnest](https://www.coinnest.co.kr) | * | [API](https://www.coinnest.co.kr/doc/intro.html) | South Korea |
| | coinone | [CoinOne](https://coinone.co.kr) | 2 | [API](https://doc.coinone.co.kr) | South Korea |
| | coinsecure | [Coinsecure](https://coinsecure.in) | 1 | [API](https://api.coinsecure.in) | India |
| | coinspot | [CoinSpot](https://www.coinspot.com.au) | * | [API](https://www.coinspot.com.au/api) | Australia |
| | cointiger | [CoinTiger](https://www.cointiger.com/exchange/register.html?refCode=FfvDtt) | 1 | [API](https://github.com/cointiger/api-docs-en/wiki) | China |
| | coolcoin | [CoolCoin](https://www.coolcoin.com) | * | [API](https://www.coolcoin.com/help.api.html) | Hong Kong |
| | cryptopia | [Cryptopia](https://www.cryptopia.co.nz/Register?referrer=kroitor) | * | [API](https://www.cryptopia.co.nz/Forum/Category/45) | New Zealand |
| | dsx | [DSX](https://dsx.uk) | 3 | [API](https://api.dsx.uk) | UK |
| | ethfinex | [Ethfinex](https://www.ethfinex.com) | 1 | [API](https://bitfinex.readme.io/v1/docs) | British Virgin Islands |
| | exmo | [EXMO](https://exmo.me/?ref=131685) | 1 | [API](https://exmo.me/en/api_doc?ref=131685) | Spain, Russia |
| | exx | [EXX](https://www.exx.com/) | * | [API](https://www.exx.com/help/restApi) | China |
| | flowbtc | [flowBTC](https://trader.flowbtc.com) | 1 | [API](http://www.flowbtc.com.br/api/) | Brazil |
| | foxbit | [FoxBit](https://foxbit.exchange) | 1 | [API](https://blinktrade.com/docs) | Brazil |
| | fybse | [FYB-SE](https://www.fybse.se) | * | [API](http://docs.fyb.apiary.io) | Sweden |
| | fybsg | [FYB-SG](https://www.fybsg.com) | * | [API](http://docs.fyb.apiary.io) | Singapore |
| | gatecoin | [Gatecoin](https://gatecoin.com) | * | [API](https://gatecoin.com/api) | Hong Kong |
| | gateio | [Gate.io](https://gate.io/) | 2 | [API](https://gate.io/api2) | China |
| | gdax | [GDAX](https://www.gdax.com) | * | [API](https://docs.gdax.com) | US |
| | gemini | [Gemini](https://gemini.com) | 1 | [API](https://docs.gemini.com/rest-api) | US |
| | getbtc | [GetBTC](https://getbtc.org) | * | [API](https://getbtc.org/api-docs.php) | St. Vincent & Grenadines, Russia |
| | hadax | [HADAX](https://www.hadax.com) | 1 | [API](https://github.com/huobiapi/API_Docs/wiki) | China |
| | hitbtc | [HitBTC](https://hitbtc.com) | 1 | [API](https://github.com/hitbtc-com/hitbtc-api/blob/master/APIv1.md) | Hong Kong |
| | hitbtc2 | [HitBTC v2](https://hitbtc.com/?ref_id=5a5d39a65d466) | 2 | [API](https://api.hitbtc.com) | Hong Kong |
| | huobi | [Huobi](https://www.huobi.com) | 3 | [API](https://github.com/huobiapi/API_Docs_en/wiki) | China |
| | huobicny | [Huobi CNY](https://www.huobi.com) | 1 | [API](https://github.com/huobiapi/API_Docs/wiki/REST_api_reference) | China |
| | huobipro | [Huobi Pro](https://www.huobipro.com) | 1 | [API](https://github.com/huobiapi/API_Docs/wiki/REST_api_reference) | China |
| | ice3x | [ICE3X](https://ice3x.com) | * | [API](https://ice3x.co.za/ice-cubed-bitcoin-exchange-api-documentation-1-june-2017) | South Africa |
| | independentreserve | [Independent Reserve](https://www.independentreserve.com) | * | [API](https://www.independentreserve.com/API) | Australia, New Zealand |
| | indodax | [INDODAX](https://www.indodax.com) | 1.7 | [API](https://indodax.com/downloads/BITCOINCOID-API-DOCUMENTATION.pdf) | Indonesia |
| | itbit | [itBit](https://www.itbit.com) | 1 | [API](https://api.itbit.com/docs) | US |
| | jubi | [jubi.com](https://www.jubi.com) | 1 | [API](https://www.jubi.com/help/api.html) | China |
| | kraken | [Kraken](https://www.kraken.com) | 0 | [API](https://www.kraken.com/en-us/help/api) | US |
| | kucoin | [Kucoin](https://www.kucoin.com/?r=E5wkqe) | 1 | [API](https://kucoinapidocs.docs.apiary.io) | Hong Kong |
| | kuna | [Kuna](https://kuna.io) | 2 | [API](https://kuna.io/documents/api) | Ukraine |
| | lakebtc | [LakeBTC](https://www.lakebtc.com) | 2 | [API](https://www.lakebtc.com/s/api_v2) | US |
| | lbank | [LBank](https://www.lbank.info) | 1 | [API](https://www.lbank.info/api/api-overview) | China |
| | liqui | [Liqui](https://liqui.io) | 3 | [API](https://liqui.io/api) | Ukraine |
| | livecoin | [LiveCoin](https://www.livecoin.net) | * | [API](https://www.livecoin.net/api?lang=en) | US, UK, Russia |
| | luno | [luno](https://www.luno.com) | 1 | [API](https://www.luno.com/en/api) | UK, Singapore, South Africa |
| | lykke | [Lykke](https://www.lykke.com) | 1 | [API](https://hft-api.lykke.com/swagger/ui/) | Switzerland |
| | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | 3 | [API](https://www.mercadobitcoin.com.br/api-doc) | Brazil |
| | mixcoins | [MixCoins](https://mixcoins.com) | 1 | [API](https://mixcoins.com/help/api/) | UK, Hong Kong |
| | negociecoins | [NegocieCoins](https://www.negociecoins.com.br) | 3 | [API](https://www.negociecoins.com.br/documentacao-tradeapi) | Brazil |
| | nova | [Novaexchange](https://novaexchange.com) | 2 | [API](https://novaexchange.com/remote/faq) | Tanzania |
| | okcoincny | [OKCoin CNY](https://www.okcoin.cn) | 1 | [API](https://www.okcoin.cn/rest_getStarted.html) | China |
| | okcoinusd | [OKCoin USD](https://www.okcoin.com) | 1 | [API](https://www.okcoin.com/rest_getStarted.html) | China, US |
| | okex | [OKEX](https://www.okex.com) | 1 | [API](https://github.com/okcoin-okex/API-docs-OKEx.com) | China, US |
| | paymium | [Paymium](https://www.paymium.com) | 1 | [API](https://github.com/Paymium/api-documentation) | France, EU |
| | poloniex | [Poloniex](https://poloniex.com) | * | [API](https://poloniex.com/support/api/) | US |
| | qryptos | [QRYPTOS](https://www.qryptos.com) | 2 | [API](https://developers.quoine.com) | China, Taiwan |
| | quadrigacx | [QuadrigaCX](https://www.quadrigacx.com) | 2 | [API](https://www.quadrigacx.com/api_info) | Canada |
| | quoinex | [QUOINEX](https://quoinex.com/) | 2 | [API](https://developers.quoine.com) | Japan, Singapore, Vietnam |
| | southxchange | [SouthXchange](https://www.southxchange.com) | * | [API](https://www.southxchange.com/Home/Api) | Argentina |
| | surbitcoin | [SurBitcoin](https://surbitcoin.com) | 1 | [API](https://blinktrade.com/docs) | Venezuela |
| | therock | [TheRockTrading](https://therocktrading.com) | 1 | [API](https://api.therocktrading.com/doc/v1/index.html) | Malta |
| | tidebit | [TideBit](https://www.tidebit.com) | 2 | [API](https://www.tidebit.com/documents/api_v2) | Hong Kong |
| | tidex | [Tidex](https://tidex.com) | 3 | [API](https://tidex.com/exchange/public-api) | UK |
| | urdubit | [UrduBit](https://urdubit.com) | 1 | [API](https://blinktrade.com/docs) | Pakistan |
| | vaultoro | [Vaultoro](https://www.vaultoro.com) | 1 | [API](https://api.vaultoro.com) | Switzerland |
| | vbtc | [VBTC](https://vbtc.exchange) | 1 | [API](https://blinktrade.com/docs) | Vietnam |
| | virwox | [VirWoX](https://www.virwox.com) | * | [API](https://www.virwox.com/developers.php) | Austria, EU |
| | wex | [WEX](https://wex.nz) | 3 | [API](https://wex.nz/api/3/docs) | New Zealand |
| | xbtce | [xBTCe](https://www.xbtce.com) | 1 | [API](https://www.xbtce.com/tradeapi) | Russia |
| | yobit | [YoBit](https://www.yobit.net) | 3 | [API](https://www.yobit.net/en/api/) | Russia |
| | yunbi | [YUNBI](https://yunbi.com) | 2 | [API](https://yunbi.com/documents/api/guide) | China |
| | zaif | [Zaif](https://zaif.jp) | 1 | [API](http://techbureau-api-document.readthedocs.io/ja/latest/index.html) | Japan |
| | zb | [ZB](https://www.zb.com) | 1 | [API](https://www.zb.com/i/developer) | China |
The list above is updated frequently, new crypto markets, altcoin exchanges, bug fixes, API endpoints are introduced and added on a regular basis. See the [Manual](https://github.com/ccxt/ccxt/wiki) for details. If you don't find a cryptocurrency exchange market in the list above and/or want another exchange to be added, post or send us a link to it by opening an issue here on GitHub or via email.
The library is under [MIT license](https://github.com/ccxt/ccxt/blob/master/LICENSE.txt), that means it's absolutely free for any developer to build commercial and opensource software on top of it, but use it at your own risk with no warranties, as is.
## Install
The easiest way to install the ccxt library is to use builtin package managers:
- [ccxt in **NPM**](http://npmjs.com/package/ccxt) (JavaScript / Node v7.6+)
- [ccxt in **PyPI**](https://pypi.python.org/pypi/ccxt) (Python 2 and 3.5.3+)
- [ccxt in **Packagist/Composer**](https://packagist.org/packages/ccxt/ccxt) (PHP 5.3+)
This library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements:
- [`js/`](https://github.com/ccxt/ccxt/blob/master/js/) in JavaScript
- [`python/`](https://github.com/ccxt/ccxt/blob/master/python/) in Python (generated from JS)
- [`php/`](https://github.com/ccxt/ccxt/blob/master/php/) in PHP (generated from JS)
You can also clone it into your project directory from [ccxt GitHub repository](https://github.com/ccxt/ccxt):
```shell
git clone https://github.com/ccxt/ccxt.git
```
An alternative way of installing this library into your code is to copy a single file manually into your working directory with language extension appropriate for your environment.
### JavaScript (NPM)
JavaScript version of CCXT works both in Node and web browsers. Requires ES6 and `async/await` syntax support (Node 7.6.0+). When compiling with Webpack and Babel, make sure it is [not excluded](https://github.com/ccxt/ccxt/issues/225#issuecomment-331905178) in your `babel-loader` config.
[ccxt in **NPM**](http://npmjs.com/package/ccxt)
```shell
npm install ccxt
```
```JavaScript
var ccxt = require ('ccxt')
console.log (ccxt.exchanges) // print all available exchanges
```
### JavaScript (for use with the `<script>` tag):
[All-in-one browser bundle](https://unpkg.com/ccxt) (dependencies included), served from [unpkg CDN](https://unpkg.com/), which is a fast, global content delivery network for everything on NPM.
```HTML
<script type="text/javascript" src="https://unpkg.com/ccxt"></script>
```
Creates a global `ccxt` object:
```JavaScript
console.log (ccxt.exchanges) // print all available exchanges
```
### Python
[ccxt in **PyPI**](https://pypi.python.org/pypi/ccxt)
```shell
pip install ccxt
```
```Python
import ccxt
print(ccxt.exchanges) # print a list of all available exchange classes
```
The library supports concurrent asynchronous mode with asyncio and async/await in Python 3.5.3+
```Python
import ccxt.async as ccxt # link against the asynchronous version of ccxt
```
### PHP
The ccxt library in PHP: [**`ccxt.php`**](https://raw.githubusercontent.com/ccxt/ccxt/master/ccxt.php)
It requires common PHP modules:
- cURL
- mbstring (using UTF-8 is highly recommended)
- PCRE
- iconv
```PHP
include "ccxt.php";
var_dump (\ccxt\Exchange::$exchanges); // print a list of all available exchange classes
```
## Documentation
Read the [Manual](https://github.com/ccxt/ccxt/wiki) for more details.
## Usage
### Intro
The ccxt library consists of a public part and a private part. Anyone can use the public part out-of-the-box immediately after installation. Public APIs open access to public information from all exchange markets without registering user accounts and without having API keys.
Public APIs include the following:
- market data
- instruments/trading pairs
- price feeds (exchange rates)
- order books
- trade history
- tickers
- OHLC(V) for charting
- other public endpoints
For trading with private APIs you need to obtain API keys from/to exchange markets. It often means registering with exchanges and creating API keys with your account. Most exchanges require personal info or identification.