Bitcoin Forum
June 23, 2018, 08:13:16 PM
 News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 Home Help Search Donate Login Register
 Pages: 1 2 3 4 5 6 7 [8]  All
 Author Topic: Bitcoin arbitrage on GitHub: ~2% monthly return, market-neutral long/short  (Read 37893 times)
butor
Jr. Member

Offline

Activity: 49
Merit: 0

Looking for C++ contributors

 June 30, 2016, 01:06:18 AM

Could you explain the idea behind "OrderBookFactor"? How does the number have a correlation with the liquidity? If I set it at 3.0, is it 3x the spread, or?

As you've probably understood, to stay market neutral the two orders that you send to the exchanges have to be both executed immediately. Since Blackbird sends limit orders (and not market orders because it would be too risky), you have to make sure that the orders can be fully executed at the price you defined. Indeed, if there is not enough liquidity the orders will only be partially executed, and you won't be market neutral anymore.

To prevent that situation, Blackbird makes sure that there is at least 3 times (parameter OrderBookFactor) the liquidity in the order book at the limit price that was defined before executing a trade. So before sending a trade of 2.0 BTC at \$500 for example, Blackbird will make sure that there is at least 6.0 BTC at \$500 available. Actually it's not exactly \$500 but the value defined by the parameter PriceDeltaLimit to give a little bit of margin. But let's ignore that to keep the example simple.

Now, what happens if you don't check the liquidity first? You detect an arbitrage opportunity at \$500 (ask price) and you directly send a buy limit order 2.0@\$500 to the exchange. But here is the order book of the exchange at that time:

 Ask_Price Size \$500.00 0.5 \$502.00 3.2 \$503.00 5.4

Your order will be filled for 0.5@\$500 and will stay open for the remaining 1.5. If the other order that you send to the other exchange was completely executed, you will have an imbalance: 0.5 BTC vs. 2.0 BTC.

Note: we use 3 times the liquidity because we need some margin in case of slippage: this occurs when the price changes between the time you send the order and the time the exchange processes it.

Blackbird on GitHub: https://github.com/butor/blackbird
1529784796
Hero Member

Offline

Posts: 1529784796

Ignore
 1529784796

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

Offline

Posts: 1529784796

Ignore
 1529784796

1529784796
 Report to moderator
1529784796
Hero Member

Offline

Posts: 1529784796

Ignore
 1529784796

1529784796
 Report to moderator
lightpuma
Newbie

Offline

Activity: 7
Merit: 0

 July 02, 2016, 07:55:55 PM

Ah, right. I understand now. If that's the case, would it be easier to send the maximum amount available (without slippage) on one exchange to both exchanges?
Ie: exchange 1 has ask price 550 with amount 5, exchange 2 has bid price 600 with amount 10. You then place buy/sell orders for an amount of 5 on both exchanges. Ensuring no slippage.

Out of curiosity do you only examine the order book prices to a depth of 1? Seems like by doing so there'd be a few missed opportunities. However to examine with a depth of two the maths is much more involved.
butor
Jr. Member

Offline

Activity: 49
Merit: 0

Looking for C++ contributors

 July 09, 2016, 02:44:28 PM

Ah, right. I understand now. If that's the case, would it be easier to send the maximum amount available (without slippage) on one exchange to both exchanges?
Ie: exchange 1 has ask price 550 with amount 5, exchange 2 has bid price 600 with amount 10. You then place buy/sell orders for an amount of 5 on both exchanges. Ensuring no slippage.

That would be a possibility yes, but usually a discrepancy between prices tends to last a little bit. So it would be better to wait until you have enough liquidity to match your exposure. For example you don't want Blackbird to trade for \$24 when the exposure you set is \$5,000. I think it's better to wait until you have enough liquidity to send \$5,000 orders.

Out of curiosity do you only examine the order book prices to a depth of 1? Seems like by doing so there'd be a few missed opportunities. However to examine with a depth of two the maths is much more involved.

During the liquidity check, Blackbird reads the order book in depth until it reaches a price that would cover its liquidity needs. So it doesn't just examine the first depth but the following ones as well, if necessary.

Blackbird on GitHub: https://github.com/butor/blackbird
bitcoinisfurture
Hero Member

Offline

Activity: 700
Merit: 500

 July 09, 2016, 03:24:59 PM

2% monthly return is quite low profit.  There is a thread which says 400% profit on brexit. So 2% is nothing .
ramsestom
Newbie

Offline

Activity: 1
Merit: 0

 September 01, 2016, 10:47:05 PM

2% monthly return is quite low profit.  There is a thread which says 400% profit on brexit. So 2% is nothing .

