Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the sign of cross rate calculation is wrong #54

Open
mkutny opened this issue Jul 5, 2018 · 3 comments
Open

the sign of cross rate calculation is wrong #54

mkutny opened this issue Jul 5, 2018 · 3 comments

Comments

@mkutny
Copy link

mkutny commented Jul 5, 2018

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:

  • RCN/BNB: 0.003659 / 0.004078
  • RCN/BTC: 0.00000786 / 0.00000792
  • BNB/BTC: 0.00213080 / 0.00213140

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.

@mkutny mkutny changed the title sign in cross rate calculation is wrong the sign of cross rate calculation is wrong Jul 5, 2018
@lploumen
Copy link

lploumen commented Nov 6, 2018

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
Copy link
Contributor

Arrandir commented Nov 6, 2018 via email

@tiagosiebler
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants