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:
type (AccountingCorrectionCause) –
holding_address (str) –
asset (AssetIdentifier) –
positions (Optional[Set[GenericPosition]]) –
expected_amount (Decimal) –
actual_amount (Decimal) –
dust_epsilon (Decimal) –
relative_epsilon (Decimal) –
block_number (int | None) –
timestamp (datetime.datetime | None) –
usd_value (float | None) –
reserve_asset (bool) –
mismatch (bool) –
- Return type:
None
Methods
__init__
(type, holding_address, asset, ...)We have extra
is_dusty
()If there is a mismatch, is the mismatch within the dust tolerance,
is_mismatch
()Attributes
Backwards compatibility.
How many tokens we corrected
type
Where is this token being stored
Related on-chain asset
Related positions
expected_amount
actual_amount
Dust epsilon
Relative epsilon
block_number
timestamp
Keep track of monetary value of corrections.
Is this correction for reserve asset
Was there a balance mismatch that is larger than the epsilon
- asset: AssetIdentifier#
Related on-chain asset
- positions: Optional[Set[GenericPosition]]#
Related positions
Set none if no open position was found
- 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.
- property quantity#
How many tokens we corrected
- property position: tradeexecutor.state.generic_position.GenericPosition | None#
Backwards compatibility.
TODO: Remove code paths touching this
- __init__(type, holding_address, asset, positions, expected_amount, actual_amount, dust_epsilon, relative_epsilon, block_number, timestamp, usd_value, reserve_asset, mismatch)#
- Parameters:
type (AccountingCorrectionCause) –
holding_address (str) –
asset (AssetIdentifier) –
positions (Optional[Set[GenericPosition]]) –
expected_amount (Decimal) –
actual_amount (Decimal) –
dust_epsilon (Decimal) –
relative_epsilon (Decimal) –
block_number (int | None) –
timestamp (datetime.datetime | None) –
usd_value (float | None) –
reserve_asset (bool) –
mismatch (bool) –
- Return type:
None