TradeSummary#
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, 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, 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)#
- Parameters:
won (int) –
lost (int) –
zero_loss (int) –
stop_losses (int) –
undecided (int) –
realised_profit (float) –
open_value (float) –
uninvested_cash (float) –
initial_cash (float) –
extra_return (float) –
average_duration_of_winning_trades (timedelta) –
average_duration_of_losing_trades (timedelta) –
time_bucket (Optional[TimeBucket]) –
take_profits (int) –
trade_volume (float) –
average_duration_of_zero_loss_trades (Optional[timedelta]) –
- Return type:
None
Methods
__init__
(won, lost, zero_loss, stop_losses, ...)display
()Create human readable summary tables and display them in IPython notebook.
format_duration
(duration_timedelta)from_dict
(kvs, *[, infer_missing])from_json
(s, *[, parse_float, parse_int, ...])schema
(*[, infer_missing, only, exclude, ...])single_column_dfs
(*dfs)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
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
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
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
advanced users can use this property instead of the provided quantstats helper methods
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
- daily_returns: Optional[Series]#
advanced users can use this property instead of the provided quantstats helper methods
- to_dataframe()[source]#
Creates a human-readable Pandas dataframe summary table from the object.
- Return type:
- __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, 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, 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)#
- Parameters:
won (int) –
lost (int) –
zero_loss (int) –
stop_losses (int) –
undecided (int) –
realised_profit (float) –
open_value (float) –
uninvested_cash (float) –
initial_cash (float) –
extra_return (float) –
average_duration_of_winning_trades (timedelta) –
average_duration_of_losing_trades (timedelta) –
time_bucket (Optional[TimeBucket]) –
take_profits (int) –
trade_volume (float) –
average_duration_of_zero_loss_trades (Optional[timedelta]) –
- Return type:
None