Hey guys,
Just wanted to give everyone an update regarding my strategy. I am finally going to be trading it live!
Overview
The workflow for the entire system is essentially split into 3 parts:
10:30pm SGT (Market Open) - Sell overnight position
4:45am SGT - Run asynchronous database updating script
4:58am SGT - Buy position to hold overnight
The idea of this system was taken from Quant Galore, and is pretty easy to understand. Essentially, we are taking the returns from the past 40 days of all the SPY Sectors as inputs for an ARIMAX model that predicts the returns of SPY on the next day.
I am using options, i.e. buying a 1DTE ATM call/put at 4:58am SGT, 2 mins before the market closes in order to capture the returns without killing myself from theta decay. Naturally, the codes also account for situations when there is a holiday on the next day, where the option chosen will range from 2-7 DTE.
Backtest
Running a backtest yielded these results (PnL is based on buying 1 stock as opposed to buying the 1-7DTE ATM Call/Put). We can see that the graph for fixed rolling window period = 40 gave us the most consistent results, so I decided to just roll with it (pun intended).
If anyone reading this would like to know more, or would like to have access to the codes. Do let me know! Everything is still a work in progress, but I feel safe to say that it is a v1.0 now at least.
Issues Faced
The whole build process was pretty enriching, and helped me gain more knowledge as a dev/trader/researcher.
I had to learn about asynchronous functions in order to get the database working.
I also had to deal with the changes with yfinance (which was a real pain in the ass).
Finding a broker with properly documented APIs for algorithimic trading, particularly with options wasn’t easy, but I eventually landed on Moomoo, which is a pretty popular brokerage in Singapore and HK/China. I used to have an account with them during my degen manual trading days, and it just felt easy to add money into the account. Their API is also reasonably easy to understand, though, you definitely have to spend some time to learn the syntax.
I also used Databento’s Live Streaming data services in order to update my local database (Sqlite3) on the 1min OHLCV prices for SPY and its other sectors as its much much much cheaper than subscribing to Moomoo’s live data subscription service.
Despite encountering so many problems, I am super duper stoked about implementing this live. This is my 2nd ever algo, which has gone through various different iterations to get to this stage. I would love to share the results with everyone a few weeks from now!
Thank you for reading, and I’ll see you in the next one!
Sincerely,
Ian Chen - a struggling soon-to-be graduate who hasn’t secured a FT job yet and is currently panicking a little.
Side Note: To be honest, it seems a little hard to imagine someone reading these articles that I publish sporadically, and I thank you from the bottom of my heart for taking time out to read my content. Life hasn’t been easy recently; my grandfather has been in and out of the hospital, my dad has been showing signs of early Alzheimer's and I just got rejected by one of the companies I thought I had the biggest chance of getting in at the 2nd last round of interviews. Abysmal, to say the least. Nonetheless, I try not to let these things get me down as I continue to focus on implementing trading algos, which has been my interest for the past couple of years.
Feeling overwhelmed by all the trading noise? ThunderAlgo simplifies it for you. Our TradingView indicator delivers automatic buy/sell signals, taking emotions out of the equation and making trading effortless. Plus, we ensure full transparency by showing the indicator’s win rate, so you know exactly how it performs. Ready to trade smarter? Visit us today!