Bitcoin Forum
September 21, 2019, 10:07:34 AM *
News: If you like a topic and you see an orange "bump" link, click it. More info.
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3]  All
  Print  
Author Topic: Automated bitcoin arbitrage  (Read 18751 times)
DobZombie
Hero Member
*****
Offline Offline

Activity: 784
Merit: 501


Former curator of The Bitcoin Museum


View Profile
April 15, 2013, 05:28:42 PM
 #41

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
Traceback (most recent call last):
  File "arbitrage.py", line 214, in <module>
    main()
  File "arbitrage.py", line 198, in main
    arbitrer.loop()
  File "arbitrage.py", line 172, in loop
    self.tick()
  File "arbitrage.py", line 166, in tick
    observer.end_opportunity_finder()
  File "E:\bitcoin-arbitrage-master\src\observers\specializedtraderbot.py", line 34, in end_opportunity_finder
    self.execute_trade(*self.potential_trades[0][1:])
  File "E:\bitcoin-arbitrage-master\src\observers\specializedtraderbot.py", line 94, in execute_trade
    "weighted_buyprice=%f weighted_sellprice=%f" % (weighted_buyprice, weighted_sellprice))
  File "E:\bitcoin-arbitrage-master\src\observers\emailer.py", line 17, in send_email
    smtpObj = smtplib.SMTP(config.smtp_host)
  File "c:\python33\lib\smtplib.py", line 238, in __init__
    (code, msg) = self.connect(host, port)
  File "c:\python33\lib\smtplib.py", line 317, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "c:\python33\lib\smtplib.py", line 288, in _get_socket
    self.source_address)
  File "c:\python33\lib\socket.py", line 417, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11004] getaddrinfo failed

