account_correction#
API documentation for tradeexecutor.strategy.account_correction Python module in Trading Strategy.
Module description#
Apply accounting corrections on the strategy state.
Read on-chain balances
Compare them to the balances seen in the state
Adjust statebalacnes to match chain based ones
Generate the accounting events to reflect these changes
Classes#
Accounting correction applied to a balance. |
|
How to fix tokens we see in the wallet, but for which we do not have a position open in the state. |
Functions#
|
Update the state to reflect the true on-chain balances. |
|
Figure out differences between our internal ledger (state) and on-chain balances. |
|
Calculate total tokens the portfolio should held. |
|
Create a summary accounting corrections needed. |
Check that we do not have any positions with non-executed trades. |
|
|
Apply the accounting corrections on the state (internal ledger). |
|
Calculate if we are within the relative tolerance. |
Open a missing spot position. |
|
|
"We have tokens for a trading pair, but no position is closed. |
Open a missing spot position. |
|
Transfer away non-reserve assets that cannot be mapped to an open position. |