Developing "Spartan"

Just completed a huge refactoring owing to me wanting to trade stocks, futures as well as options on the same.

Well, it wasn't really huge. It just felt huge. I knew it was coming because there was hard-coding of certain things which I think @HobbyTrading mentioned. Took a few hours, code is much, much better, everything still works.

Lines of code still manageable:

View attachment 216720

It always seems easier to write from scratch than refactor. Several years into pysystemtrade later....

GAT
 
It always seems easier to write from scratch than refactor. Several years into pysystemtrade later....

Don't worry, everyone does this at least once. Twice if they are especially stubborn! https://en.wikipedia.org/wiki/Second-system_effect

I know that feeling: refactoring existing code seems a huge task with a high hurdle before you start. But after you’ve completed it you feel satisfied and wondered why it took so long before you started it.
I don’t recall mentioning something that could benefit from refactoring though.

You (or someone) said something to the effect of it will be problematic to implement new types of entries/exits because they were hard coded. Which I was worried about, but it wasn't that big of a deal in the end!
 
The one thing I do need to figure out is how best to stitch together a continuous futures contract for backtesting/research. Found this page which looks like a good approach: https://www.quantstart.com/articles/continuous-futures-contracts-for-backtesting-purposes/

I seem to recall GAT had this in one of his books a well but I forgot which so I guess I'll have to reinvent it poorly.

It's in appendix C of Leveraged trading, or https://qoppac.blogspot.com/2015/05/systems-building-futures-rolling.html, or https://github.com/robcarver17/pysystemtrade/blob/master/sysdata/futures/roll_calendars.py.

GAT
 
I seem to recall GAT had this in one of his books a well but I forgot which so I guess I'll have to reinvent it poorly.
I use the method which GAT calls the”Panama stitching method”. In this method the individual contracts are offset with a value to stitch them to the next contract. I think I learned this approach from his blog; can’t remember whether it is described in his Systematic Trading book.
 
I use the method which GAT calls the”Panama stitching method”. In this method the individual contracts are offset with a value to stitch them to the next contract. I think I learned this approach from his blog; can’t remember whether it is described in his Systematic Trading book.

Yes, to clarify: Panama is included in Systematic Trading, but not in so much detail. Leveraged Trading includes a row by row table illustrating how it works. Or you can read the blog.

GAT
 
Java

giphy.gif


:D
 
Last edited:
BTW don't take my mocking of Java seriously, I think it's a great productive language/ecosystem. Especially recently when they've been taking ideas on how to un-enterprise various things.
 
Back
Top