StrategySummaryStatistics#

API documentation for tradeexecutor.strategy.summary.StrategySummaryStatistics Python class in Trading Strategy framework.

class StrategySummaryStatistics[source]#

Bases: object

Performance statistics displayed on the tile cards.

__init__(calculated_at=<factory>, launched_at=None, first_trade_at=None, last_trade_at=None, enough_data=None, current_value=None, profitability_90_days=None, return_all_time=None, return_annualised=None, compounding_unrealised_trading_profitability=None, performance_chart_90_days=None, share_price_returns_90_days=None, nav_90_days=None, key_metrics=<factory>, backtest_metrics_cut_off_period=None, cycle_duration=None)#
Parameters:
Return type:

None

Methods

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

When these stats where calculated

launched_at

When this trade executor was launched first time.

first_trade_at

When this strategy truly started.

last_trade_at

When was the last time this strategy made a trade

enough_data

Has the strategy been running 90 days so that the annualised profitability can be correctly calcualted.

current_value

Total equity of this strategy.

profitability_90_days

Profitability of last 90 days

return_all_time

All time returns, %

return_annualised

Annualised returns, %

compounding_unrealised_trading_profitability

Performance chart used in the summary card.

performance_chart_90_days

OLD Data for the performance chart used in the summary card.

share_price_returns_90_days

Display the strategy returns as the function of the share price

nav_90_days

Display total value locked (NAV) for the last 90 days

key_metrics

Strategy performance metrics to be displayed on the summary card

backtest_metrics_cut_off_period

After which period the default metrics will switch from backtested data to live data.

cycle_duration

Duration of each trade cycle

calculated_at: datetime#

When these stats where calculated

launched_at: Optional[datetime]#

When this trade executor was launched first time.

If the trade-executor needs reset, this value is reset as well.

first_trade_at: Optional[datetime]#

When this strategy truly started.

We mark the time of the first trade when the strategy started to perform.

last_trade_at: Optional[datetime]#

When was the last time this strategy made a trade

enough_data: Optional[bool]#

Has the strategy been running 90 days so that the annualised profitability can be correctly calcualted.

current_value: Optional[float]#

Total equity of this strategy.

Also known as Total Value locked (TVL) in DeFi. It’s cash + open hold positions

profitability_90_days: Optional[float]#

Profitability of last 90 days

If enough_data is set we can display this annualised, otherwise we can say so sar.

Based on Compounding realised positions profit.

return_all_time: Optional[float]#

All time returns, %

Based on Compounding realised positions profit.

return_annualised: Optional[float]#

Annualised returns, %

Based on Compounding realised positions profit.

compounding_unrealised_trading_profitability: Optional[List[Tuple[float, float]]]#

Performance chart used in the summary card.

  • Contains frequenetly snapshotted performance

Contains (UNIX time, performance %) tuples.

performance_chart_90_days: Optional[List[Tuple[float, float]]]#

OLD Data for the performance chart used in the summary card.

  • Contains only samples at position close events

Contains (UNIX time, performance %) tuples.

Relative performance -1 … 1 (100%) up and 0 is no gains/no losses.

One point per day. Note that we might have 90 or 91 points because date ranges are inclusive.

Based on Compounding realised positions profit.

share_price_returns_90_days: Optional[List[Tuple[float, float]]]#

Display the strategy returns as the function of the share price

nav_90_days: Optional[List[Tuple[float, float]]]#

Display total value locked (NAV) for the last 90 days

key_metrics: Dict[str, KeyMetric]#

Strategy performance metrics to be displayed on the summary card

We use KeyMetricKind value as the key.

backtest_metrics_cut_off_period: Optional[timedelta]#

After which period the default metrics will switch from backtested data to live data.

This mostly affects strategy summary tiles.

cycle_duration: Optional[CycleDuration]#

Duration of each trade cycle

__init__(calculated_at=<factory>, launched_at=None, first_trade_at=None, last_trade_at=None, enough_data=None, current_value=None, profitability_90_days=None, return_all_time=None, return_annualised=None, compounding_unrealised_trading_profitability=None, performance_chart_90_days=None, share_price_returns_90_days=None, nav_90_days=None, key_metrics=<factory>, backtest_metrics_cut_off_period=None, cycle_duration=None)#
Parameters:
Return type:

None