TradeSummary#

API documentation for tradeexecutor.analysis.trade_analyser.TradeSummary Python class in Trading Strategy framework.

class TradeSummary[source]#

Bases: object

Some generic statistics over all the trades

TDOO: Cleam this up

__init__(won, lost, zero_loss, stop_losses, undecided, realised_profit, open_value, uninvested_cash, initial_cash, extra_return, duration, average_winning_trade_profit_pc, average_losing_trade_loss_pc, biggest_winning_trade_pc, biggest_losing_trade_pc, average_duration_of_winning_trades, average_duration_of_losing_trades, time_bucket=None, total_trades=None, average_trade=None, median_trade=None, max_pos_cons=None, max_neg_cons=None, max_pullback=None, max_loss_risk=None, max_realised_loss=None, avg_realised_risk=None, take_profits=0, trade_volume=0.0, lp_fees_paid=0, lp_fees_average_pc=0, daily_returns=None, compounding_returns=None, winning_stop_losses=0, losing_stop_losses=0, winning_take_profits=0, losing_take_profits=0, median_win=None, median_loss=None, sharpe_ratio=None, sortino_ratio=None, profit_factor=None, max_drawdown=None, max_runup=None, average_duration_of_zero_loss_trades=None, average_duration_of_all_trades=None, unrealised_profit=None, average_interest_paid_usd=None, total_interest_paid_usd=None, median_interest_paid_usd=None, max_interest_paid_usd=None, min_interest_paid_usd=None, average_duration_between_positions=None, average_position_frequency=None)#
Parameters:
Return type:

None

Methods

__init__(won, lost, zero_loss, stop_losses, ...)

display()

Create human readable summary tables and display them in IPython notebook.

format_bars(duration_timedelta)

format_duration(duration_timedelta)

format_summary_dataframe(df)

Format the summary dataframe for display in Jupyter notebook with clickable links.

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

get_trading_core_metrics()

Get metrics displayed on a equity curve benchmark tooltip.

help_links()

schema(*[, infer_missing, only, exclude, ...])

single_column_dfs(*dfs)

to_dataframe([format_headings])

Creates a human-readable Pandas dataframe summary table from the object.

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

Attributes

won

lost

zero_loss

stop_losses

undecided

realised_profit

open_value

Value at the open positinos at the end

uninvested_cash

Cash at hand at the end

initial_cash

extra_return

duration

average_winning_trade_profit_pc

average_losing_trade_loss_pc

biggest_winning_trade_pc

biggest_losing_trade_pc

average_duration_of_winning_trades

average_duration_of_losing_trades

time_bucket

total_positions

win_percent

lost_percent

return_percent

annualised_return_percent

all_stop_loss_percent

lost_stop_loss_percent

all_take_profit_percent

won_take_profit_percent

average_net_profit

end_value

total_trades

average_trade

median_trade

max_pos_cons

max_neg_cons

max_pullback

max_loss_risk

max_realised_loss

avg_realised_risk

take_profits

trade_volume

lp_fees_paid

lp_fees_average_pc

daily_returns

advanced users can use this property instead of the provided quantstats helper methods

compounding_returns

winning_stop_losses

losing_stop_losses

winning_take_profits

losing_take_profits

winning_stop_losses_percent

losing_stop_losses_percent

winning_take_profits_percent

losing_take_profits_percent

median_win

median_loss

sharpe_ratio

sortino_ratio

profit_factor

max_drawdown

max_runup

average_duration_of_zero_loss_trades

average_duration_of_all_trades

unrealised_profit

Profit in open positions at the end

average_interest_paid_usd

total_interest_paid_usd

median_interest_paid_usd

max_interest_paid_usd

min_interest_paid_usd

average_duration_between_positions

average_position_frequency

open_value: float#

Value at the open positinos at the end

uninvested_cash: float#

Cash at hand at the end

daily_returns: Optional[Series]#

advanced users can use this property instead of the provided quantstats helper methods

unrealised_profit: Optional[float]#

Profit in open positions at the end

get_trading_core_metrics()[source]#

Get metrics displayed on a equity curve benchmark tooltip.

See :py:func:``tradeexecutor.analysis.grid_search._get_hover_template`.

Returns:

Preformatted dictionary

Return type:

Dict[str, str]

to_dataframe(format_headings=True)[source]#

Creates a human-readable Pandas dataframe summary table from the object.

Return type:

DataFrame

static format_summary_dataframe(df)[source]#

Format the summary dataframe for display in Jupyter notebook with clickable links.

Parameters:

df (DataFrame) – The dataframe to format.

Returns:

Formatted dataframe with clickable links.

Return type:

DataFrame

display()[source]#

Create human readable summary tables and display them in IPython notebook.

__init__(won, lost, zero_loss, stop_losses, undecided, realised_profit, open_value, uninvested_cash, initial_cash, extra_return, duration, average_winning_trade_profit_pc, average_losing_trade_loss_pc, biggest_winning_trade_pc, biggest_losing_trade_pc, average_duration_of_winning_trades, average_duration_of_losing_trades, time_bucket=None, total_trades=None, average_trade=None, median_trade=None, max_pos_cons=None, max_neg_cons=None, max_pullback=None, max_loss_risk=None, max_realised_loss=None, avg_realised_risk=None, take_profits=0, trade_volume=0.0, lp_fees_paid=0, lp_fees_average_pc=0, daily_returns=None, compounding_returns=None, winning_stop_losses=0, losing_stop_losses=0, winning_take_profits=0, losing_take_profits=0, median_win=None, median_loss=None, sharpe_ratio=None, sortino_ratio=None, profit_factor=None, max_drawdown=None, max_runup=None, average_duration_of_zero_loss_trades=None, average_duration_of_all_trades=None, unrealised_profit=None, average_interest_paid_usd=None, total_interest_paid_usd=None, median_interest_paid_usd=None, max_interest_paid_usd=None, min_interest_paid_usd=None, average_duration_between_positions=None, average_position_frequency=None)#
Parameters:
Return type:

None