calculate_account_corrections#

calculate_account_corrections(pair_universe, reserve_assets, state, sync_model, epsilon=Decimal('0.000010000000000000000818030539140313095458623138256371021270751953125'), 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

  • 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]