API documentation for tradeexecutor.state.statistics.PositionStatistics Python class in Trading Strategy framework.
- class PositionStatistics#
Time-series of statistics calculated for each open position.
Position statistics are recalculated at the same time positions are revalued. The time-series of these statistics are stored as a part of the state, allowing one to plot the position performance over time.
- __init__(calculated_at, last_valuation_at, profitability, profit_usd, quantity, value)#
__init__(calculated_at, last_valuation_at, ...)
from_dict(kvs, *[, infer_missing])
from_json(s, *[, parse_float, parse_int, ...])
schema(*[, infer_missing, only, exclude, ...])
to_json(*[, skipkeys, ensure_ascii, ...])
Real-time clock when these stats were calculated
When this position was revalued last time.
How much profit we made so far
The current number of owned units
The current position size dollars
- 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.