tiagosiebler / TriangularArbitrage

Detect triangular arbitrage opportunities within Binance price tickers
545 stars 171 forks source link

the sign of cross rate calculation is wrong #54

Open mkutny opened 6 years ago

mkutny commented 6 years ago

I run a script and was surprised to see abnormally huge arbitrage opportunities. So I decided to pick a case and manually check rate calculation. My findings are below.

The script reported 10.58% rate for the sequence BTC -> BNB -> RCN.

Respective orderbooks were:

Arbitrage steps were:

  1. buy BNB for BTC (ask is 0.00213140)
  2. buy RCN for BNB (ask is 0.004078)
  3. sell RCN for BTC (bid is 0.00000786 which then gets inverted)

The cross rate calculated is 0.00213140 * 0.004078 / 0.00000786 = 1.1058332316 (10.58%)

The issue is that at steps 1-2 I'm supposed to buy RCN (for BTC via BNB) and the cross rate would be 0.00213140 * 0.004078 = 0.00000869. At step 3 I'm supposed to sell this RCN for 0.00000786 or 10.58% cheaper.

So the rate is properly calculated, the only issue is that in this case it represents 10.58% loss, not 10.58% win opportunity.

lploumen commented 5 years ago

I also made the test and got the same results. 5% arbitrage opportunities were too good to be true :) I wonder how's everyone using this scanner ?

Arrandir commented 5 years ago

We are not :p in every case the tool is to slow executing sale orders. Even with a decent stop loss built in you still loose an average of 0.15% per trade

Op di 6 nov. 2018 15:45 schreef Loic Ploumen <notifications@github.com:

I also made the test and got the same results. 5% arbitrage opportunities were too good to be true :) I wonder how's everyone using this scanner ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tiagosiebler/TriangularArbitrage/issues/54#issuecomment-436277244, or mute the thread https://github.com/notifications/unsubscribe-auth/Ah4FK2NEzRv3nKhabsHba2zvW2uWHceVks5usaCjgaJpZM4VDf8_ .

tiagosiebler commented 5 years ago

Only idea I have for this is to add logic iterating through the order book, seeing how much can be sent down a route and still make a profit with fees included, then jumping the full route with market orders. With the min order value limits though, I'm not sure if the number of opportunities per day is worth this effort.