ValuationUpdate#
API documentation for tradeexecutor.state.valuation.ValuationUpdate Python class in Trading Strategy framework.
- class ValuationUpdate[source]#
Bases:
object
Valuation update events.
Generated by
tradeexecutor.strategy.valuation.ValuationModel
- __init__(position_id, created_at, valued_at, new_value, new_price, old_value=None, old_price=None, block_number=None, mark_down_to_zero=None)#
Methods
__init__
(position_id, created_at, valued_at, ...)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
What is the block number is valuation is based on.
In this update, we marked down this position to zero because of the valuation failure.
What was the position base asset price before this update.
What was the position value before this update.
position_id
When this valuation was updated.
The block timestamp this valuation is based on.
new_value
The new price of the base asset of the position.
- created_at: datetime#
When this valuation was updated.
Valuation can be based on old data, this is the strategy cycle timestamp or wall-clock timestmap when this event was generated.
See also
valued_at
- valued_at: datetime#
The block timestamp this valuation is based on.
If not available then wall clock time of the valuation. Note that block timestamp may lag
created_at
because we cannot use the last block due to chain tip instability.See also
event_generated_at
- new_price: float#
The new price of the base asset of the position.
Note that position value depends also on gained interest and the price of the quote asset.
- block_number: int | None = None#
What is the block number is valuation is based on.
Must match
valued_at
.
- mark_down_to_zero: bool | None = None#
In this update, we marked down this position to zero because of the valuation failure.
Set to True indicate we lost the valuation source for this position.
See revalue_portfolio().
- __init__(position_id, created_at, valued_at, new_value, new_price, old_value=None, old_price=None, block_number=None, mark_down_to_zero=None)#