18 Comments

Beautiful code <3

Expand full comment

Thanks :)

Expand full comment

Unfortunately IBKR's API is flawed and inconsistent, there are a lot of workarounds needed to make a robust trading with IBKR

Expand full comment

Yes, you are correct. We need to "babysit" the execution to ensure everything works as intended

Expand full comment

Super cool. Thanks for sharing this. I'll have to give this a try.

As for alternate approaches for go-live: have you considered using the LEAN framework from QuantConnect? It's quite robust, and even though it's 3rd party, it's open source so you can see under the hood.

Expand full comment

Thanks! Yes, I took a look at the LEAN documentation.

While reading their docs, I got the feeling of a "convention-over-configuration" paradigm (which is something I usually don't like).

Also, I found native IBKR API's documentation more developer-friendly to me.

In the end, it's just a matter of personal preference. At least for me, if I need to invest time and energy to learn something, I usually prefer going to the source instead of learning abstractions. But that's me :)

Expand full comment

Great article. Question : how much deviation would you accept between backtest results and live testing results to conclude that this strategy is ready to go live? Thanks

Expand full comment

That is a great question. I'm usually more strict with trade stats (expected return/trade, win ratio, payoff ratio, etc) and less with overall metrics (total return, Sharpe, etc). That's because these overall metrics vary a lot throughout history.

Expand full comment

Perhaps please do an article on stats that matter in back testing and (or) forward testing. When should someone take a strategy live? What metrics matter?

Expand full comment

I have a side question, so you are Carlos Mata? 🧐

Expand full comment

I’m Carlos Souza. Carlos Mata is a good friend, though :)

He is a quant trader too… and he also shares some of his strategies. However, he is more focused on futures, while I tend to focus on equities

Expand full comment

Both Carlos are very good!

Expand full comment

Thanks heaps!

Expand full comment

Your best post! Keep it up!

Expand full comment

Thanks :)

Expand full comment

Have you tried QuantConnect? I have gotten their standard subscription and planning to implement your strategy there to see if takes a good amount of load off of me. But I wanted to see if you have already given it a shot and hear your opinion if you would care to share.

Expand full comment

Thank you for all the information you provide!

I'm trying to start with backtesting, can you please share what is your system for backtesting? are you using a python lib such as QSTrader? I would love to have a similar article about your backtesting system. Thank you for everything!

Expand full comment

Thanks!

I've used most of the open-source backtesters... after I realized I was spending way more time tweaking them than testing new ideas, I decided to write my own system. That was many years ago, while I was still in my master's degree.

I'm still figuring out what the best format would be for sharing it.

But I will do it soon...

Cheers!

Expand full comment