Devlog #1 - Contango
I have finally released Contango on PyPI!
What is Contango?
Contango is a full trading engine that helps you build trading strategies. It does all of the heavy lifting - the results, metrics, and the entire trading engine behind the hood.
I’ve never created a package on PyPI, so doing this was a massive learning experience - from uploading to TestPyPI to iterating multiple times before I got my pyproject.toml right.
I sent one of the graphs generated after testing my project demo out using the package.
See the package on PyPI here: https://pypi.org/project/contango/
Have a great rest of your day!
Comments 7
wow
the problem is that it’s going to fit the model on the training data… I recommend reading “Advances in financial machine learning” from Marcos Lopez de Prado, he explains it in a way better way than me
oh, this does not use machine learning at all. its a tool for people to make strategies themselves.
No that is not what I meant. Even with manually created strategies, there is a mathematical open problem that can be resumed like this : so long that you try to optimize a trading strategy, you have to consider it as if it passed because it just so happen to have better performed on that specific test data, which is called (over)fitting, and can perform poorly in live test. Usually, when working with data, fitting is really not a problem, but trading charts have a very low signal to noise ratio which makes so testing even a few dozens strategies can already heavily skew the results
The book also provides solutions, if you want I can explain in greater detail
I’ve never read the book (nor have heard of Marco Lopez de Prado), but I’m definitely interested. Regarding overfitting, I’ve attempted to construct my graphs in a way that discourages isolated optima when running parameterized backtests - that is, looking for trends & patterns rather than the highest results in a subset. That said, I see this as addressing parameter optimization (bollinger band stdev, EMA period, etc.), not overfitting in the broader sense. It doesn’t protect against things like choosing a favorable (or small) time period, selecting specific tickers, or comparing many different strategy ideas until one happens to work when there’s no actual edge.
Anyway, I do not know everything about this; I’d love for you to explain it in greater detail and give any feedback on protecting against overfitting.
So I haven’t checked the codebase much but I guess it used backtesting ? You can also implement this testing method called “Walk Forward Analysis” : https://en.wikipedia.org/wiki/Walk_forward_optimization (the article also mentions overfitting and its complexity)
Sign in to join the conversation.