A Ruby gem for executing arbitrage between the MtGox and Bitstamp bitcoin exchanges.
Explanation of bitcoin arbitrage
Why I open sourced a bitcoin arbitrate bot
I'm also creating a course on creating your own bitcoin arbitrage bot
Donations accepted: 16BMcqf93eEpb2aWgMkJCSQQH85WzrpbdZ
Install it yourself as:
$ gem install rbtc_arbitrage
After installing the gem, simply run rbtc
in the command line.
-
Live: whether you want to actually execute trades. You must have configured your API keys and bitcoin addresses through the following environment variables:
- MTGOX_KEY
- MTGOX_SECRET
- MTGOX_ADDRESS
- BITSTAMP_KEY
- BITSTAMP_SECRET
- BITSTAMP_ADDRESS
- BITSTAMP_CLIENT_ID
-
Cutoff: the minimum profit percentage required to execute a trade. Defaults to %2.00.
-
Volume: The amount of bitcoins to trade per transaction. Defaults to 0.01 (the minimum transaction size).
-
Buyer: The exchange you'd like to buy bitcoins from during arbitrage.
"mtgox"
or"bitstamp"
. Default isbitstamp
-
Seller: The exchange you'd like to sell bitcoins from during arbitrage.
"mtgox"
or"bitstamp"
. Default ismtgox
$ rbtc --live --cutoff 4
$ rbtc --cutoff 0.5
$ rbtc --cutoff 3 --volume 0.05
$ rbtc --seller bitstamp --buyer mtgox
$ rbtc
The output will look like this:
07/08/2013 at 10:41AM
Retrieving market information and balances
Bitstamp: $74.0
MtGox: $76.89
buying 0.01 btc from Bitstamp for $0.74
selling 0.01 btc on MtGox for $0.76
profit: $0.02 (2.77%)
See releases.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Right now there is support for only MtGox and Bitstamp, but adding support for other exchanges is dead simple. First, you'll need to create a new client
in lib/rbtc_arbitrage/clients
. Follow the example from the mtgox client. You'll need to provide custom implementations of the following methods:
validate_env
balance
price
trade
exchange
transfer
Make sure that the methods accept the same arguments and return similar objects. At the same time, make sure you copy the mtgox_cient_spec and change it to test your client.