2% riskless (or with a real low risk to be more precise) is far from being nothing. Tell me what other method can bring you a 25% "guaranteed" annual profit and I give you the management of an edge found....
The arrival of short sells possibilities on some bitcoins/altcoins platforms is a real opportunity to make easy profit with arbitrage (which is pretty much impossible on traditional forex now, unless you take a high leverage and/or trade really high volumes, with the associated risks if anything goes wrong...)
I am planning on making a program similar to blackbird but in java (java has many advantages over C++ for this kind of application I think. Appart from the fact that I am more comfortable with coding in java , java also has many bitcoins/altcoins related libs already implemented (like https://github.com/timmolter/XChange), which should ease the development and maintenance of the program. Also, java can easily be multi-threaded (important to make simultaneous api requests on all platforms) and run on pretty much any platform. Finaly, making a UI in java is really easier than in C++. As for the "performances" concern, I can tell you that java can be more efficient than C++ in many cases (anyway performance must not be an issue in this use case where there is no computational intensive tasks. So any language would fit here...))
I don't know if anyone would be interested into helping and I haven't decided if I would make it open source or not yet (would mainly depends whether other people want to contribute or not) but if you are interested to join, you can send me a PM.

Full Member

Offline

Activity: 140
Merit: 100

 September 02, 2016, 01:48:33 PM

2% per month, compounded probably nets you over 30% per year, that's a great great return. Especially in this day and age where even hedgefunds are having trouble meeting their required rates of return. 2% per month is nothing to sneeze at.
DasPferd
Newbie

Offline

Activity: 3
Merit: 0

 October 17, 2016, 01:43:11 PM

Is the 2% still a recent number? I'm seeing arbitrage options which open but seem to take too long too close. e.g. currently there is a diff. between bitfinex and bitstamp for days of 0.9%. This means in return that while you keep it open you also pay interest on the short position of approx. 0.01% / day which can diminish your opportunity if the close takes too long.

What I also don't quite understand, why this gap seems to be so persistent, sure the gap is too small to be closed by a regular arbitrage trader with the normal fees but there should be still buyers/seller who buy/sell btc for the purpose of speculation.
https://www.weforum.org/agenda/2016/04/why-bitcoin-exchanges-arent-as-straightforward-as-they-seem
TheFridge
Sr. Member

Offline

Activity: 252
Merit: 250

 April 14, 2017, 04:20:46 AM

Is there plans for OKCoin  Shorting to be implemented?
butor
Jr. Member

Offline

Activity: 49
Merit: 0

Looking for C++ contributors

 June 01, 2017, 02:03:21 PM

Is there plans for OKCoin  Shorting to be implemented?

A first implementation is work in progress (link here). but hasn't been finished yet.

Blackbird on GitHub: https://github.com/butor/blackbird
WarrEagle
Hero Member

Offline

Activity: 644
Merit: 500

 June 01, 2017, 02:33:19 PM

I'm also curious how this is working with small amounts of exposure. The current lag time in transfers makes me think that this might be a lesson in futility if it takes 24 to 48 hours for a transaction to process with low fees. Or if the fees to process a transaction, makes the 2% return much smaller.

How about an update from the OP?

DELETED
Razzoel
Jr. Member

Offline

Activity: 51
Merit: 0

 June 02, 2017, 07:58:45 AM

This has a lot of potential. 2% monthly return is very high. I think you might be able to squeeze out higher numbers if you optimize it!
butor
Jr. Member

Offline

Activity: 49
Merit: 0

Looking for C++ contributors

 June 13, 2017, 03:19:42 AM

I'm also curious how this is working with small amounts of exposure. The current lag time in transfers makes me think that this might be a lesson in futility if it takes 24 to 48 hours for a transaction to process with low fees. Or if the fees to process a transaction, makes the 2% return much smaller.

Besides rebalancing the accounts, there is no money transfers involved in the long/short strategy. So the transaction latency is not a concern.

The 2% return is net of exchange fees.

Blackbird on GitHub: https://github.com/butor/blackbird
Dasher76
Newbie

Offline

Activity: 10
Merit: 0

 June 20, 2017, 04:36:37 PM

Any new updates here? How is it working in the current market conditions?
Would appreciate the feedback from both the author & users who are using it.
Thank you
searchacc
Jr. Member

Offline

Activity: 42
Merit: 0

 October 19, 2017, 08:52:59 AM

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless
Full Member

Offline

Activity: 364
Merit: 100

 November 07, 2017, 03:45:06 AM

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless

Agreed, 2% monthly in crypto markets is horrible.  Bitcoin is up 1000% in the last year lol

That said, the 2% figure was specified in 2015, a lot has changed since then.  Is anything using this bot now?
Talenter
Jr. Member

Offline

Activity: 30
Merit: 0

 November 24, 2017, 08:18:12 AM

2% per month its nothing, lot of people has 4-5K to invest,  2% per month will bring them nothing,sorry but your bot is useless

Agreed, 2% monthly in crypto markets is horrible.  Bitcoin is up 1000% in the last year lol

That said, the 2% figure was specified in 2015, a lot has changed since then.  Is anything using this bot now?

Is Blackbird still running? Some experience with it? Thx for your report.
ScIEnC
Newbie

Offline

Activity: 1
Merit: 0

 December 18, 2017, 12:28:34 AM

Hello

I am testing blackbird and found the issue below when trying to place orders:

[ ENTRY FOUND ]
Date & Time:       12/17/2017 22:21:15
Exchange Short:    Bitfinex (id 0)
Fees:              0.50% / 0.20%
Price Long:        19,300.00 (target)
Price Short:       19,149.00 (target)
Cash used:         40.00 on each exchange
Exit Target:       -2.72%

<QuadrigaCX> order failed: {"error": {"code": 22, "message": "Incorrect amount 0.0020725388601036"}}
<Bitfinex> Trying to send a "sell" limit order: 0.002090@\$19,149.00...
<Bitfinex> Done (order ID: 6246148575)

Waiting for the two orders to be filled...
<QuadrigaCX> Error: failed to get order status for id: Order Failed:[{"id": "Order Failed", "error": {"code": 106, "message": "Cannot perform request - not found"}}]
Rubiwane
Newbie

Offline

Activity: 1
Merit: 0

 January 10, 2018, 09:37:32 AM

Does someone can explain this?
Since 3 days all opportunities are in minus
[ 01/10/2018 09:25:06 ]
Bitfinex: 13,587.00 / 13,588.00
Kraken: 13,764.50 / 13,770.00
ItBit: 13,681.43 / 13,685.10