Looking for arbitrage opportunies with JavaScript library ccxt supporting 70+ exchanges

in steemdev •  7 years ago  (edited)

Arbitrage

These days with so many alt-currencies and so many exchanges there is bound to be potential arbitrage opportunities, however identifying and acting on those opportunities is a monumental task.

To be competitive you have to automate. I've been looking through GitHub to see what code is publicly available when I discovered ccxt. https://github.com/ccxt-dev/ccxt#ccxt--cryptocurrency-exchange-trading-library

A hugely impressive code base that supports 70+ exchanges.

It's written in JavaScript for Node.js but they have transpiled versions for both Python and PHP. Here's a list of the features.

  • 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

OK, that looks great let's play around with it and see what it can do!

You will need to install the latest Node.js https://nodejs.org/en/download/ to run the code.

Download the latest source code from https://github.com/ccxt-dev/ccxt/archive/master.zip and unzip it into the directory you would like to work with.

Next, you will need to install it's requirements. Open up the command line, navigate to the directory you unzipped cctx and run npm install. This will take a few minutes to download the packages cctx relies on.

Notice that their is a script arbitrage-pairs.js in the examples/js/ directory.

From the command line run node examples/js/arbitrage-pairs.js hitbtc2 bittrex poloniex. This will grab all the supported pairs supported by HitBTC Bittrex and Poloniex. Why those 3? Because they support trading STEEM!

Here is the output.

