BalanceEventRef#
tradeexecutor.state.sync.BalanceEventRef Python class in Trading Strategy framework.
- class BalanceEventRef[source]#
Bases:
object
Register the balance event in the treasury model.
Balance updates can happen for
Treasury
Open trading positions
We maintain a list of balance update references across all positions using
BalanceEventRef
. This allows us quickly to calculate net inflow/outflow.- __init__(balance_event_id, strategy_cycle_included_at, cause, position_type, position_id, usd_value)#
- Parameters:
balance_event_id (int) –
cause (BalanceUpdateCause) –
position_type (BalanceUpdatePositionType) –
- Return type:
None
Methods
__init__
(balance_event_id, ...)from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])schema
(*[, infer_missing, only, exclude, ...])to_dict
([encode_json])to_json
(*[, skipkeys, ensure_ascii, ...])Attributes
Balance event id we are referring to
When this update was made.
Cause of the event
Reserve currency or underlying position
Which trading positions were affected
How much this deposit/redemption was worth
- strategy_cycle_included_at: Optional[datetime]#
When this update was made.
Strategy cycle timestamp when the deposit/redemption was included in the strategy treasury.
It might be outside the cycle frequency if treasuries were processed in a cron job outside the cycle for slow moving strategies.
- cause: BalanceUpdateCause#
Cause of the event
- position_type: BalanceUpdatePositionType#
Reserve currency or underlying position
- usd_value: Optional[float]#
How much this deposit/redemption was worth
Used for deposit/redemption inflow/outflow calculation. This is the asset value from our internal price keeping at the time of the event.
- __init__(balance_event_id, strategy_cycle_included_at, cause, position_type, position_id, usd_value)#
- Parameters:
balance_event_id (int) –
cause (BalanceUpdateCause) –
position_type (BalanceUpdatePositionType) –
- Return type:
None