Bitcoin Forum
April 24, 2024, 04:25:18 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Python Arbitrage trader for various Exchanges  (Read 11464 times)
JohnDorien (OP)
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
July 28, 2013, 11:25:04 AM
 #1

I wrote an arbitrage trader in Python and want to share it with the community:

https://mega.co.nz/#!X0ZkwRJa!bxdS2Ch2NvXdPDACTsUbYkrlZbN_R9v51OZWkyEj8ms

It does compare the prices sell / buy for various Altcoins on the exchanges: Coins-E, BTC-e, Vircurex and Cryptsy.
It executes the Sell / buy trades as arbitrage of given percentage is found.

Usage:
Edit the config.py with your Keypairs for every exchange
Edit the value "amount" if you like to
Have at least the amount of altcoins you set in the config in your available funds of each exchange. BTC fund has to be highest price altcoin * amount

Run arbitrage_trader.py

It is not totally completed yet, what i will further implement:
 - Error handling on connection errors
 - Percentage of available funds to be traded instead of fixed value
 - Maybe easier edit possibility for more / less coins


If you like this please donate to help my development!
BTC: 1JxT7dgLxbdHR9iBpu7v4z4ph3kjD5pjA9
LTC: LQ32aPGFGwFb7MxvLTai2ePwRFRbnSKpWv


If you encounter any bugs or wish to have more exchanges, or have any other feature request, tell me

Please remember, there is absolutely no guarantee there is any arbitrage at all! I am not responsible for any loss, especially when you modify the code yourself!
1713932718
Hero Member
*
Offline Offline

Posts: 1713932718

View Profile Personal Message (Offline)

Ignore
1713932718
Reply with quote  #2

1713932718
Report to moderator
1713932718
Hero Member
*
Offline Offline

Posts: 1713932718

View Profile Personal Message (Offline)

Ignore
1713932718
Reply with quote  #2

1713932718
Report to moderator
1713932718
Hero Member
*
Offline Offline

Posts: 1713932718

View Profile Personal Message (Offline)

Ignore
1713932718
Reply with quote  #2

1713932718
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, but full nodes are more resource-heavy, and they must do a lengthy initial syncing process. As a result, lightweight clients with somewhat less security are commonly used.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713932718
Hero Member
*
Offline Offline

Posts: 1713932718

View Profile Personal Message (Offline)

Ignore
1713932718
Reply with quote  #2

1713932718
Report to moderator
mercSuey
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250


View Profile
July 28, 2013, 11:59:03 AM
 #2

Have you used your own trader?  How about some results? 
JohnDorien (OP)
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
July 28, 2013, 12:01:33 PM
 #3

Have you used your own trader?  How about some results? 

Yep ofc I use it. Last 3 days a total win of ~0.5 BTC (Low trading volumes for me as i do not have that much funds)
bybitcoin
Hero Member
*****
Offline Offline

Activity: 672
Merit: 500



View Profile
August 21, 2013, 05:08:46 PM
 #4

I've had the impression that arbitrage is only possible among a triangle (or square....) of pairs shaping a cycle, for example BTC/LTC, LTC/XPM, XPM/BTC, or for a pair existing in two different markets (like BTC/$ in MtGox and BitStamp).
But I see that in cryptsy almost all alts are traded against BTC which makes me confused about how your trader is supposed to make any arbitrage trade there. Could you explain this?
alexxy
Sr. Member
****
Offline Offline

Activity: 363
Merit: 250


View Profile
August 21, 2013, 05:44:33 PM
 #5

Can you put all your files to github?

also
Code:
$ python2 arbitrage_trader.py 
Traceback (most recent call last):
  File "arbitrage_trader.py", line 13, in <module>
    from vircurex import *
ImportError: No module named vircurex
6raygp
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
September 08, 2013, 11:23:42 PM
 #6

has anyone tried this? has there been any updates? Very curious.
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 12:32:51 AM
 #7

Checking this out now - I've pushed a copy to Github for collaboration here:

https://github.com/PeanutPower/CryptoArbitrageTrader

(will transfer ownership of repo to John if he so desires)
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 01:00:54 AM
Last edit: September 09, 2013, 01:38:46 AM by ltcgaming
 #8

