Automation is harder than what it seems
👋 Hey there, Pedma here! Welcome to this free edition of Trading Research Hub’s Newsletter. Each week, I release a new research article with a trading strategy, its code, and much more.
Join over 5K+ readers of the newsletter!
I trade really low frequency trend models in crypto.
That means a lot of time doing nothing, when it comes to the execution part of trading.
Last summer I got bored, and decided to build a multi-strategy portfolio manager from scratch.
The main motivation was to show people that it can be built in a relatively short amount of time, if you know what you’re doing.
Obviously this is a simple model, as the complexity scales, so will the need for better technology.
Which we’ll get into later in this article.
Below is a draft of what it looked like, when I paused it.
The initial task was actually getting the strategies right?
I built 6 strategies.
3 momentum strategies
3 mean reversion strategies
The strategies were simple, both groups of strategies were uncorrelated to each other, and they had a decent chance to work.
Today I’d change a few things about them, but they were fine.
Here’s their performance put together, had I traded them (I just ran the old portfolio code).
Here’s a few lessons I’ve learned on the job, that are usually not talked about, that I think might be valuable to you:
Make sure that you make a clear distinction between shorts and longs when trading multiple assets, and multiple strategies. It is reasonable to expect that sometimes one model will give a long signal, and another might have a short signal, on the same asset. This means that if you execute both orders, you will be closing the long from one strategy, and depending on the size from the long, either open a smaller short, or no short at all. Make sure that you either trade different sub-accounts, different instruments, or factor in your model when strategies overlap.
Keep very good track of open and closed positions per strategy. One of the problems with managing a multi-strategy portfolio, is inventory management. Let’s say that you have 6 strategies in 1 portfolio, and all of them have different weights associated to 1 asset. How are you going to exit the appropriate size when strategy X, with 24% weight, sends an exit signal? You need really good inventory management backing your code.
Be careful with capital that you have available for each trade. Why is this important? Because if you take the capital you have available at any given time, depending on the broker, it can mean different things.
Is it free capital? Then you’re weighing your positions on what you have left, rather than the total capital in the account.
Is it total capital? Now you’re weighing the positions on the total capital you have, taking into account the unrealized profits/losses you have right now. Have you taken that into account in the model? Because that can have an heavy impact on your backtested performance.
Handling multiple types of models. Imagine that you have a trend-following model, and a mean reversion model, running at the same time. The trend model might not even have a stop loss, and the mean reversion model might have both stop loss and take profit. How are you going to check if the trades for the same asset are closed, depending on their order types? This is a more difficult problem to handle than most people think.
There’s a lot more stuff that goes into building a live model, but I don’t want to bore you with the details.
I started to have a lot of issues when the market became more volatile.
One day I was at this restaurant, enjoying a nice evening at the beach.
When my phone starts pinging.
The models were getting errors when sending an order to exit a position.
I quickly went to the exchange app on my phone, exited the positions and continued enjoying my day.
There’s a problem though.
When I built the backend, I didn’t factor in manual intervention.
So my model was assuming wrong open positions, for wrong strategies.
I found out that my infrastructure was like a chain, that if broken, at any point, the whole system collapses.
A big headache to deal with.
Add to those problems, the ones coming directly from the exchange I was using, and I was spending more time on infrastructure, than my own research and trading.
I got too frustrated.
And paused the project.
Then come September, the market got hot again, my main trend model was making a lot of money, and the best “bang” for my time was to allocate it there.
That was a good decision looking back.
I probably couldn’t have managed it all at the same time.
I am just 1 person, I don’t have a team.
And by focusing my attention on the main model, I was capturing a lot more returns than fixing bugs on code.
We can always go back to projects, we can’t ever get back a great period in markets.
They are rare, and arrive randomly. You need to make sure you are prepared and running at peak performance when they are here.
But these past few months, the markets have cooled down, so I decided to start that project again.
I am building the infrastructure again from scratch and I’ve written these two initial articles on the progress.
As usual, I don’t shy away from a challenge, and I’ll be sharing the journey publicly.
Fail or succeed, it will be in the public domain, for people to extract lessons from.
I do see the potential here to become a much larger project, and eventually have this infrastructure managing my main portfolio.
My goal is full transparency, and in the meantime, build that portfolio of work, that I’ll use to launch my own fund.
I think it would be awesome, and the first one, to document the journey there.
I hope you join the ride!
To help you really speed up your learning curve, I’ve decided to open a few spots to one-on-one coaching, to share my knowledge and passion for trading, with you. I’ll show you exactly how you can go from unprofitable, to profitable trading, as I did.
If you’re an individual or enterprise, feel free to book a call:
Disclaimer: The content and information provided by the Trading Research Hub, including all other materials, are for educational and informational purposes only and should not be considered financial advice or a recommendation to buy or sell any type of security or investment. Always conduct your own research and consult with a licensed financial professional before making any investment decisions. Trading and investing can involve significant risk of loss, and you should understand these risks before making any financial decisions.