Comparing v1 versus v1 Code

Those of you following the development branch will have noticed quite a bit of activity starting in November 2022. Finally, we are pushing to get the v2 engine out of the door!

Maximizing productivity has always been the key push behind the TuringTrader project. But ultimately, there is only one way to prove that we are on the right path: By implementing plenty of algorithms. Compare how the code changed for the following algorithms:

Strategyv1 codev2 code
Lazy Portfolios262 lines215 lines
Livingston's Muscular Portfolios362 lines319 lines
Clenow's Stocks on the Move325 lines287 lines

It is worth noting that we compared heavily commented code, so the actual savings are more significant than the table suggests. Nonetheless, on all examples the v2 code is more concise.

Unfortunately, migrating from v1 to v2 code is something that will consume some of your time. Initially we were considering to make the v2 APIs compatible with v1, but abandoned that idea later on. Because of the different paradigms, there is more to consider than just the syntax, and pretending nothing has changed seemed a dangerous approach.

However, to make code migration as painless as possible, we added layers to make v1 and v2 code forward and backwards compatible. Most importantly, v1 code can instantiate v2 sub-strategies and vice versa. That way, you can migrate your code one strategy at a time.

Stay tuned and happy coding!