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



Accounting correction applied to a balance.


An enumeration.


apply_accounting_correction(state, ...)

Update the state to reflect the true on-chain balances.

calculate_account_corrections(pair_universe, ...)

Figure out differences between our internal ledger (state) and on-chain balances.

check_accounts(pair_universe, ...)

Get a table output of accounting corrections needed.

correct_accounts(state, corrections, ...[, ...])

Apply the accounting corrections on the state (internal ledger).

is_relative_mismatch(actual_amount, ...)

Calculate if we are within the relative tolerance.


Transfer away non-reserve assets that cannot be mapped to an open position.