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 set

  • Any 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)#
Parameters:
Return type:

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, ...])

get_usd_value()

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

Asset we are tracking

quantity

How many token units we have.

last_usd_price

What was the last known USD price of a single unit of quantity

last_pricing_at

When the last pricing happened

created_at

Strategy cycle time stamp when the tracking was started

created_strategy_cycle_at

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.

quantity: Decimal#

How many token units we have.

last_usd_price: float#

What was the last known USD price of a single unit of quantity

last_pricing_at: datetime#

When the last pricing happened

created_at: datetime#

Strategy cycle time stamp when the tracking was started

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:

float

revalue(price, when)[source]#

Update the latest known price of the asset.

Parameters:
__init__(asset, quantity, last_usd_price, last_pricing_at, created_at=<factory>, created_strategy_cycle_at=None)#
Parameters:
Return type:

None

change_quantity_and_value(delta, price, when, allow_negative=False)[source]#

The tracked asset amount is changing due to position increase/reduce.

Parameters: