The Project
Our team is working on a cloud based web application geared towards testing and creating high-performant trading strategies for investors. This project has exposed me to not only new technologies, but new APIs for technologies that I was already somewhat familiar with. I have primarily shifted into creating route handlers for the backend of our web application using Flask. Previously I had very minimal exposure to Flask, having mostly only heard about it. It has quickly become my favorite technology in our stack. On the other hand, working with backtesting.py proved to be challenging for me and I was wildly unsuccessful at using it compared to my peers.
Flask
Having worked with model-view-controller architectures in the past, I was exposed to route handling via JavaScript and was hesitant to make the leap to Python to achieve the same ends. However, I have found that Flask appears to be even easier than JavaScript for setting up routes and getting them to operate properly.
I will be the first to say that I am not a huge fan of JavaScript – I think that its syntax is unintuitive (as well as some of its comparison results). However, I do understand that it is one of the most powerful languages to use when working with web applications. For this reason, I was hesitant to move away from it for route handling for our projects. However, after spending a week working with Flask and trying various things out, I feel that it offers a much more intuitive – but just as powerful – opportunity to handle routes.
A route in Flask is simply a Python function with an @app.route()
decorator attached to it. This decorator takes relative path and request methods arguments and binds them to the application so that they can be reached by others. Then, the request is automatically passed to the function the decorator is applied to and the function executed. This means that with just a handful of lines of code, you can create complex route handling logic that performs whatever task you want. For its intuitiveness and ease-of-use, Flask has become my favorite technology in our stack.
Backtesting
I won’t try to convince anyone that backtesting.py is bad technology – it is a large, highly used project with a lot of great features. I think that our collective experience as a team with backtesting.py was less than ideal because we were trying to reshape its out-of-the-box functionality to meet the specifications that were being supplied to us from another backtesting solution.
This was particularly difficult because of the way that each of the backtesting solutions handled the warm-up period for trades, which is the amount of historical data to use to “warm-up” the backtester. The two libraries used different methods and definitions for these warm-up periods, which ultimately led to the need for manual manipulation of the warm-up data in backtesting.py. In addition, I do not have much background in trading which made learning the library even more difficult, especially as trading-specific terms were used regularly in the documentation.
I don’t believe backtesting.py is a bad technology by any stretch of the imagination, however diving into the weeds of the library turned into a very long ordeal for me – longer than was realistically available for our team to meet our project requirements in the time we have in the capstone courses.
No Bad Technology
I don’t necessarily believe in the idea of “bad” technology – most technologies are developed to be used by one person or another. However, that does not mean that individuals won’t have preferences in what they use. I have enjoyed my time working with Flask much more than I enjoyed my time with backtesting.py. That’s not to say that Flask is better than backtesting.py, it’s just that I have found it much more intuitive and easy-to-use than I found backtesting.py. Perhaps this is because I’m much more familiar with programming and the topics under its umbrella than I am with trading. Either way, I’m glad to have shifted from working on the stock-specific technologies to the more computer science related technologies.