PortfolioStatistics#

tradeexecutor.state.statistics.PortfolioStatistics Python class in Trading Strategy framework.

class PortfolioStatistics[source]#

Bases: object

Portfolio statistics for each timepoint.

Updated with regular ticks for a live strategy.

If backtesting, only calculated_at and total_equity are necessary for later visualisations and metrics If livetrading, then all attributes should be specified so that for displaying updated metrics after each trade

__init__(calculated_at, total_equity, free_cash=None, open_position_count=None, open_position_equity=None, frozen_position_count=None, frozen_position_equity=None, closed_position_count=None, unrealised_profit_usd=None, first_trade_at=None, last_trade_at=None, realised_profit_usd=0, summary=None)#
Parameters:
Return type:

None

Methods

__init__(calculated_at, total_equity[, ...])

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

closed_position_count

first_trade_at

free_cash

frozen_position_count

frozen_position_equity

last_trade_at

open_position_count

open_position_equity

realised_profit_usd

summary

unrealised_profit_usd

calculated_at

Real-time clock when these stats were calculated

total_equity

calculated_at: datetime#

Real-time clock when these stats were calculated

__init__(calculated_at, total_equity, free_cash=None, open_position_count=None, open_position_equity=None, frozen_position_count=None, frozen_position_equity=None, closed_position_count=None, unrealised_profit_usd=None, first_trade_at=None, last_trade_at=None, realised_profit_usd=0, summary=None)#
Parameters:
Return type:

None