Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client/mm: Refactor bot balance tracking
- This diff updates the balance tracking for market making bots. Previously, there was a fragile diff based accounting technique. Now, on each bot action, including trades, withdrawals, and deposits, a pending action is stored. This pending action is updated until it is complete, at which time it is removed, and the "base" balance of the bot is updated. The bot balances are calculated by adding the base balances of the bot to the effects of all pending actions. - The `wrappedCore` and `wrappedCEX` types are removed, and their functionalities are combined into a `unifiedExchangeAdaptor`. This is useful because pending deposits and pending withdrawals have balance effects on both CEX and DEX balances. Each `unifiedExchangeAdaptor` listens to a core notification stream, and the `MarketMaker` type no longer needs to. In a future refactor, the bots themselves will no longer listen to the core notification functionality, and all common functionalities can be moved to the `unifiedExchangeAdaptor`. - Previously, the fee assets of tokens were not taken into account, but now they are. - The Binance library now uses a different endpoint, `/api/v3/balances`, to get balances. This is supported by the Binance testnet api, so testbinance is no longer required for balances.
- Loading branch information