AssetWithTrackedValue#
API documentation for tradeexecutor.state.identifier.AssetWithTrackedValue Python class in Trading Strategy framework.
- class AssetWithTrackedValue[source]#
Bases:
object
Track one asset with a value.
Track asset quantity
The asset can be vToken/aToken for interest based tracking, in this case
presentation
is setAny tracked asset must get USD oracle price from somewhere
- __init__(asset, quantity, last_usd_price, last_pricing_at, created_at=<factory>, created_strategy_cycle_at=None)#
Methods
__init__
(asset, quantity, last_usd_price, ...)change_quantity_and_value
(delta, price, when)The tracked asset amount is changing due to position increase/reduce.
from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])Rrturn the approximate value of this tracked asset.
revalue
(price, when)Update the latest known price of the asset.
schema
(*[, infer_missing, only, exclude, ...])to_dict
([encode_json])to_json
(*[, skipkeys, ensure_ascii, ...])Attributes
Asset we are tracking
How many token units we have.
What was the last known USD price of a single unit of quantity
When the last pricing happened
Strategy cycle time stamp when the tracking was started
Strategy cycle time stamp when the tracking was started
- asset: AssetIdentifier#
Asset we are tracking
The is aToken or vToken asset.
Use
asset.underlying
to get the token.
- created_strategy_cycle_at: datetime.datetime | None#
Strategy cycle time stamp when the tracking was started
- get_usd_value()[source]#
Rrturn the approximate value of this tracked asset.
Priced in the last_usd_price
- Return type:
- __init__(asset, quantity, last_usd_price, last_pricing_at, created_at=<factory>, created_strategy_cycle_at=None)#