symbolhitbtc2bittrexpoloniex
1ST/BTChitbtc2bittrex
1ST/ETHhitbtc2bittrex
ADX/ETHhitbtc2bittrex
AEON/BTChitbtc2bittrex
AMP/BTChitbtc2bittrexpoloniex
ANT/BTChitbtc2bittrex
ARDR/BTChitbtc2bittrexpoloniex
BCH/BTChitbtc2bittrexpoloniex
BCH/ETHhitbtc2bittrexpoloniex
BCH/USDTbittrexpoloniex
BCN/BTChitbtc2poloniex
BCY/BTCbittrexpoloniex
BLK/BTCbittrexpoloniex
BNT/BTChitbtc2bittrex
BNT/ETHhitbtc2bittrex
BTC/USDTbittrexpoloniex
BTCD/BTCbittrexpoloniex
BTS/BTCbittrexpoloniex
BURST/BTCbittrexpoloniex
CFI/BTChitbtc2bittrex
CFI/ETHhitbtc2bittrex
CLAM/BTCbittrexpoloniex
CVC/BTCbittrexpoloniex
CVC/ETHbittrexpoloniex
DASH/BTChitbtc2bittrexpoloniex
DASH/ETHhitbtc2bittrex
DASH/USDTbittrexpoloniex
DCR/BTCbittrexpoloniex
DCT/BTChitbtc2bittrex
DGB/BTCbittrexpoloniex
DGD/BTChitbtc2bittrex
DOGE/BTChitbtc2bittrexpoloniex
EDG/BTChitbtc2bittrex
EMC/BTChitbtc2bittrex
EMC2/BTCbittrexpoloniex
ETC/BTChitbtc2bittrexpoloniex
ETC/ETHhitbtc2bittrexpoloniex
ETC/USDTbittrexpoloniex
ETH/BTChitbtc2bittrexpoloniex
ETH/USDTbittrexpoloniex
EXP/BTCbittrexpoloniex
FCT/BTCbittrexpoloniex
FLDC/BTCbittrexpoloniex
FLO/BTCbittrexpoloniex
FUN/BTChitbtc2bittrex
FUN/ETHhitbtc2bittrex
GAME/BTChitbtc2bittrexpoloniex
GNO/BTChitbtc2bittrexpoloniex
GNO/ETHhitbtc2bittrexpoloniex
GNT/BTCbittrexpoloniex
GNT/ETHbittrexpoloniex
GRC/BTCbittrexpoloniex
GUP/BTChitbtc2bittrex
LBC/BTCbittrexpoloniex
LSK/BTChitbtc2bittrexpoloniex
LTC/BTChitbtc2bittrexpoloniex
LTC/USDTbittrexpoloniex
LUN/BTChitbtc2bittrex
MAID/BTChitbtc2bittrexpoloniex
NAV/BTCbittrexpoloniex
NEOS/BTCbittrexpoloniex
NXC/BTChitbtc2bittrexpoloniex
NXT/BTChitbtc2bittrexpoloniex
OMG/BTCbittrexpoloniex
OMG/ETHhitbtc2bittrexpoloniex
OMNI/BTCbittrexpoloniex
PAY/ETHhitbtc2bittrex
PINK/BTCbittrexpoloniex
POT/BTCbittrexpoloniex
PPC/BTChitbtc2bittrexpoloniex
PTOY/BTChitbtc2bittrex
PTOY/ETHhitbtc2bittrex
QTUM/ETHhitbtc2bittrex
RADS/BTCbittrexpoloniex
REP/BTChitbtc2bittrexpoloniex
REP/ETHbittrexpoloniex
RLC/BTChitbtc2bittrex
SBD/BTChitbtc2bittrexpoloniex
SC/BTChitbtc2bittrexpoloniex
SNGLS/BTChitbtc2bittrex
SNT/ETHhitbtc2bittrex
STEEM/BTChitbtc2bittrexpoloniex
STRAT/BTChitbtc2bittrexpoloniex
SWT/BTChitbtc2bittrex
SYS/BTCbittrexpoloniex
TIME/BTChitbtc2bittrex
TIME/ETHhitbtc2bittrex
TKN/BTChitbtc2bittrex
TRST/BTChitbtc2bittrex
VIA/BTCbittrexpoloniex
VRC/BTCbittrexpoloniex
VTC/BTCbittrexpoloniex
WAVES/BTChitbtc2bittrex
WINGS/BTChitbtc2bittrex
XAUR/BTChitbtc2bittrex
XCP/BTCbittrexpoloniex
XDN/BTChitbtc2bittrex
XEM/BTChitbtc2bittrexpoloniex
XMR/BTChitbtc2bittrexpoloniex
XMR/ETHhitbtc2bittrex
XMR/USDTbittrexpoloniex
XRP/BTChitbtc2bittrexpoloniex
XRP/USDTbittrexpoloniex
XVC/BTCbittrexpoloniex
ZEC/BTChitbtc2bittrexpoloniex
ZEC/ETHhitbtc2bittrexpoloniex
ZEC/USDTbittrexpoloniex
ZRX/BTChitbtc2poloniex
ZRX/ETHhitbtc2poloniex

As you can see cctx quickly grabbed a list of all the trading pairs supported by HitBTC, Bittrex and Poloniex.

Unfortunately cctx does not have an example to compare the prices. But looking at how well cctx is made I should be able to write an example to compare prices fair easily.

In the next post I will write a simple script to compare prices and find those profitable arbitrage opportunities.

Remember to up vote and follow so you don't miss out.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Intriguing post - thanks @codewithcheese .

That's a great information.. Cheers

EtherDelta is a Goldmine, insane arbitrage opportunity https://steemit.com/gifto/@fifelue/tips-be-a-millionaire-using-arbitrage

@jabez518 very informative article.

@codewithcheese got you a $1.37 @minnowbooster upgoat, nice!
@codewithcheese got you a $1.37 @minnowbooster upgoat, nice! (Image: pixabay.com)


Want a boost? Click here to read more!

@codewithcheese got you a $4.11 @minnowbooster upgoat, nice!
@codewithcheese got you a $4.11 @minnowbooster upgoat, nice! (Image: pixabay.com)


Want a boost? Click here to read more!

Congratulations @codewithcheese! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @codewithcheese! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Great idea! Any plans to update this with a follow up post and walkthrough, @codewithcheese ?

Excellent!