E:\bitcoin-arbitrage-master\src>python arbitrage.py -v
2013-04-16 03:16:21,532 [DEBUG] ticker: MtGoxEUR - {'bid': {'price': 71.11, 'amount': 5.7}, 'ask': {'price': 71.81099, 'amount': 0.01}}
2013-04-16 03:16:21,533 [DEBUG] ticker: BitcoinCentralEUR - {'bid': {'price': 75.0, 'amount': 85.91478223}, 'ask': {'price': 76.0, 'amount
Traceback (most recent call last):
  File "arbitrage.py", line 214, in <module>
    main()
  File "arbitrage.py", line 198, in main
    arbitrer.loop()
  File "arbitrage.py", line 172, in loop
    self.tick()
  File "arbitrage.py", line 166, in tick
    observer.end_opportunity_finder()
  File "E:\bitcoin-arbitrage-master\src\observers\traderbot.py", line 33, in end_opportunity_finder
    self.execute_trade(*self.potential_trades[0][1:])
  File "E:\bitcoin-arbitrage-master\src\observers\traderbot.py", line 86, in execute_trade
    self.clients[kbid].sell(volume)
  File "E:\bitcoin-arbitrage-master\src\private_markets\bitcoincentral.py", line 73, in sell
    response = self.trade(amount, "sell", price)
  File "E:\bitcoin-arbitrage-master\src\private_markets\bitcoincentral.py", line 66, in trade
    response = self._send_request(self.trade_url, params)
  File "E:\bitcoin-arbitrage-master\src\private_markets\bitcoincentral.py", line 53, in _send_request
    response = urllib.request.urlopen(req)
  File "c:\python33\lib\urllib\request.py", line 160, in urlopen
    return opener.open(url, data, timeout)
  File "c:\python33\lib\urllib\request.py", line 471, in open
    req = meth(req)
  File "c:\python33\lib\urllib\request.py", line 1183, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

I'm stuck finding the error (help)

o.0

Tip Me if you Hate Justin Bieber 1DobZomBiE2gngvy6zDFKY5b76yvDbqRra
1569060455
Hero Member
*
Offline Offline

Posts: 1569060455

View Profile Personal Message (Offline)

Ignore
1569060455
Reply with quote  #2

1569060455
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1569060455
Hero Member
*
Offline Offline

Posts: 1569060455

View Profile Personal Message (Offline)

Ignore
1569060455
Reply with quote  #2

1569060455
Report to moderator
1569060455
Hero Member
*
Offline Offline

Posts: 1569060455

View Profile Personal Message (Offline)

Ignore
1569060455
Reply with quote  #2

1569060455
Report to moderator
somecdnguy4
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
April 30, 2013, 05:23:01 AM
 #42

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?
maxme
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile WWW
May 02, 2013, 03:06:45 PM
 #43

The private part of BTC-e API is not implemented _yet_

maxme
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile WWW
May 09, 2013, 11:49:19 AM
 #44

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/
small502
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
May 11, 2013, 06:44:01 PM
 #45

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
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
  File "C:\Users\small502\Desktop\Bitcoin\bitcoin-arbitrage-master\arbitrage\arbitrage.py", line 5, in <module>
    from arbitrer import Arbitrer
  File "C:\Users\small502\Desktop\Bitcoin\bitcoin-arbitrage-master\arbitrage\arbitrer.py", line 5, in <module>
    import config
  File "C:\Users\small502\Desktop\Bitcoin\bitcoin-arbitrage-master\arbitrage\config.py", line 17
    mtgox_key =
                          ^
SyntaxError: invalid token
>>>

I did remove my mtgox key but when i run the program the key shows up fine.
JstnPwll
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 05, 2013, 08:56:05 PM
 #46

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?

Developer, entrepreneur, idea-seeker.
BTC: 14MP75VG3Nf53pSEjowmA9gVPVvEvNpabz
maxme
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile WWW
July 06, 2013, 07:10:39 AM
 #47

You may:
  • withdraw funds from an exchange and deposit to an other exchange (manual and long operation, painful, cuts profits with fees)
  • wait for a counter operation and buy low on the exchange you sold previously
  • use other currencies (ltc for instance)
  • wait for an equilibrium and do a negative operation only to transfer funds from one exchange to another (cuts profits of course)
JstnPwll
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 06, 2013, 05:17:24 PM
 #48

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.

Developer, entrepreneur, idea-seeker.
BTC: 14MP75VG3Nf53pSEjowmA9gVPVvEvNpabz
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 04, 2013, 09:48:16 PM
 #49

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


Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 04, 2013, 09:55:32 PM
 #50

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"
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 05, 2013, 12:03:16 AM
 #51

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


maxme
Newbie
*
Offline Offline

Activity: 48
Merit: 0



View Profile WWW
August 05, 2013, 02:06:49 PM
 #52

markets = ["MtGoxUSD", "BitstampUSD"],

Remove the trailing comma in the line above.
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 05, 2013, 02:32:28 PM
 #53

My goodness me

Thank you very much

Wil do it tonight
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 05, 2013, 09:27:12 PM
 #54

yep all working

just in tradersim mode

thanks

Ian W
sidhujag
Legendary
*
Offline Offline

Activity: 2044
Merit: 1004


View Profile
August 07, 2013, 02:53:43 AM
 #55

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".
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.
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 07, 2013, 08:42:13 AM
 #56

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

Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 09, 2013, 06:48:38 PM
 #57

Did try using TraderBot

Just crashed when trying to trade with Bitstamp
Ianwhitbread
Member
**
Offline Offline

Activity: 101
Merit: 10


View Profile
August 11, 2013, 06:47:24 AM
 #58

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
Financisto
Hero Member
*****
Offline Offline

Activity: 575
Merit: 561

0=m


View Profile WWW
November 20, 2013, 01:49:13 AM
Last edit: November 23, 2013, 08:29:06 AM by Financisto
 #59

Greetings!

Just found this tool out.

It's great!

Just some suggestions for TODO:

* Add 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...  Cool

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=236321.0

https://bitcointalk.org/index.php?topic=263815.0

Keep up the good work bro!

Cheers!

0=m BitcoinTalk's Escrow Providers: Ranking & Blacklist 0=m If you think freedom matters, please help keeping these privacy projects alive (donating some coins): Tor 0=m Tails 0=m Qubes OS 0=m Whonix 0=m ProtonMail 0=m Tutanota 0=m VeraCrypt 0=m PrivacyTools.io m=0
Pages: « 1 2 [3]  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!