ExchangeUnion / market-maker-bot

MM Bot for OpenDEX. Make profits via arbitrage between OpenDEX and a connected CEX account like Binance 🤖
GNU Affero General Public License v3.0
104 stars 20 forks source link

Cancel CEX orders when CEX price feed is down, start up as normal once price feed is back #41

Closed kilrau closed 4 years ago

kilrau commented 4 years ago

CEX price stream lost for more than 10 seconds -> cancel CEX & OpenDEX orders, infinitely retry cancelling if one happens to fail, retry connecting to the CEX price stream after successful cancellation, re-issue orders as on startup once price stream is back

Arby should NOT exit.

ghost commented 4 years ago

The above makes sense except:

Placing CEX order fails for more than 10 seconds (e.g. a rate limit) -> cancel OpenDEX orders and retry placing CEX order

CCXT should prevent us from ever getting rate limited. Think we can keep retrying until X times and afterwards exit with code 1 (trigger the non-0 protocol).

kilrau commented 4 years ago

Agree, adjusted the above.

Can we tackle the first point first? I added retrying connection to price stream. Loss of price stream seems to be a common issue and as of now arby doesn't seem to retry and simply exits with 0 after 12 hours:

2020-07-06 07:47:38.3838 [Centralized] info: Base asset balance 123 and quote asset balance 321
2020-07-06 07:47:39.3939 [OpenDEX] trace: Base asset balance 13.395 (maxinbound: 90071992.54740991, maxoutbound: 13.395) and quote asset balance 2.4308062 (maxinbound: 2.51910329, maxoutbound: 2.3808062).
Error: Price feed lost
2020-07-06 07:47:52.5252 [Centralized] trace: ETHBTC stream closed
2020-07-06 19:47:53,773 INFO exited: arby (exit status 0; expected)
kilrau commented 4 years ago

As just discussed with @erkarl , we separated the original issue list into 3 separate issues: