bmino / binance-triangle-arbitrage

Detect in-market cryptocurrency arbitrage
MIT License
1.08k stars 340 forks source link

Tried and Lost #126

Closed asofyan closed 3 years ago

asofyan commented 3 years ago

Hi there, I tried this script and apparently it kept loosing. Here is the log:

[1/17/2021, 2:13:39 PM] INFO    : Initialized
[1/17/2021, 3:40:59 PM] INFO    : Attempting to execute BTC-NEBL-ETH with an age of 113 ms and expected profit of 0.8104%
[1/17/2021, 3:40:59 PM] INFO    : Buying 357 NEBLBTC @ market price
[1/17/2021, 3:40:59 PM] INFO    : Successfully bought 357.00000000 NEBLBTC @ a quote of 0.01014603 in 432 ms
[1/17/2021, 3:40:59 PM] INFO    : Selling 357 NEBLETH @ market price
[1/17/2021, 3:41:00 PM] INFO    : Successfully sold 357.00000000 NEBLETH @ a quote of 0.28988400 in 434 ms
[1/17/2021, 3:41:00 PM] INFO    : Selling 0.289 ETHBTC @ market price
[1/17/2021, 3:41:00 PM] INFO    : Successfully sold 0.28900000 ETHBTC @ a quote of 0.01000200 in 434 ms
[1/17/2021, 3:41:00 PM] INFO    : Executed BTC-NEBL-ETH position in 1304 ms
[1/17/2021, 3:41:00 PM] DEBUG   : NEBLBTC Stats:
[1/17/2021, 3:41:00 PM] DEBUG   : Expected Conversion:  0.00999600 BTC into 357.00000000 NEBL @ 0.00002800
[1/17/2021, 3:41:00 PM] DEBUG   : Observed Conversion:  0.01014603 BTC into 357.00000000 NEBL @ 0.00002842
[1/17/2021, 3:41:00 PM] DEBUG   : Price Change:         1.50090036%
[1/17/2021, 3:41:00 PM] DEBUG   :
[1/17/2021, 3:41:00 PM] DEBUG   : NEBLETH Stats:
[1/17/2021, 3:41:00 PM] DEBUG   : Expected Conversion:  357.00000000 NEBL into 0.29221581 ETH @ 0.00081853
[1/17/2021, 3:41:00 PM] DEBUG   : Observed Conversion:  357.00000000 NEBL into 0.28988400 ETH @ 0.00081200
[1/17/2021, 3:41:00 PM] DEBUG   : Price Change:         -0.79797530%
[1/17/2021, 3:41:00 PM] DEBUG   :
[1/17/2021, 3:41:00 PM] DEBUG   : ETHBTC Stats:
[1/17/2021, 3:41:00 PM] DEBUG   : Expected Conversion:  0.29200000 ETH into 0.01010700 BTC @ 0.03461300
[1/17/2021, 3:41:00 PM] DEBUG   : Observed Conversion:  0.28900000 ETH into 0.01000200 BTC @ 0.03460900
[1/17/2021, 3:41:00 PM] DEBUG   : Price Change:         -0.01156635%

my perfomance log

[1/17/2021, 8:35:39 PM] DEBUG   : Cycles done per second:  3.85
[1/17/2021, 8:35:39 PM] DEBUG   : Clock usage for cycles:  3.86%
[1/17/2021, 8:35:40 PM] DEBUG   : CPU Load: 35% [7%,8%]
[1/17/2021, 8:35:40 PM] DEBUG   : API Latency: 432 ms

was it because of latency? or was it my setting? I used default setting.

Stever1381 commented 3 years ago

You should probably work on EXECUTION.THRESOLD.PROFIT increasing it?

asofyan commented 3 years ago

Hi thanks for the answer, I already increase threshold profit to 0.5%, but still loosing. I move the server to Japan to get lower latency (about 20ms). Nothing change. If I increase the threshold more than 0.6%, nothing caught. I am not good enough to set this right, but I kept loosing.

Does anyone have the proper config that actually earn something?

bmino commented 3 years ago

Latency deeeefinitely! Each leg of that trade took ~432ms which is ginormous! You are essentially randomly trading with latency like that. Upon startup, latency should be less than 30ms ideally single digits.

You can achieve this by hosting the app somewhere near Tokyo like the aws region. If you are experiencing issues when the app is in Japan, post that log and we can discuss

Utone commented 3 years ago

Hi,

Interesting project!

First thing that comes to mind is low liquidity and (exploit by) slippage, (lure with a small bid or ask that may get pulled.. before you get there to arb)

I also get limit orders may not be optimal in triangular scenario not as post only on some books where your order gets blocked by volume: (defending the book), so if needed buying the ask with a short time out LIMIT or IOC/FOK order can rule out some slippage..if that is what is tricking you.. aaand yes ,,,,,,,,la ten cy,,,,,,,,,,,,,,, Recently have seen some very slow execution of market orders, in the browser or via api theres an increased window of no status update (mostly/ especially on high trade volume times) some orders obviously also had slippage even when the order history is within ms, not sure how fast the flashBoys go these days

And what about some often more than decent spread as first bid ask maker where it is still a 'lazy book/low hanging maker fruit?'?? It may be worth a try while you monitor the taker side as an exit profit?

From the maker side of trades.. have seen negative arbitrage scans: as lucrative efficiently inefficient markets to place big spreads..

bmino commented 3 years ago

You've got an interesting point @Utone and we can definitely discuss that further, but let's leave this issue thread to just @asofyan and his issue :)

bmino commented 3 years ago

Closing this due to inactivity from the OP