bmino / binance-triangle-arbitrage

Detect in-market cryptocurrency arbitrage
MIT License
1.07k stars 336 forks source link

Code places one order and crashes #133

Closed georgekhanachat closed 3 years ago

georgekhanachat commented 3 years ago

Hey @bmino!

I just recently cloned your repo, honestly looks pretty neat. I've had the same problem where its not been placing orders even at really high percentages of 4% that have been going own for an age of around 40 to 100 seconds. I have a very similar config file. The logs still show that WebSocket are being disconnected so i increased the bundle size in hopes of reducing the number of sockets but that didn't fix the issue. The program would run on the HUD make a max of one trade and exit with the following error: image

I hope to reopen this issue to help make this program work!

Originally posted by @georgekhanachat in https://github.com/bmino/binance-triangle-arbitrage/issues/116#issuecomment-773969331

bmino commented 3 years ago

There are a few questions in that issue haha.

1) The bot is configured to stop after one trade by default (EXECUTION.CAP). Check out the config readme on how that is configured 2) Orders will only be placed that match your thresholds. This includes age thresholds and profit thresholds. Check out the config readme on how these work. 3) ELIFECYCLE errors will happen when your system can't handle too many requests or a request is blocked. It happens

bmino commented 3 years ago

Also, I haven't personally found that modifying the websocket bundle size had an affect on disconnecting websockets. That was put in there as a debugging tool before the underlying issue was discovered which was the cpu being overloaded and becoming unable to handle websocket ping/pong packets

zadewg commented 3 years ago

I believe this might be caused by some limitation on Binance's side. Regardless of configuration I seem to crash after 9 seconds of subscriptions consistently.

This is also the case using most conservative configuration such as DEPTH 5, INTERVAL 1000 (bundle size 1).

zadewg commented 3 years ago

Funny enough, setting

    "BINANCE_OPTIONS": {
      "recvWdindow": 60000,
      "useServerTime": true
    }

As sugested here allows me to get through the Opening 315 depth websockets for 315 tickers ... section but crashes inmediatly after Waiting for all tickers to receive initial depth snapshot ... with another Timeout.

I have also tried increasing the receive timeout with no success.

Binance must be under heavy load with the recent pump and dump campaigns.

bmino commented 3 years ago

What do you see in your performance log about cpu cycle usage?

zadewg commented 3 years ago

What do you see in your performance log about cpu cycle usage?

No reference to CPU cycle usage, only latency messages (very high btw, about 3600ms). However Im sceptic of this number as pinging api1.binance.com manually yields ~40ms, and subscriptions can happen at this rate.

Fyi my node and npm versions are the exact same mentioned in the readme.

bmino commented 3 years ago

The cpu output is configured by default every 2 minutes by the LOG.STATUS_UPDATE_INTERVAL

bmino commented 3 years ago

Pinging will only resolve the url, that is not interacting with the api and getting an api response so it should be faster

zadewg commented 3 years ago

The cpu output will not be logged because it is configured after the line 58, where it crashes. I can modify the code to overcome this but im not sure if the ouput will then be relevant to you, let me know.

bmino commented 3 years ago

Ahh okay, so the bot isn't successfully initializing the depth caches. This means it is failing to either open a websocket, or make the depth cache init request.

bmino commented 3 years ago

What cpu is this running on?

zadewg commented 3 years ago

What cpu is this running on?

Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

On Ubuntu 20.04.2 LTS

bmino commented 3 years ago

I assume you are using the latest version right? In the original screenshot posted, the output implies that the depth caches were already setup successfully and the error occurred during runtime.

Once all startup logic has completed and the depth caches are initialized, there is a "Initialized" log output as the bot is now running calculations

Utone commented 3 years ago

Binance had upgraded their API, we are not experiencing heavy load related issues since a couple of days.

Curious if running "BINANCE_OPTIONS": { "recvWdindow": 60000, "useServerTime": true } Now, still gives the same result.

bmino commented 3 years ago

I am closing this issue as discussion has drifted in many directions from the original issue. Please feel free to open any new specific issues and we can address them individually