PositionStatistics#

tradeexecutor.state.statistics.PositionStatistics class.

class PositionStatistics[source]#

Bases: object

PositionStatistics(calculated_at: datetime.datetime, last_valuation_at: datetime.datetime, profitability: float, profit_usd: tradingstrategy.types.USDollarAmount, quantity: float, value: tradingstrategy.types.USDollarAmount)

__init__(calculated_at, last_valuation_at, profitability, profit_usd, quantity, value)#
Parameters
Return type

None

Methods

__init__(calculated_at, last_valuation_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

calculated_at

Real-time clock when these stats were calculated

last_valuation_at

When this position was revalued last time.

profitability

Profitability %

profit_usd

How much profit we made so far

quantity

The current number of owned units

value

The current position size dollars

calculated_at: datetime#

Real-time clock when these stats were calculated

last_valuation_at: datetime#

When this position was revalued last time. Should not be far off from calculated_at because we should revalue positions always before calculating their stats.

profitability: float#

Profitability %

profit_usd: USDollarAmount#

How much profit we made so far

quantity: float#

The current number of owned units

value: USDollarAmount#

The current position size dollars

__init__(calculated_at, last_valuation_at, profitability, profit_usd, quantity, value)#
Parameters
Return type

None