Title: Automated bitcoin arbitrage Post by: maxme on March 16, 2013, 01:26:18 PM Hi guys,
I wanted to share my code. It's a bitcoin arbitrage watcher and automated trade software. Written in Python: https://github.com/maxme/bitcoin-arbitrage Feedback and pull-requests are welcome ;) Title: Re: Automated bitcoin arbitrage Post by: Fireball on March 16, 2013, 02:25:39 PM If you'd like to add ICBIT support, I will be glad to help.
Title: Re: Automated bitcoin arbitrage Post by: whizter on March 18, 2013, 07:55:38 PM I'm running this in test-mode atm. Is it supposed to do this?
Quote 2013-03-18 20:46:12,680 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.68486008}} 2013-03-18 20:46:12,680 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.321795}} 2013-03-18 20:46:12,700 [INFO] profit: 0.138720 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:46:42,700 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.68486008}} 2013-03-18 20:46:42,700 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.321795}} 2013-03-18 20:46:42,720 [INFO] profit: 0.138720 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:47:15,361 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.68486008}} 2013-03-18 20:47:15,361 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.321795}} 2013-03-18 20:47:15,381 [INFO] profit: 0.138720 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:47:45,381 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.68486008}} 2013-03-18 20:47:45,381 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.321795}} 2013-03-18 20:47:45,401 [INFO] profit: 0.138720 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:48:17,581 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.58486008}} 2013-03-18 20:48:17,581 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:48:17,601 [INFO] profit: 0.138719 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:48:47,601 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.58486008}} 2013-03-18 20:48:47,601 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:48:47,621 [INFO] profit: 0.138719 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:49:19,020 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.58486008}} 2013-03-18 20:49:19,020 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:49:19,040 [INFO] profit: 0.138719 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:49:49,051 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.58486008}} 2013-03-18 20:49:49,051 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:49:49,061 [INFO] profit: 0.138719 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:50:20,631 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.974, 'amount': 2.0}, 'bid': {'price': 36.97115, 'amount': 15.8547}} 2013-03-18 20:50:20,631 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:50:20,651 [INFO] profit: 0.126012 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:50:50,651 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.974, 'amount': 2.0}, 'bid': {'price': 36.97115, 'amount': 15.8547}} 2013-03-18 20:50:50,651 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:50:50,671 [INFO] profit: 0.126012 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:51:22,151 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.974, 'amount': 2.0}, 'bid': {'price': 36.97115, 'amount': 15.8547}} 2013-03-18 20:51:22,151 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:51:22,161 [INFO] profit: 0.126012 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:51:52,161 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.974, 'amount': 2.0}, 'bid': {'price': 36.97115, 'amount': 15.8547}} 2013-03-18 20:51:52,161 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:51:52,171 [INFO] profit: 0.126012 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% 2013-03-18 20:52:23,512 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.974, 'amount': 2.0}, 'bid': {'price': 36.97115, 'amount': 15.8547}} 2013-03-18 20:52:23,512 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.29454495}} 2013-03-18 20:52:23,532 [INFO] profit: 0.126012 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 19, 2013, 11:42:09 AM been getting this non stop all day
Code: 2013-03-19 21:19:57,178 [ERROR] HTTPError, can't update market: MtGoxUSD Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 19, 2013, 01:10:14 PM oops, just realised.
"MtGox API url changed" Redownloaded package from github and boom, back in business! I wonder why they changed it? Title: Re: Automated bitcoin arbitrage Post by: maxme on March 19, 2013, 02:16:51 PM I'm running this in test-mode atm. Is it supposed to do this? Quote 2013-03-18 20:46:12,680 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 36.97115, 'amount': 3.055}, 'bid': {'price': 36.95, 'amount': 7.68486008}} 2013-03-18 20:46:12,680 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'price': 37.05425, 'amount': 5.0}, 'bid': {'price': 37.00004, 'amount': 0.321795}} 2013-03-18 20:46:12,700 [INFO] profit: 0.138720 EUR with volume: 5.000000 BTC -buy at 37.0000 (MtGoxEUR) sell at 37.0000 (BitcoinCentralEUR) ~0.07% Yes, but the verbose mode, is too verbose ;) Title: Re: Automated bitcoin arbitrage Post by: maxme on March 19, 2013, 02:20:03 PM If you'd like to add ICBIT support, I will be glad to help. Do you have an HTTP API to get the market depth (order book) ? Title: Re: Automated bitcoin arbitrage Post by: Cyrus on March 19, 2013, 02:46:13 PM I actually found it on github first and now came here searching for the announcement thread.
Is the current version working? I want to start testing today And also... would like to see btc-e support soon! Great job :). Title: Re: Automated bitcoin arbitrage Post by: Spaceman_Spiff on March 19, 2013, 09:07:44 PM Hi guys, I wanted to share my code. It's a bitcoin arbitrage watcher and automated trade software. Written in Python: https://github.com/maxme/bitcoin-arbitrage Feedback and pull-requests are welcome ;) Aw man, you mean I spent my time building my own arbi-bot (probably a whole lot crappier than yours) for nothing? Care to explain why you are giving this away for free? By facilitating the effort required to start arbitraging, you are diminishing your own profits... (and mine :) ) Title: Re: Automated bitcoin arbitrage Post by: Fireball on March 19, 2013, 09:24:30 PM Aw man, you mean I spent my time building my own arbi-bot (probably a whole lot crappier than yours) for nothing? Care to explain why you are giving this away for free? By facilitating the effort required to start arbitraging, you are diminishing your own profits... (and mine :) ) Good arbitrage helps bitcoin economy and helps decentralize markets (e.g. helps other exchanges grow). Title: Re: Automated bitcoin arbitrage Post by: whizter on March 20, 2013, 08:33:22 AM What exactly do I have to do to make it trade? It just does this all the time but no trades are happening, the same stuff as in my first post above. I'm using the newest version from github.
Quote 2013-03-20 08:27:17,214 [INFO] profit: 0.346785 EUR with volume: 3.428300 BTC - buy at 46.4201 (MtGoxEUR) sell at 46.5000 (BitcoinCentralEUR) ~0.22% 2013-03-20 08:27:47,570 [INFO] profit: 0.346785 EUR with volume: 3.428300 BTC - buy at 46.4201 (MtGoxEUR) sell at 46.5000 (BitcoinCentralEUR) ~0.22% 2013-03-20 08:28:19,206 [INFO] profit: 0.346785 EUR with volume: 3.428300 BTC - buy at 46.4201 (MtGoxEUR) sell at 46.5000 (BitcoinCentralEUR) ~0.22% Of course I set my gox api keys and the bitcoincentral credentials. This is my conf: Quote markets = ["MtGoxEUR", "BitcoinCentralEUR"] observers = ["Logger", "TraderBot", "HistoryDumper"] market_expiration_time = 120 # in seconds: 2 minutes ... Title: Re: Automated bitcoin arbitrage Post by: maxme on March 20, 2013, 08:43:54 AM Of course I set my gox api keys and the bitcoincentral credentials. This is my conf: Quote markets = ["MtGoxEUR", "BitcoinCentralEUR"] observers = ["Logger", "TraderBot", "HistoryDumper"] market_expiration_time = 120 # in seconds: 2 minutes ... I think you're crazy to do that... Did you read the code first ? Are you sure that it will not just steal your coins ? First, in TraderBot.py, you'll see some safeguards, for instance if the expected profit is lower than X and the expected profit percentage is lower than Y then it will not execute transactions. One of these safeguards should block current transaction. But seriously, it's not a "packaged product", it's more a in-development project released for other developers. If you just run it like this, I guarantee you'll lose money. If you really want to run it on real exchanges, then help me to write automated tests. Title: Re: Automated bitcoin arbitrage Post by: Khertan on March 20, 2013, 11:30:07 AM Now i understand why you didn't put the perc_threshold and profit_threshold in the config file :p
Title: Re: Automated bitcoin arbitrage Post by: maxme on March 20, 2013, 12:01:13 PM Now i understand why you didn't put the perc_threshold and profit_threshold in the config file :p Haha ;) I would like people to write their own "TraderBot" class and not use the default. I should rename it to SampleTraderBot. Title: Re: Automated bitcoin arbitrage Post by: Khertan on March 20, 2013, 01:27:50 PM Indeed but we can also write a good default one ... i'm a beginner in arbitrage domain ...
Title: Re: Automated bitcoin arbitrage Post by: Khertan on March 20, 2013, 03:34:49 PM There is something strange :
2013-03-20 16:31:32,985 [INFO] profit: 0.007277 EUR with volume: 0.010000 BTC - buy at 48.0000 (MtGoxEUR) sell at 48.0000 (BitcoinCentralEUR) ~1.52% 1.52 % with bought at 48 and sell at 48 ... due to rounding ? Title: Re: Automated bitcoin arbitrage Post by: maxme on March 20, 2013, 04:04:06 PM Nope, it's not a rounding problem and it's not an issue.
The "buy price" given by the program is the maximum price you should buy BTC at. The "sell price" given by the program is the minimum price you should sell BTC at. Example with this order book: Code: books = { Output will be : Code: volume: 3.0 BTC buy at 48.0 (MtGoxEUR) sell at 48.0 (BitcoinCentralEUR) Note: volume is 3.0 btc, not 4.0 btc (that includes 48.0 price) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 20, 2013, 06:12:43 PM I don't intend this to be a dumb question but I fear it will be...
Does this bot require 2 exchanges for trading to happen? If yes is it possible to do trades with only 1? Title: Re: Automated bitcoin arbitrage Post by: maxme on March 20, 2013, 07:12:53 PM Does this bot require 2 exchanges for trading to happen? If yes is it possible to do trades with only 1? Yes it requires 2 exchanges. Arbitrage means "buy at X on a market and sell at X+y on another market at the same time". http://en.wikipedia.org/wiki/Arbitrage Title: Re: Automated bitcoin arbitrage Post by: Sukrim on March 20, 2013, 07:39:49 PM Well, I could trade on MtGox in BTCUSD and BTCEUR if I know EURUSD (or assume EURUSD as static - compared to BTC that might even be true)...
If there's a plugin for other "real" Forex brokers that might even work quite well! Still it might be enough to do fiat trades in bulk after some time, as the volatility is quite different there. Hence it might be possible to trade two currency pairs on the same "market". Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 20, 2013, 11:54:46 PM Does this bot require 2 exchanges for trading to happen? If yes is it possible to do trades with only 1? Yes it requires 2 exchanges. Arbitrage means "buy at X on a market and sell at X+y on another market at the same time". http://en.wikipedia.org/wiki/Arbitrage I told you it was a stupid question :) Also, I'm getting this A LOT Code: Traceback (most recent call last): what am I doin wrong? Is it possible for this error to come up if the network is congested? Also, It takes about an hour or more for this to come up Title: Re: Automated bitcoin arbitrage Post by: maxme on March 21, 2013, 07:14:36 AM Also, I'm getting this A LOT Code: Traceback (most recent call last): what am I doin wrong? Is it possible for this error to come up if the network is congested? Also, It takes about an hour or more for this to come up You're doing nothing, wrong. That was my bad, update the code. And yes it come from no-responding websites Title: Re: Automated bitcoin arbitrage Post by: Khertan on March 21, 2013, 10:56:18 AM Thx for explanations, i understand it after reading a bit more the code.
Also i was thinking of withdraw btc between exchanges place. Example : buy one btc from bitcoin-central, sell at mtgox, withdraw one btc from bitcoincentral to mtgox 1 btc. Did you think that a bad idea ? It ll be more interesting if we can also transfer fund in euros between market, but that s not possible from api. Title: Re: Automated bitcoin arbitrage Post by: w1R903 on March 22, 2013, 03:48:01 AM Does this bot require 2 exchanges for trading to happen? If yes is it possible to do trades with only 1? Yes it requires 2 exchanges. Arbitrage means "buy at X on a market and sell at X+y on another market at the same time". http://en.wikipedia.org/wiki/Arbitrage No, it certainly doesn't require 2 exchanges. There are thousands of people doing cross-currency arbitrage as we write this. See: http://en.wikipedia.org/wiki/Triangular_arbitrage This can be done in a single exchange. And cross-currency arbitrage is getting quite popular in exchanges with several virtual and fiat currencies, like vircurex and btc-e. A market is not synonymous with "an exchange". Each exchange has multiple markets (usually): USD-BTC, EUR-BTC, LTC-BTC, etc. Title: Re: Automated bitcoin arbitrage Post by: Fireball on March 22, 2013, 09:53:55 AM Does this bot require 2 exchanges for trading to happen? If yes is it possible to do trades with only 1? Yes it requires 2 exchanges. Arbitrage means "buy at X on a market and sell at X+y on another market at the same time". http://en.wikipedia.org/wiki/Arbitrage No, it certainly doesn't require 2 exchanges. There are thousands of people doing cross-currency arbitrage as we write this. See: http://en.wikipedia.org/wiki/Triangular_arbitrage This can be done in a single exchange. And cross-currency arbitrage is getting quite popular in exchanges with several virtual and fiat currencies, like vircurex and btc-e. A market is not synonymous with "an exchange". Each exchange has multiple markets (usually): USD-BTC, EUR-BTC, LTC-BTC, etc. And of course, spot/futures arbitrage (https://bitcointalk.org/index.php?topic=131622.0) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 25, 2013, 11:38:56 AM okay, So I was getting this
Code: Traceback (most recent call last): So I added this to the config.py Code: min_tx_volume = 0 # in BTC But now it does this Code: 2013-03-25 21:36:54,994 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 56.29, 'amount': 10.0}, 'bid': {'price': 56.09712, 'amount': 0.16727}} I make for a good beta tester :P Title: Re: Automated bitcoin arbitrage Post by: Khertan on March 25, 2013, 10:27:51 PM Just to be sure, you use the TraderBotSim or you are ready to lose money and btc ?
;) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 26, 2013, 02:39:08 PM I tried the traderbotsim in an older build and it didn't work. But I works for me in the recent revision.
I've tried using the traderbot and all I get it this Code: 2013-03-27 00:34:53,190 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 62.47, 'amount': 4.0}, 'bid': {'price': 61.9, 'amount': 32.50906816}} Also, I'm okay losing money. If this works out it could mean profit!! I'd definitely owe ya :) Title: Re: Automated bitcoin arbitrage Post by: maxme on March 26, 2013, 06:00:46 PM I tried the traderbotsim in an older build and it didn't work. But I works for me in the recent revision. I've tried using the traderbot and all I get it this Code: 2013-03-27 00:34:53,190 [DEBUG] ticker: MtGoxEUR - {'ask': {'price': 62.47, 'amount': 4.0}, 'bid': {'price': 61.9, 'amount': 32.50906816}} Also, I'm okay losing money. If this works out it could mean profit!! I'd definitely owe ya :) It seems you made your first automated transaction. Code: 2013-03-27 00:35:44,546 [WARNING] Can't automate this trade, last trade occured 43.9949998856 seconds ago The line above is a safeguard, it waits for TraderBot.trade_wait before executing the next trade (this will be removed when websocket order book sync is implemented) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 26, 2013, 06:10:51 PM I'm using the SpecializedTradingBot and it's outputting this...
Code: 2013-03-27 04:01:19,473 [INFO][b] profit: 2.354073 EUR with volume: 1.000000 BTC - buy at 62.7999 (MtGoxEUR) sell at 62.8000 (BitcoinCentralEUR) ~3.75%[/b] What confuses me is ... profit: 2.354073 EUR with volume: 1.000000 BTC - buy at 62.7999 (MtGoxEUR) sell at 62.8000 (BitcoinCentralEUR) ~3.75% Some of those numbers don't add up. Am I missing something? Title: Re: Automated bitcoin arbitrage Post by: maxme on March 26, 2013, 06:37:19 PM I'm using the SpecializedTradingBot and it's outputting this... What confuses me is ... profit: 2.354073 EUR with volume: 1.000000 BTC - buy at 62.7999 (MtGoxEUR) sell at 62.8000 (BitcoinCentralEUR) ~3.75% Some of those numbers don't add up. Am I missing something? See my previous message here https://bitcointalk.org/index.php?topic=153661.msg1647793#msg1647793 But I should change logging messages... Title: Re: Automated bitcoin arbitrage Post by: arsenische on March 26, 2013, 08:19:11 PM DobZombie, great work!
But why did you share the code? I think more competitors => less arbitraging possibilities. Or am I wrong? Title: Re: Automated bitcoin arbitrage Post by: Sukrim on March 26, 2013, 08:36:52 PM More arbitrage --> more volume for trading bots!
Also the "algorithm" behind arbitrage bots is not really a secret at all, it might be better to get people to code up plugins for various APIs than to keep it a guarded secret. Also moving big amounts of money between exchanges is not trivial and not cheap too... Thanks for actually open sourcing and releasing a useful and potentially profitable bot. :) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on March 27, 2013, 01:48:49 PM DobZombie, great work! But why did you share the code? I think more competitors => less arbitraging possibilities. Or am I wrong? lol, I'm not sharing any code! I'm just testing it :P maxme is the genius behind this code :) Title: Re: Automated bitcoin arbitrage Post by: NF414 on March 30, 2013, 12:49:44 PM Thanks for sharing!
Anyone had any real-life profit from this automation yet? Regards, NF414 Title: Re: Automated bitcoin arbitrage Post by: maxme on March 30, 2013, 12:52:58 PM Yes I made some profits. But I had to stop the bot since some markets are sometimes not responding or replying with erroneous data. So I'm currently working at checking exchanges status/responsiveness and verifying trades.
And I need to write more automated tests for this part (like mocking erroneous response, ...) Title: Re: Automated bitcoin arbitrage Post by: NF414 on March 30, 2013, 01:05:34 PM Yes I made some profits. But I had to stop the bot since some markets are sometimes not responding or replying with erroneous data. So I'm currently working at checking exchanges status/responsiveness and verifying trades. And I need to write more automated tests for this part (like mocking erroneous response, ...) If you need help of any kind (not a programmer); please feel free to ask. Regards, NF414 Title: Re: Automated bitcoin arbitrage Post by: hiima on April 02, 2013, 02:32:40 AM Can this be used to arbitrage on the same exchange, ie mtgox USD/BTC-> BTC/EUR->EUR/USD?
Title: Re: Automated bitcoin arbitrage Post by: Caesar V on April 13, 2013, 03:54:00 AM Oh man, this is one of those times I wish I was more tech savy :'(
Title: Re: Automated bitcoin arbitrage Post by: DobZombie on April 13, 2013, 02:08:06 PM When there is a potential trade I keep getting this...
Code: 2013-04-13 01:09:02,568 [DEBUG] ticker: BitcoinCentralEUR - {'ask': {'amount': 0.133669, 'price': 58.0}, 'bid': {'amount': 110.72, 'price': 57.0}} EDIT : Nevermind, I downloaded the latest Commit and it's all good :) Title: Re: Automated bitcoin arbitrage Post by: DobZombie on April 15, 2013, 05:28:42 PM right, the latest commit does this when the arbitrage program wants to trade
Code: 2013-04-16 03:14:44,024 [INFO] Buy @MtGoxEUR 0.000905 BTC and sell @BitcoinCentralEUR I'm stuck finding the error (help) o.0 Title: Re: Automated bitcoin arbitrage Post by: somecdnguy4 on April 30, 2013, 05:23:01 AM Hmm, the bot immediately closes if I include either SpecializedTraderBot or TraderBot, but not if TraderBotSim is included. Also, when trying to include BTC-e, the bot says
Code: "[WARNING] Can't automate this trade, client not available: BTC-e Though, upon viewing the TraderBotSim file code, I notice it doesn't fully include BTC-e support. I'll keep looking into it. Someone earlier asked about inter-market trading. Any plans to support that in later releases? Title: Re: Automated bitcoin arbitrage Post by: maxme on May 02, 2013, 03:06:45 PM The private part of BTC-e API is not implemented _yet_
Title: Re: Automated bitcoin arbitrage Post by: maxme on May 09, 2013, 11:49:19 AM I pushed a new feature: fiat currency mixed trades. Now you can buy on market X with EUR and sell on market Y with USD.
Note: Fiat rates conversion are updated every hour from http://rate-exchange.appspot.com/ Title: Re: Automated bitcoin arbitrage Post by: small502 on May 11, 2013, 06:44:01 PM Is anyone getting an error like this?
Code: Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013, 20:30:21) [MSC v.1600 64 bit (AMD64)] on win32 I did remove my mtgox key but when i run the program the key shows up fine. Title: Re: Automated bitcoin arbitrage Post by: JstnPwll on July 05, 2013, 08:56:05 PM Is there no way to transfer funds between exchanges? Otherwise why would it be beneficial to buy low on one and sell high on the other?
Title: Re: Automated bitcoin arbitrage Post by: maxme on July 06, 2013, 07:10:39 AM You may:
Title: Re: Automated bitcoin arbitrage Post by: JstnPwll on July 06, 2013, 05:17:24 PM Hmm. It seems like the most automatic method would be to code it so that when there's an equilibrium, both accounts trade out some of the currency they have been selling for the currency they've been buying. Like you said, it would cut profits (especially with trade fees), but that might be better than stagnating and missing good trade opportunities.
P.S. Thanks for the code! I'm having fun looking at it. Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 04, 2013, 09:48:16 PM just trying to run
but getting this error, I believed i configured correctly and was using the tradersim to test python3 '/xxx/bitcoin-arbitrage-master/arbitrage/arbitrage.py' Traceback (most recent call last): File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 63, in <module> main() File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 60, in main cli.main() File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 55, in main self.create_arbitrer(args) File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 33, in create_arbitrer self.arbitrer = Arbitrer() File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrer.py", line 17, in __init__ self.init_markets(config.markets) File "/xxx/bitcoin-arbitrage-master/arbitrage/arbitrer.py", line 24, in init_markets exec('import public_markets.' + market_name.lower()) AttributeError: 'list' object has no attribute 'lower' Bitcoin-GA-990XA-UD3:~$ Thanks Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 04, 2013, 09:55:32 PM and this is my config file
# watch the following markets # ["MtGoxEUR", "BitcoinCentralEUR", "IntersangoEUR", "Bitcoin24EUR", # "BitstampEUR", "BtceUSD", "MtGoxUSD", "BitfloorUSD", "BitstampUSD"] markets = ["MtGoxUSD", "BitstampUSD"], #"BitcoinCentralUSD", "Bitcoin24USD" # BitfloorUSD, , "CampBXUSD (closed), "BtceUSD", # observers if any # ["Logger", "TraderBot", "TraderBotSim", "HistoryDumper", "Emailer"] observers = ["TraderBotSim"] market_expiration_time = 120 # in seconds: 2 minutes refresh_rate = 20 #### Trader Bot Config # Access to Private APIs mtgox_key = "blah" mtgox_secret = "blaah" #bitcoincentral_username = "FIXME" #bitcoincentral_password = "FIXME" #bitcoincentral_address = "FIXME" # to deposit btc from markets / wallets bitstamp_username = "blah" bitstamp_password = "blahblah" # SafeGuards max_tx_volume = 1 # in BTC min_tx_volume = 0.1 # in BTC balance_margin = 0.05 # 5% profit_thresh = 1 # in EUR perc_thresh = 3 # in % #### Emailer Observer Config smtp_host = 'mysmtp' smtp_login = 'blahblahblah' smtp_passwd = 'blahblahblah' smtp_from = 'myemail' smtp_to = 'myemal' #### XMPP Observer #xmpp_jid = "FROM@jabber.org" #xmpp_password = "FIXME" #xmpp_to = "TO@jabber.org" Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 05, 2013, 12:03:16 AM if anyone can help with the above
well that would be very kind take care and thank you I just cant see where I am going wrong im on ubuntu 13 Python3 thanks Title: Re: Automated bitcoin arbitrage Post by: maxme on August 05, 2013, 02:06:49 PM markets = ["MtGoxUSD", "BitstampUSD"], Remove the trailing comma in the line above. Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 05, 2013, 02:32:28 PM My goodness me
Thank you very much Wil do it tonight Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 05, 2013, 09:27:12 PM yep all working
just in tradersim mode thanks Ian W Title: Re: Automated bitcoin arbitrage Post by: sidhujag on August 07, 2013, 02:53:43 AM Well, I could trade on MtGox in BTCUSD and BTCEUR if I know EURUSD (or assume EURUSD as static - compared to BTC that might even be true)... U will never make money arbing a forex broker. If u trade against broker u will be banned and id u trade against the bank u will get last looked to death.If there's a plugin for other "real" Forex brokers that might even work quite well! Still it might be enough to do fiat trades in bulk after some time, as the volatility is quite different there. Hence it might be possible to trade two currency pairs on the same "market". Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 07, 2013, 08:42:13 AM Was running quite nicely till this happened
2013-08-07 09:40:03,243 [ERROR] HTTPError, can't update market: BitstampUSD 2013-08-07 09:40:03,244 [WARNING] Market: BitstampUSD order book is expired 2013-08-07 09:40:03,964 [ERROR] HTTPError, can't update market: BitstampUSD 2013-08-07 09:40:03,965 [WARNING] Market: BitstampUSD order book is expired 2013-08-07 09:40:24,738 [ERROR] HTTPError, can't update market: BitstampUSD 2013-08-07 09:40:24,739 [WARNING] Market: BitstampUSD order book is expired 2013-08-07 09:40:25,604 [ERROR] HTTPError, can't update market: BitstampUSD 2013-08-07 09:40:25,605 [WARNING] Market: BitstampUSD order book is expired I was able to login to bitstamp via the website, so did not seen offiline hope you can help thank you Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 09, 2013, 06:48:38 PM Did try using TraderBot
Just crashed when trying to trade with Bitstamp Title: Re: Automated bitcoin arbitrage Post by: Ianwhitbread on August 11, 2013, 06:47:24 AM This was the Error
No Trades were made is it me thats causing the problem or the exchanges Traceback (most recent call last): File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 63, in <module> main() File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 60, in main cli.main() File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 56, in main self.exec_command(args) File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrage.py", line 15, in exec_command self.arbitrer.loop() File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrer.py", line 190, in loop self.tick() File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrer.py", line 181, in tick kmarket2, market2["bids"][0]) File "/home/blah/bitcoin-arbitrage-master/arbitrage/arbitrer.py", line 133, in arbitrage_opportunity perc2, weighted_buyprice, weighted_sellprice) File "/home/blah/bitcoin-arbitrage-master/arbitrage/observers/traderbot.py", line 60, in opportunity self.update_balance() File "/home/blah/bitcoin-arbitrage-master/arbitrage/observers/traderbot.py", line 41, in update_balance self.clients[kclient].get_info() File "/home/blah/bitcoin-arbitrage-master/arbitrage/private_markets/bitstampusd.py", line 68, in get_info response = self._send_request(self.balance_url) File "/home/blah/bitcoin-arbitrage-master/arbitrage/private_markets/bitstampusd.py", line 45, in _send_request response = urllib.request.urlopen(req) File "/usr/lib/python3.3/urllib/request.py", line 160, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.3/urllib/request.py", line 479, in open response = meth(req, response) File "/usr/lib/python3.3/urllib/request.py", line 591, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python3.3/urllib/request.py", line 517, in error return self._call_chain(*args) File "/usr/lib/python3.3/urllib/request.py", line 451, in _call_chain result = func(*args) File "/usr/lib/python3.3/urllib/request.py", line 599, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 522: Origin Connection Time-out Title: Re: Automated bitcoin arbitrage Post by: Financisto on November 20, 2013, 01:49:13 AM Greetings!
Just found this tool out. It's great! Just some suggestions for TODO: * Add Triangular Arbitrage (https://en.wikipedia.org/wiki/Triangular_arbitrage) calculator and automated arbitrage implementation of it: as previously said - "This can be done in a single exchange"; * Add automated arbitrage for altcoins pairs (LTC/BTC; NMC/BTC; PPC/BTC; XPM/BTC etc.); * Add support for exchanges with medium volume and various cryptocoins (such as Vircurex and Cryptsy); Ps.: forget Ripple support... 8) BTW, here goes some codes and other similar ideas in order to get some insights: https://bitcointalk.org/index.php?topic=196313.0 (https://bitcointalk.org/index.php?topic=196313.0) https://bitcointalk.org/index.php?topic=236321.0 (https://bitcointalk.org/index.php?topic=236321.0) https://bitcointalk.org/index.php?topic=263815.0 (https://bitcointalk.org/index.php?topic=263815.0) Keep up the good work bro! Cheers! |