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

Error Handling: Placing CEX order fails #45

Closed kilrau closed 4 years ago

kilrau commented 4 years ago

Follow-up of https://github.com/ExchangeUnion/market-maker-tools/issues/41: If placing CEX order fails -> retry placing CEX infinitely since the OpenDEX order already succeeded at that point and we are "out of balance". Before doing anything else, we need to get the CEX order filled. Arby should retry placing the CEX order while making sure all OpenDEX orders are cancelled and no new ones get issued.

kilrau commented 4 years ago

Looks like this is working now:

2020-07-24 01:49:03.033 [Centralized] warn: Price feed lost. Retrying in 5000ms.
2020-07-24 01:49:03.033 [Centralized] trace: ETHBTC stream closed
2020-07-24 01:49:03.033 [OpenDEX] info: All OpenDEX orders have been removed
2020-07-24 01:49:13.1313 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598543619&recvWindow=5000&symbol=ETHBTC&signature=767184b59082db3a9c6f7cabb0de0de92eab113e96c074d2f550352e23e1ad4b request timed out (10000 ms) - retrying in 1000ms
2020-07-24 01:49:19.1919 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598554625&recvWindow=5000&symbol=ETHBTC&signature=b76465bf3bbf4999ed885586a216a084b0fef547e0a952606e724f774f59201d system request to https://api.binance.com/api/v3/openOrders?timestamp=1595598554625&recvWindow=5000&symbol=ETHBTC&signature=b76465bf3bbf4999ed885586a216a084b0fef547e0a952606e724f774f59201d failed, reason: getaddrinfo EAI_AGAIN api.binance.com - retrying in 1000ms
2020-07-24 01:49:25.2525 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598560640&recvWindow=5000&symbol=ETHBTC&signature=e01e245b48ea478f9a6451e3569c0acf2c9615a623399fe9a43da0815a249e7b system request to https://api.binance.com/api/v3/openOrders?timestamp=1595598560640&recvWindow=5000&symbol=ETHBTC&signature=e01e245b48ea478f9a6451e3569c0acf2c9615a623399fe9a43da0815a249e7b failed, reason: getaddrinfo EAI_AGAIN api.binance.com - retrying in 1000ms
2020-07-24 01:49:31.3131 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598566649&recvWindow=5000&symbol=ETHBTC&signature=6c0cc879dfd92bb73ddd8628ad8bcc0fc641fd62768db5a1f5bb4183f7e876e3 system request to https://api.binance.com/api/v3/openOrders?timestamp=1595598566649&recvWindow=5000&symbol=ETHBTC&signature=6c0cc879dfd92bb73ddd8628ad8bcc0fc641fd62768db5a1f5bb4183f7e876e3 failed, reason: getaddrinfo EAI_AGAIN api.binance.com - retrying in 1000ms
2020-07-24 01:49:37.3737 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598572660&recvWindow=5000&symbol=ETHBTC&signature=3391e03728d5bedb081cdbebae3aa1e7fdfd01e360f5ce43cd30c427410dd1e8 system request to https://api.binance.com/api/v3/openOrders?timestamp=1595598572660&recvWindow=5000&symbol=ETHBTC&signature=3391e03728d5bedb081cdbebae3aa1e7fdfd01e360f5ce43cd30c427410dd1e8 failed, reason: getaddrinfo EAI_AGAIN api.binance.com - retrying in 1000ms
2020-07-24 01:49:43.4343 [Centralized] warn: Failed to remove orders: binance GET https://api.binance.com/api/v3/openOrders?timestamp=1595598578670&recvWindow=5000&symbol=ETHBTC&signature=1ae500c7dbe2df42611f73a4da611e629048b756c621a34302839c15b769b222 system request to https://api.binance.com/api/v3/openOrders?timestamp=1595598578670&recvWindow=5000&symbol=ETHBTC&signature=1ae500c7dbe2df42611f73a4da611e629048b756c621a34302839c15b769b222 failed, reason: getaddrinfo EAI_AGAIN api.binance.com - retrying in 1000ms
2020-07-24 01:49:47.4747 [Centralized] info: All CEX orders have been removed

Not sure if you kept this one open for a reason, but if not, pls close @erkarl