butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 11, 2015, 05:43:58 PM Last edit: February 05, 2016, 04:22:43 AM by butor |
|
Hi guys, I just released the C++ code of my Bitcoin exchange arbitrage system that generates a ~2% monthly return with a USD 2,000 exposure. I think you guys might be interested in seeing how arbitrage can work with Bitcoin exchanges. The full code is on the following GitHub page: https://github.com/butor/blackbird. I tried to write a pretty complete Readme file that explains the arbitrage mechanism. It is also a good way to see how you can connect a C++ system to two Bitcoin exchanges ( Bitfinex and OKCoin) using JSON and base64 encoding. Please let me know what you think. I will try to find C++ contributors that will be able to improve the code and connect to new exchanges. I hope it can help you understand and actually test how arbitrage between Bitcoin exchanges works. Here is a quick real life example where arbitrage can occur because of market inefficiency between Bitfinex and Bitstamp in November 2014 (between the two vertical gray lines):
|
|
|
|
DeboraMeeks
|
|
March 11, 2015, 05:47:03 PM |
|
Don't know much about C++ language, but all I can say is, I might try this out with a few bucks. You said 2% return with USD 2k exposure, so can't I try this out with some less amounts just to check out, only want to make a check with some play money (I mean what I can afford to lose).
|
|
|
|
Amph
Legendary
Offline
Activity: 3248
Merit: 1070
|
|
March 11, 2015, 06:15:43 PM |
|
with other exchanges, the 2% can be raised or this is the best the bot can do?
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 11, 2015, 06:36:34 PM |
|
For the moment the system can only connect to Bitfinex and OKCoin. The project is really work in progress but I think it's a good practical example to understand how arbitrage works. I'm currently looking for C++ developers to help me out with the project. I will also improve the documentation on how to test it "out of the box". Currently to use it you need to understand and edit a little bit the source code (work in progress I told you ) If you do want to test it, yes please try with a low amount of cash. I did all my testing with a $10.00 exposure. So please only put a low amount of money on your Bitfinex and OKCoin trading accounts. My monthly returns are surprisingly constant: between 1.7% and 2.3%. Of course I cannot guarantee these returns under any circumstances. My average activity so far is 8 trades per month with the system running 24/7. I'm pretty confident the system would be able to generate better returns with new exchange connections, specially to Bitcoin exchanges that allow short selling. The system is able to test all the possible long/short combinations for a given set of exchanges. So more exchanges really means more arbitrage opportunities.
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 12, 2015, 02:28:47 PM |
|
Indeed. That's what I'm looking for, specially with exchanges that offer short selling. As I said earlier the software tests all the possible long/short combinations between the given exchanges. The current situation is this one, with an exchange A ( Bitfinex) that offers short selling and an exchange B ( OKCoin) that doesn't offer short selling: - A short selling OK
- B short selling NOK
In this case we only have one combination to test: Now let's add a new exchange C that doesn't allow short selling. We now have: - A short selling OK
- B short selling NOK
- C short selling NOK
And the software will automatically test the two following combinations: - short A / long B
- short A / long C
But now let's suppose C actually offers short selling: - A short selling OK
- B short selling NOK
- C short selling OK
In this case we will automatically test four combinations: - short A / long B
- short A / long C
- short C / long A
- short C / long B
However, the selected Bitcoin exchanges have to offer good liquidity to make sure our orders will be executed quickly. I'm currently working on a mechanism that will adapt the limit orders sent based on the real-time bid/ask offers. If you guys know a C++ developer that would be interested in participating in a nice arbitrage project then 100% of the code is on the GitHub page ( https://github.com/butor/blackbird).
|
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 12, 2015, 03:26:35 PM Last edit: March 12, 2015, 07:32:07 PM by butor |
|
I do not know a C++ coder but Im looking to hire a meteor eveloper to make an arbitrage trading tool developer for bitcoinpricelab[dot].com Check out that website, I have a simple overview of markets. Im looking to get a much advanced version which helps traders
Thank you for the link. I noticed that you do your arbitrage by buying bitcoin on an exchange and selling bitcoin on another exchange. You don't use short selling and this is a fondamental difference: on my side my system is completely market-neutral. This means that it's not impacted by the Bitcoin price fluctuation at all. And this is a huge advantage. Here is how it works, current Bitcoin quotes in blue: OKCoin BTC@$300.00Bitfinex BTC@$300.00No opportunity, system 100% cash, no market risk: - On OKCoin: 1000.00 USD, 0.0000 BTC
- On Bitfinex: 1000.00 USD, 0.0000 BTC
OKCoin BTC@$290.00Bitfinex BTC@$310.00Opportunity ($20.00 spread): system 0% cash, but still no market risk since long/short - On OKCoin: 0.00 USD, 3.4483 BTC (buy for $1000.00)
- On Bitfinex: 0.00 USD, -3.2258 BTC (short sell with $1000.00)
Now the Bitcoin market plummets. The $20.00 spread is still here. OKCoin BTC@$180.00Bitfinex BTC@$200.00There is still a spread. No action taken - On OKCoin: 0.00 USD, 3.4483 BTC (long)
- On Bitfinex: 0.00 USD, -3.2258 BTC (short)
Now the spread closes: OKCoin BTC@$200.00Bitfinex BTC@$200.00Exit opportunity: we close the long and short positions and we get: - On OKCoin: 689.66 USD, 0.0000 BTC
- On Bitfinex: 1354.84 USD, 0.0000 BTC
Before the opportunity we had $2000.00 in cash and now we have $2044.50. So even thought during the trade the market lost 33%, we made a 2.2% profit (trading fees not considered). As you can see being market-neutral is a huge advantage when the market is bearish.
|
|
|
|
tomii
Newbie
Offline
Activity: 19
Merit: 0
|
|
March 12, 2015, 09:25:34 PM Last edit: March 12, 2015, 09:42:16 PM by tomii |
|
hello! sounds really nice i like it! i wanna test it but im not that confident with programmin i have a debian Server, but never compiled somethin myself do i have to config in source code? if yes where? and which libarys are needed to make? e: ok i got it... not that hard.. but adding other exchanges i would need help
|
|
|
|
funtotry
Sr. Member
Offline
Activity: 420
Merit: 250
Ever wanted to run your own casino? PM me for info
|
|
March 12, 2015, 09:31:15 PM |
|
Interesting script but how would the funds be transferred between exchanges? Your script can't possibly automated bitcoin transactions and send it, including checking for deposit addresses and that. How does that work?
|
|
|
|
Jamacn
|
|
March 13, 2015, 01:51:56 AM |
|
only 2 exchanges, if is it can be kade best profits?
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 13, 2015, 02:12:57 AM |
|
hello! sounds really nice i like it! i wanna test it but im not that confident with programmin i have a debian Server, but never compiled somethin myself do i have to config in source code? if yes where? and which libarys are needed to make?
Yes the project is not very user-friendly for the moment and I apologize for that. But please read the section How to test Blackbird to see how you can compile it. Once you succeed to start it everything else will be automatic. Good luck
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 13, 2015, 02:45:49 AM Last edit: March 13, 2015, 03:09:09 AM by butor |
|
Interesting script but how would the funds be transferred between exchanges? Your script can't possibly automated bitcoin transactions and send it, including checking for deposit addresses and that. How does that work?
That's the best part! There is absolutely no transfer between the exchanges. Please read the example I gave earlier with the $20 spread. You will see that there is no transfer in cash or in Bitcoin between the exchanges at any time. I hope my example is clear enough to understand the arbitrage mechanism. That being said, a cash rebalancing might need to be done when two specific conditions are met: - the market is either only bullish (up) or only bearish (down), and
- the arbitrage opportunity is always the same over and over (e.g. short Bitfinex / long OKCoin)
In this case we can have after a while a situation where the available cash is not well balanced, e.g: - On OKCoin: 436.11 USD, 0.0000 BTC
- On Bitfinex: 1829.08 USD, 0.0000 BTC
The above example can occur when the market is bearish and we are always long on OKCoin (so we systematically lose money because of the bear market) and short on Bitfinex (so we systematically make money because of the bear market). Note that in this example the system will enter the next arbitrage opportunity with the lowest amount of cash: $436.11. So the total exposure for that new trade will be only 2 * $436.11 = $872.22 even though the total amount of available cash is $436.11 + $1829.08 = $2265.19. Therefore it would be a good idea to rebalance the cash between the exchanges to have: - On OKCoin: 1132.59 USD, 0.0000 BTC
- On Bitfinex: 1132.60 USD, 0.0000 BTC
|
|
|
|
Gebbit
Newbie
Offline
Activity: 56
Merit: 0
|
|
March 13, 2015, 12:26:36 PM |
|
Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.
It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.
Please explain to me where my logic falters.
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 13, 2015, 03:15:19 PM Last edit: March 13, 2015, 04:41:38 PM by butor |
|
Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.
It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.
Please explain to me where my logic falters.
The profit is always on the fiat side. See the simple example I wrote earlier. As I said, the biggest advantage of arbitrage is the independence of the market direction. The goal is to generate a constant profit regardless of the market direction. So yes you will miss opportunities from a bull market but your investment will be safe during a bear market. It's a choice. The largest risk is if the spread between two exchanges never closes for some reasons or if an exchange goes bankrupt like Mt. Gox. If you are interested, here is a good Wall Street example where the spreads didn't close as expected during arbitrage investments: Long-Term Capital Management L.P.
|
|
|
|
area
|
|
March 14, 2015, 05:35:18 PM |
|
I suppose the obvious question to ask here is why make it public, if it's making you money?
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 14, 2015, 08:10:25 PM |
|
I suppose the obvious question to ask here is why make it public, if it's making you money?
For the moment I get a 2% monthly profit for a USD 2,000 exposure. It means that I make about USD 40 per month... Nothing too crazy and I don't know how long it will last. If I want to invest more money I will need to develop a mechanism to check that there is enough liquidity for my limit orders to be executed before they are sent. I am working on a mechanism that reads the order books of the two involved exchanges. If and only if there is enough liquidity on both exchanges then the trades are generated. But more that than I like the challenge of building automatic systems. I like to see my system live, sending orders automatically. But I want to improve it (new exchange connections, order books analysis, failover, etc) and I'm not a professional C++ developer. My goal is to find C++ guys that would be interested in contributing. Also, the system is pretty fast and securely connected to Bitcoin exchanges using C++ libraries and in the future I hope to make it a good example for the open source community (not really the case right now... ).
|
|
|
|
Gebbit
Newbie
Offline
Activity: 56
Merit: 0
|
|
March 16, 2015, 03:37:43 PM |
|
Is that 2% on the fiat or BTC side? If Bitcoin doesn't die it seems hard to believe that bitcoin returns from HLODing won't exceed the returns of this program. The arbitrage would have to make returns on the current bitcoin price and exceed the fact that the funds are not always in BTC. Finally, it would have to account for situations where users get goxxed.
It's hard to believe that this isn't a waste of time and a losing proposition when compared to simply HLODing.
Please explain to me where my logic falters.
The profit is always on the fiat side. See the simple example I wrote earlier. As I said, the biggest advantage of arbitrage is the independence of the market direction. The goal is to generate a constant profit regardless of the market direction. So yes you will miss opportunities from a bull market but your investment will be safe during a bear market. It's a choice. The largest risk is if the spread between two exchanges never closes for some reasons or if an exchange goes bankrupt like Mt. Gox. If you are interested, here is a good Wall Street example where the spreads didn't close as expected during arbitrage investments: Long-Term Capital Management L.P.In that case the yearly return is less than 30% and judging by what happened to bitcoin platforms in previous years it has been a negative return. That is because the risk of default from these places was far greater than the 30% return. And have not most major currencies inflated greatly the past year? It seems a lot of extra work and risk to slightly beat out the most transparent stocks in Western countries.
|
|
|
|
siameze
Legendary
Offline
Activity: 1064
Merit: 1000
|
|
March 16, 2015, 03:59:51 PM |
|
I had never seen this list before, thanks for sharing. I bookmarked the page for future reference.
|
|
|
|
butor (OP)
Newbie
Offline
Activity: 49
Merit: 0
|
|
March 16, 2015, 10:01:29 PM |
|
In that case the yearly return is less than 30% and judging by what happened to bitcoin platforms in previous years it has been a negative return. That is because the risk of default from these places was far greater than the 30% return. And have not most major currencies inflated greatly the past year? It seems a lot of extra work and risk to slightly beat out the most transparent stocks in Western countries.
Are you saying that, according to you, more than 30% of the current Bitcoin exchanges will go bankrupt within one year from now? Did that happen in the past? Note that I'm only considering the large exchanges that offer enough liquidity to do short-term trading. Even if it's true, the impact of that default risk is pretty much the same whether you are on an arbitrage strategy or a buy and hold strategy.
|
|
|
|
hgerson
|
|
March 18, 2015, 01:57:03 AM |
|
Very interesting concept.
I hope you don't abandon it.
|
|
|
|
|