Your gateway to the world of crypto !
This project cannot be considered in any way as trading advice.
Use it at your own risks and be careful with your money ;)
- Provides a unified REST API to various exchanges (can be used to automate trading or build bots)
- Handles authentication so that on client side you can concentrate on what really matters
- Implements rate limiting when forwarding requests to remote exchanges
- Provides a REST API to send push notifications using PushOver
- Provides a basic UI which implements most API calls (see documentation in doc directory)
See a live demo at https://mpe-demo.crazyme.net/ui/
Of course, above demo does not use any valid user/token. This means the following :
- everything related to price & order book is populated with real data
- the list of open/completed orders is filled with random data
- the list of balances is filled with random data
- new orders won't be actually executed ;)
In order to have a full experience, just follow installation steps
Install it wherever you want and start sending requests from your own program
- it can be hosted on a VM in the cloud
- it can be installed at home, on a Raspberry Pi
Just use you favorite language (python, javascript, ruby, bash, ...) to send request to the gateway. Your own service, your own rules !
A Node.js is available here or as a npm package
Currently supports for following exchanges :
- Bittrex (my favorite)
- Binance (nice Chinese exchange with good support)
- Poloniex (worst support ever)
- More to come...
Following API are currently supported :
- Retrieve pairs
- Retrieve tickers
- Retrieve order book
- Retrieve last executed trades
- List open orders
- List closed orders
- Retrieve balances
See documentation in doc directory for an overview of each API
Margin trading is not supported (and is unlikely to be)
Currently supports following services :
- CoinMarket (see documentation in doc directory for an overview of each API)
- PushOver (see documentation in doc directory for an overview of each API)
Rate limiting is implemented when required by exchange thanks to Bottleneck
- Install dependencies
npm install
- Copy sample config
cp config/config.sample.json config/config.json
Check documentation in doc directory for detailed information on each config section
- Start gateway
node gateway.js
- Check which exchanges are enabled
Open http://127.0.0.1:8000/exchanges/ in your browser. You should see JSON content such as below :
["binance","bittrex","poloniex"]
By default, only public API will be enabled. In order to access trading/private API, you need to update config.json with appropriate user and secret provided by exchange (check documentation in doc directory )
- Check BTC & ETH prices on CoinMarketCap
Open http://127.0.0.1:8000/coinmarketcap/tickers?symbols=BTC,ETH in your browser. You should see JSON content such as below :
[
{
"name":"Bitcoin",
"symbol":"BTC",
"rank":1,
"last_updated":1505472872,
"convert_currency":null,
"price_converted":null,
"24h_volume_converted":null,
"market_cap_converted":null,
"price_usd":2991.55,
"price_btc":1,
"24h_volume_usd":3303620000,
"market_cap_usd":49561792636,
"available_supply":16567262,
"total_supply":16567262,
"percent_change_1h":-0.99,
"percent_change_24h":-18.73,
"percent_change_7d":-34.09
},
{
"name":"Ethereum",
"symbol":"ETH",
"rank":2,
"last_updated":1505472866,
"convert_currency":null,
"price_converted":null,
"24h_volume_converted":null,
"market_cap_converted":null,
"price_usd":199.814,
"price_btc":0.0660232,
"24h_volume_usd":1490080000,
"market_cap_usd":18908734638,
"available_supply":94631681,
"total_supply":94631681,
"percent_change_1h":-3.49,
"percent_change_24h":-21.93,
"percent_change_7d":-37.43
}
]
- Place an order to buy 1 NEO at 0.0040BTC on Bittrex (assuming you have enough funds)
Execute the following in a terminal :
curl -X POST 'http://127.0.0.1:8000/exchanges/bittrex/openOrders?pair=BTC-NEO&quantity=1&targetRate=0.0040'
You should see JSON content such as below :
{"orderNumber":"8bc49a59-1056-4c20-90f2-893fff2be279"}
- Cancel above order (assuming order still exists)
Execute the following in a terminal :
curl -X DELETE 'http://127.0.0.1:8000/exchanges/bittrex/openOrders/8bc49a59-1056-4c20-90f2-893fff2be279'
You should see JSON content such as below in case order is valid :
{}
A docker image is available at https://hub.docker.com/r/apendergast/crypto-exchanges-gateway/
- Pull image
docker pull apendergast/crypto-exchanges-gateway
- Run image
docker run --rm -p 8000:8000 --name ceg apendergast/crypto-exchanges-gateway
You should then be able to access service on http://127.0.0.1:8000
- Check which exchanges are enabled
Open http://127.0.0.1:8000/exchanges/ in your browser. You should see JSON content such as below :
["binance","bittrex","poloniex"]
By default, only public API will be enabled. In order to access trading/private API, you need to pass environment when creating container. Following environment variables are available :
- cfg.logLevel : log level
- cfg.auth.apikey : API Key used to protect access
- cfg.ui.enabled : enable/disable UI (value should be set to 1 to enable UI, 0 to disable UI)
- cfg.pushover.user : PushOver user key
- cfg.pushover.token : PushOver token
- cfg.exchanges.poloniex.key : Poloniex user key
- cfg.exchanges.poloniex.secret : Poloniex secret
- cfg.exchanges.bittrex.key : Bittrex user key
- cfg.exchanges.bittrex.secret : Bittrex secret
- cfg.exchanges.binance.key : Binance user key
- cfg.exchanges.binance.secret : Binance secret
Examples :
Run container with Bittrex user/key environment variables
docker run --rm -p 8000:8000 --name ceg -e cfg.exchanges.bittrex.key='abcdefghijkl' -e cfg.exchanges.bittrex.secret='123456789' apendergast/crypto-exchanges-gateway
This project was made possible thanks to following projects :
- express
- body-parser
- lodash
- node-bittrex-api
- binance
- poloniex-api-node
- bottleneck (for rate limiting)
- winston (for logging)
- chump (for PushOver)
- uuid
This project is a work in progress. If you find it useful, you might consider a little donation ;)
BTC: 163Bu8qMSDoHc1sCatcnyZcpm38Z6PWf6E
ETH: 0xDEBBEEB9624449D7f2c87497F21722b1731D42a8
NEO/GAS: AaQ5xJt4v8GunVchTJXur8WtM8ksprnxRZ