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, price, price_at)#
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()

is_usd_low_value_diff([usd_value_threshold])

Check for dust positions.

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

The difference between expected and actual, in USD terms

reserve_asset

Is this correction for reserve asset

mismatch

Was there a balance mismatch that is larger than the epsilon

price

Token price used in usd_value calcuulation

price_at

Timestamp when we fetched the prcie

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#

The difference between expected and actual, in USD terms

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

price: decimal.Decimal | None#

Token price used in usd_value calcuulation

price_at: datetime.datetime | None#

Timestamp when we fetched the prcie

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

is_usd_low_value_diff(usd_value_threshold=0.1)[source]#

Check for dust positions.

  • We have plenty of token as in base token quantity but it is zeor

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

None