ExPostFacto.Result (ex_post_facto v0.2.1)
View SourceThe result contains the output of applying a strategy to a set of data.
Summary
Functions
@spec add_data_point( result :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() }, index :: integer(), datum :: map(), action :: ExPostFacto.action() ) :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() }
@spec compile( result :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() }, options :: keyword() ) :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() }
@spec comprehensive_summary( result :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() } ) :: map()
Returns a comprehensive summary of all statistics as a map.
This provides a clean view of all calculated metrics without the internal data structures like data_points and trade_pairs.
@spec new(starting_balance: float(), start_date: String.t(), end_date: String.t()) :: %ExPostFacto.Result{ alpha: term(), annual_volatility: term(), average_draw_down_duration: term(), average_draw_down_percentage: term(), average_losing_trade: term(), average_trade_by_percentage: term(), average_trade_duration: term(), average_winning_trade: term(), best_trade_by_percentage: term(), beta: term(), cagr_pct: term(), calmar_ratio: term(), data_points: term(), duration: term(), end_date: term(), expectancy: term(), expectancy_pct: term(), gross_loss: term(), gross_profit: term(), information_ratio: term(), is_position_open: term(), kelly_criterion: term(), kelly_interpretation: term(), largest_losing_trade: term(), largest_winning_trade: term(), market_correlation: term(), max_draw_down: term(), max_draw_down_duration: term(), max_draw_down_percentage: term(), max_trade_duration: term(), profit_factor: term(), sharpe_ratio: term(), sortino_ratio: term(), sqn: term(), sqn_interpretation: term(), start_date: term(), starting_balance: term(), total_profit_and_loss: term(), total_return_pct: term(), tracking_error: term(), trade_pairs: term(), trades_count: term(), win_count: term(), win_rate: term(), worst_trade_by_percentage: term() }
Creates a new result struct.