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 orders on shutdown #46

Closed kilrau closed 4 years ago

kilrau commented 4 years ago

Follow-up of #41 & https://github.com/ExchangeUnion/market-maker-tools/issues/27: if arby exits (with non-0 or 0 code doesn't matter) -> cancel OpenDEX orders & cancel CEX orders. Retry until cancellation is successful on both sides.

In our xud-docker enviornment we need to make sure with the regular down command, arby gets SIGTERM first and xud only after arby did shutdown successfully.

kilrau commented 4 years ago

In situations where arby exited with code 0, expected (our definition of "graceful shutdown"), arby currently does not cancel OpenDEX orders:

2020-07-07 11:07:46.4646 [OpenDEX] trace: OpenDEX orders updated
2020-07-07 11:08:02.022 [Centralized] info: Base asset balance 123 and quote asset balance 321
2020-07-07 11:08:02.022 [OpenDEX] trace: Base asset balance 12.895 (maxinbound: 90071992.54740991, maxoutbound: 12.895) and quote asset balance 2.44415876 (maxinbound: 2.50575073, maxoutbound: 2.39415876).
2020-07-07 11:08:06.066 [Centralized] warn: Price feed lost. Retrying in 5000ms.
Error: Price feed lost
2020-07-07 11:08:06.066 [Centralized] trace: ETHBTC stream closed
2020-07-07 11:08:06,365 INFO exited: arby (exit status 0; expected)