Code:
>python arbitrage_trader.py

Starting Arbitrage checking for Currency ltc
Unhandled exception in thread started by <function run1 at 0x0000000002CFA0B8>
Traceback (most recent call last):
  File "arbitrage_trader.py", line 180, in run1
    compare() #die Hauptfunktion der Arbitrage
  File "arbitrage_trader.py", line 147, in compare
    if round((int(bprice) * Diff * FEE),8) < round((int(sprice) * FEE),8):
ValueError: invalid literal for int() with base 10: 'Market buy price get error'
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 01:28:40 AM
 #9

getS returning "price get error" for cryptsy LTC

... https://github.com/salfter/PyCryptsy

and when I try BTC-e on it's own:

Code:
Starting Arbitrage checking for Currency ltc
Unhandled exception in thread started by <function run1 at 0x0000000002C78828>
Traceback (most recent call last):
  File "arbitrage_trader.py", line 180, in run1
    compare() #die Hauptfunktion der Arbitrage
  File "arbitrage_trader.py", line 147, in compare
    if round((int(bprice) * Diff * FEE),8) < round((int(sprice) * FEE),8):
UnboundLocalError: local variable 'bprice' referenced before assignment
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 02:12:26 AM
Last edit: September 09, 2013, 02:23:10 AM by ltcgaming
 #10

OK i've debugged this a bit locally and the price checking stuff seems to be working for me on all exchanges EXCEPT Cryptsy and Crypto-Trade

Code:
Starting Arbitrage checking for ltc/btc
Sell price = 0.02198008 on vircu
Buy price = 0.02244443 on vircu
Sell price = 0.02199008 on vircu
Buy price = 0.02236 on btc-e
Sell price = 0.02199008 on vircu
Buy price = 0.02244443 on coins-e
Sell price = 0.02225 on btc-e
Buy price = 0.02244443 on vircu
Sell price = 0.02225 on btc-e
Buy price = 0.02236 on btc-e
Sell price = 0.02225 on btc-e
Buy price = 0.02236 on coins-e
Sell price = 0.02225 on coins-e
Buy price = 0.02236 on vircu
Sell price = 0.02199008 on coins-e
Buy price = 0.02236 on btc-e
Sell price = 0.02225 on coins-e
Buy price = 0.02236 on coins-e
Starting Arbitrage checking for nmc/btc
Sell price = 0.00468115 on vircu
Buy price = 0.00487995 on vircu
Sell price = 0.00468116 on vircu
Buy price = 0.00478 on btc-e
Sell price = 0.00468116 on vircu
Buy price = 0.00487995 on coins-e
Sell price = 0.00477 on btc-e
Buy price = 0.00487995 on vircu
Sell price = 0.00477 on btc-e
Buy price = 0.00478 on btc-e
Sell price = 0.00477 on btc-e
Buy price = 0.00478 on coins-e
Sell price = 0.00477 on coins-e
Buy price = 0.00478 on vircu
Sell price = 0.00469116 on coins-e
Buy price = 0.00478 on btc-e
Sell price = 0.00477 on coins-e
Buy price = 0.00478 on coins-e
Round completed sleeping for 15 seconds
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 02:23:51 AM
 #11

How do you get it setup and running with the right APIs for your account?

edit config.py

note i've just checked in an updated config.py that excludes the two exchanges that aren't working from the default configuration

https://github.com/PeanutPower/CryptoArbitrageTrader/commit/67435e4504c336bdbb2206cc78289bfaf85b6a8a
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 03:04:57 AM
 #12

ok i know why crypto-trade is broken .... cos crypto.py is using POST requests to

https://crypto-trade.com/api/1/depth/ltc_btc

which crypto-trade now reject unless it is an unauthenticated GET request...

so the underlying code from matuszed/crypto needs to be fixed to get crypto-trade to work

p.s. no trading opportunities have come up for me so far Sad
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 04:36:01 AM
 #13

I think I've fixed up the crypto-trade code

https://github.com/PeanutPower/CryptoArbitrageTrader
ltcgaming
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
September 09, 2013, 05:01:36 AM
 #14

