AccountingBalanceCheck#

API documentation for tradeexecutor.strategy.account_correction.AccountingBalanceCheck Python class in Trading Strategy framework.

class AccountingBalanceCheck[source]#

Bases: object

Accounting correction applied to a balance.

Any irregular accounting correction will cause the position profit calcualtions and such to become invalid. Such positions should be separately market and not included in the profit calculations.

__init__(type, holding_address, asset, positions, expected_amount, actual_amount, dust_epsilon, relative_epsilon, block_number, timestamp, usd_value, reserve_asset, mismatch)#
Parameters:
Return type:

None

Methods

__init__(type, holding_address, asset, ...)

has_extra_tokens()

We have extra

is_dusty()

If there is a mismatch, is the mismatch within the dust tolerance,

is_mismatch()

Attributes

position

Backwards compatibility.

quantity

How many tokens we corrected

type

holding_address

Where is this token being stored

asset

Related on-chain asset

positions

Related positions

expected_amount

actual_amount

dust_epsilon

Dust epsilon

relative_epsilon

Relative epsilon

block_number

timestamp

usd_value

Keep track of monetary value of corrections.

reserve_asset

Is this correction for reserve asset

mismatch

Was there a balance mismatch that is larger than the epsilon

holding_address: str#

Where is this token being stored

Hot wallet address or Enzyme vault address

asset: AssetIdentifier#

Related on-chain asset

positions: Optional[Set[GenericPosition]]#

Related positions

Set none if no open position was found

dust_epsilon: Decimal#

Dust epsilon

relative_epsilon: Decimal#

Relative epsilon

usd_value: float | None#

Keep track of monetary value of corrections.

An estimated value at the time of the correction creation.

Negative for negative corrections

None if the the tokens are for a new position and we do not have pricing information yet available, or if the position is not a spot position.

reserve_asset: bool#

Is this correction for reserve asset

mismatch: bool#

Was there a balance mismatch that is larger than the epsilon

property quantity#

How many tokens we corrected

property position: tradeexecutor.state.generic_position.GenericPosition | None#

Backwards compatibility.

TODO: Remove code paths touching this

has_extra_tokens()[source]#

We have extra

Return type:

bool

is_dusty()[source]#

If there is a mismatch, is the mismatch within the dust tolerance,

Return type:

bool

__init__(type, holding_address, asset, positions, expected_amount, actual_amount, dust_epsilon, relative_epsilon, block_number, timestamp, usd_value, reserve_asset, mismatch)#
Parameters:
Return type:

None