Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backtest on multiple stocks & aggregate results #468

Answered by AGG2017
atakanokan asked this question in Q&A
Discussion options

Is there a way to test the same strategy on multiple stocks and show the aggregate of results from run() ? If not, the best way possible seems to be to use the stats returned from .run() and aggregate them manually.

You must be logged in to vote

For me there is no big difference how you will interpret the results. The main method is to loop the run over several tickers, get the results and accumulate them in one pandas series object, like the index is the stock list, the columns are the stat result (all or selected one), and with pandas you can have all statistics over the result from one strategy for your list of stocks (averages, standard deviation, max/min, etc.). Repeat this for all you strategy and finally you can compare the result statistics from all series.

Replies: 2 comments

Comment options

I think the difference between your method stems from the fact that I want to compare strategies’ overall performance on multiple tickers vs compare how each strategy performs on each ticker. So I would have to take average of -for example- Max DD and Sharpe Ratios of all tickers for Strategy no1 and compare it to the average of all SR from Strategy no2. I guess the solution is the same as you suggested where I have to take averages per field for each strategy and sort+compare From: @AGG2017 You can loop the run over a list of stocks, to collect the stats in a list and then to sort that list by different criteria to find the best matches for this strategy. Even the results can be exported to excel for further analysis and presentations. What exactly do you mean by aggregation other than comparing by sorting?
You must be logged in to vote
0 replies
Comment options

For me there is no big difference how you will interpret the results. The main method is to loop the run over several tickers, get the results and accumulate them in one pandas series object, like the index is the stock list, the columns are the stat result (all or selected one), and with pandas you can have all statistics over the result from one strategy for your list of stocks (averages, standard deviation, max/min, etc.). Repeat this for all you strategy and finally you can compare the result statistics from all series.

You must be logged in to vote
0 replies
Answer selected by atakanokan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /