calculate_account_corrections#

API documentation for tradeexecutor.strategy.account_correction.calculate_account_corrections Python function.

calculate_account_corrections(pair_universe, reserve_assets, state, sync_model, relative_epsilon=Decimal('0.000100000000000000004792173602385929598312941379845142364501953125'), all_balances=False)[source]#

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

Parameters:
  • pair_universe (PandasPairUniverse) – Needed to know what asses we are looking for

  • reserve_assets (Collection[AssetIdentifier]) – Needed to know what asses we are looking for

  • state (State) – The current state of the internal ledger

  • sync_model (SyncModel) – How ot access on-chain balances

  • dust_epsilon – Minimum amount of token (abs quantity) before it is considered as a rounding error

  • all_balances – If True iterate all balances even if there are no mismatch.

Raises:

UnexpectedAccountingCorrectionIssue – If we find on-chain tokens we do not know how to map any of our strategy positions

Returns:

Difference in balances or all balances if all_balances is true.

Return type:

Iterable[AccountingBalanceCheck]