I've had the impression that arbitrage is only possible among a triangle (or square....) of pairs shaping a cycle, for example BTC/LTC, LTC/XPM, XPM/BTC, or for a pair existing in two different markets (like BTC/$ in MtGox and BitStamp).
But I see that in cryptsy almost all alts are traded against BTC which makes me confused about how your trader is supposed to make any arbitrage trade there. Could you explain this?

not really ... it's possible that LTCBTC on one exchange, LTC is being bought higher than it is being sold on another exchange, just that these opportunities rarely occur
daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
September 09, 2013, 11:51:43 AM
 #15

It happens quite often. Problem is, to get the money back to the other exchange. Might work best via fiat, if you know a good payment service (I do not... Sad )...

Financisto
Hero Member
*****
Offline Offline

Activity: 630
Merit: 767

BTC⇆⚡⇄BTC


View Profile WWW
November 20, 2013, 04:35:14 AM
 #16

Greetings!

Is this still alive and kicking?

It's been a while since BTC-e, Vircurex and Cryptsy added some more altcoins.

BTW, is it possible to add automated (triangular and 2-currency) arbitrage for altcoins pairs (LTC/BTC; NMC/BTC; PPC/BTC; XPM/BTC etc.)?

Keep up the good work!

BitcoinTalk's ESCROW Providers: Ranking & BlacklistCompilation of (open-source) BRAINWALLET projectsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
eureka
Sr. Member
****
Offline Offline

Activity: 301
Merit: 250


网络·自由·客


View Profile WWW
November 20, 2013, 07:02:11 AM
 #17

May be all of you will interest the coin trade platform here.
The screenshot is out:
http://eeurl.com/cointrade

dac.xyz 
对数字货币深度思考:http://8btc.com/thread-109365-1-1.html
Financisto
Hero Member
*****
Offline Offline

Activity: 630
Merit: 767

BTC⇆⚡⇄BTC


View Profile WWW
November 21, 2013, 01:15:28 AM
 #18

May be all of you will interest the coin trade platform here.
The screenshot is out:
http://eeurl.com/cointrade

Your platform is very nice!

Do you have any plans to offer an english version of it?

Does it calculate and monitor arbitrage opportunities at one or more exchanges?

Success with your software!

BitcoinTalk's ESCROW Providers: Ranking & BlacklistCompilation of (open-source) BRAINWALLET projectsBTC ⇆⚡⇄ BTCBTC aka BTC: 16MBvhaJoRBxW3Vk6apnvz3UYT9HAgraVS ⚡ PGP: 2680207AA9A1B69FE7A033D80DE0F221074384C4 ⚡ If you think freedom matters, please support the development of these privacy projects→DONATE some sats: TailsQubes OSWhonixVeraCryptPicocryptKryptorSimpleX Chat
becva
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
December 02, 2013, 10:34:40 PM
 #19

Hi there
Has anyone been using JohnDorien's arbitrage trader? I've been trying to run & it finds some great opportunities, however at the point of buy/sell it errors. This is what I have been seeing - can anyone help me understand why?

Unhandled exception in thread started by <function run1 at 0x0000000002CFF518>
Traceback (most recent call last):
  File "C:\Program Files\CryptoArbitrageTrader-master\arbitrage_trader.py", line 193, in run1
    compare() #The main Arbitrage function
  File "C:\Program Files\CryptoArbitrageTrader-master\arbitrage_trader.py", line 161, in compare
    make_trade(exc[m], "buy", amount1, pairpart1, "btc", bprice)
  File "C:\Program Files\CryptoArbitrageTrader-master\arbitrage_trader.py", line 123, in make_trade
    authenticated_request('market/%s/' % (pairpart1+'_'+pairpart2),"neworder",{'order_type':'buy', 'rate':rate, 'quantity':amount,})
  File "C:\Program Files\CryptoArbitrageTrader-master\coinse_api.py", line 41, in authenticated_request
    f = open('coins-e_nonce', 'w')
IOError: [Errno 13] Permission denied: 'coins-e_nonce'


Thanks!
Becva
PeanutPower
Member
**
Offline Offline

Activity: 89
Merit: 10



View Profile
December 03, 2013, 07:29:14 AM
 #20

looks like the coins-e "plugin" / interface is broke
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!