10 Comments
Oct 20Liked by Quantitativo

What backtesting library you are using?

Expand full comment
author

Many, many, many years ago, I implemented a backtest engine in Python for my master’s degree… it’s an event-driven engine (they are slower than the vector-based engines but imho they are easier to write strategies for, understand and debug) with all blows and whistles, similar to the late Zipline (but with multi-asset capabilities). In fact, I tried most of the Python backtest engines that exist, and that’s why I prefer to use what I built over the years: I have 100% understanding of what’s happening and 100% control. I’m thinking about sharing it...

Expand full comment
22 hrs ago·edited 22 hrs agoLiked by Quantitativo

IMO, a big advantage of event driven engines is their readiness for production / actual trading with minimum code modification required. It would be great if you could share yours.

Expand full comment
author

I'll probably do it in the near future. However, I'm currently swamped with work and need to find time to do it properly.

Yes, event-driven engines are more ready, I agree. Nevertheless, at least in my experience, the production code needs to be carefully adapted to the broker's API (I'm not sure about the word "minimum" :)). Otherwise, we might get slippage, partial fills, all kinds of bugs, etc...

Expand full comment
Oct 19Liked by Quantitativo

You may be waiting some time after the bell for a subset of opening prints, especially if there is a gap down. It might be asking too much to collect all prints, then order by vol to select your orders, then place orders. Maybe take a couple quarters of earnings to test before you take the next steps. Happy trading

Expand full comment
author

That is the secret. The tradeoff I mentioned. It’s anything between milliseconds to 5 minutes :)

Expand full comment
Oct 19Liked by Quantitativo

Great job! So you actually cannot try to replicate this as an EOD only strategy when you have to evaluate the open for the gap, right?

Expand full comment
author

Thanks! Yes, you are right: this strategy hinges on evaluating the openings for the stocks in our tradable universe (S&P 500 constituents)

Expand full comment
Oct 19Liked by Quantitativo

Did you try ranking by gap% to fill your slots or only use the threshold (Anything above the specified percent) with lowest volatility?

Expand full comment
author

Threshold with lower volatility. Ranking by % didn’t make sense to me because they are not directly comparable between stocks. Example (exaggerated to make the point):

- stock A opened with a 1% gap. Its vol is 2%;

- stock B opened with a 2% gap. Its vol is 20%.

To me, intuitively, A is a much better opportunity that B, although B’s gap % is absolutely wider than A’s.

But maybe I’m wrong. As it didn’t make sense to me I didn’t even look into it…

Expand full comment