Backtesting in Python
If I want to know how a burger tastes like in a restaurant, I'll go there and eat it. However, let's say I want to know how a burger tasted from a particular restaurant tasted like in 2015? I can't go back in time. Or let's say I want to know how every burger joint tastes like in London today? I could attempt to visit every single burger joint and try it, but it's going to be time consuming and also might have shall we say a suboptimal impact on my cholesterol. The next best thing is do some sort of historical analysis to get access to datasets which have reviews of burger joints, over the past few years, essentially crowdsourcing the task. We could look at the specific ratings given in the reviews, and also use natural language processing on the reviews themselves to gauge sentiment.
When it comes to financial markets trying how to understand how a trading strategy may perform in the future, we could just run it live, like my burger example. However, in practice, just like our burger example we can use some sort of historical data to do a study, to backtest how our trading strategy would have performed...
To read the rest of the article on the Cuemacro website, please go to https://www.cuemacro.com/2021/09/04/backtesting-in-python/
Director of Engineering | Program / IT Manager | Ex-MySpace | Ex-BofA
3 年Saeed Amen very interesting post! Thanks for sharing.
CEO and Founder, AbleBlox and AbleMarkets
3 年I like the opening example very much.
Running a backetest is fine but remember you built and evaluated it in a world where it (your trading algorithm) did not participate. So it did not experience its own #modelimpact
Follow me, I am a professor ?? (all views my own)
3 年You might also consider the very mature R ecosystem for that (from my blog): https://blog.ephorie.de/backtest-trading-strategies-like-a-real-quant
Hands-on tech leader
3 年The only reason to build your own back testing tool is if someone is paying you to do it.