There's one good thing that came out of this lockdown: it gave me unprecedented amount of creative-time. One side-project than ran out of excuse was algorithmic trading.
The logic was if I had the time to play games I might as well spend it on something more lucrative. It's a faulty logic that doesn't count on losing money, but you gotta tell yourself something get things moving.
The conception of it felt like about one-month worth of work, from drawing board to having it run on staging in sandbox mode, uncover the bugs and finally feel safe enough to have it run in production.
By now it's about three months and here's some findings that surprised me.
It's not buy/sell signals
It's about risk management. Amateur discussions about algo-trading typically revolve around how to find enter and exit positions via technical indicators.
There are more technical indicators available than you have room to use. All of them are wrong some of the time.
Using them in software is almost trivial given the right library.
So not much thought juices was spent here but rather in preparing for scenarios where things don't go my way.
There are more code spent on managing how much capital to risk for each trade, how to not over invest in one single asset, managing opened trades, etc.
In fact to call it algorithmic trading at this point is a delusion of grandieur. Decision-making is sufficiently simple that algorithm here is nothing more than a collection of nested if/else strung together in a way that doesn't breakdown. And rightfully so.
Market-making to regular buy-low-sell-high
The aspiration started off trying to do low-risk automated market-making. It didn't take long for me find out that was rather naive. Since I play in the crypto space and there exist automated market-makers like Uniswap, there's no point risking more by coding one of my own for lesser profit.
That or I wasn't doing it right. Either way I transitioned to a vanilla buy-low-sell-high price-action algo and that worked out fine.
The software wasn't difficult
It wasn't easy but it's manageable. Finance is my zone of discomfort so the software bit turn out to be almost pleasant.
Furthermore, starting from scratching always come with the upside of having no technical debt. This won't be true a year down the line.
When it comes to engineering, as long as conceptual integrity is intact, object-orientation isn't going to fight too hard against you.
At this point, making it deterministically testable remains to be challenging. Unit tests atomic enough are great to do, but having sufficient coverage for the entire trading algo is hugely cumbersome and questionable in return-of-effort.
Staging sandbox is dubious
Staging environment run against sandbox environment provided by the exchange. In my case the sandbox is hardly reflective of the real world in market action.
It was good enough to me that my instructions to the exchange is valid, but you can't count on their prices and orders to real enough to test your profit-ideas against.
These are not surprises but mind-games that I got right from the get-go.
There will always be flaws
Improving it will be a work of lifetime.
Accept what the algo is designed to do, don't try to force it to play in markets that it's not good at.
Keeping it simple is difficult
Simplicity in algorithm is an advantage. Complexity can fatal when it comes to a point when it's no longer adaptable to any change because it's not understandable and has to be discarded for losing money.
But despite your efforts to keep it simple, there will be temptations to add rules for optimization. These rules will invite ever more new rules.
Early success ruins
It's psychologically damaging to win big from the get go. It normalizes anomalous profit and gives you the illusion of skill when it's luck.
Against a favorable market any idiot makes money. Thinking that you got the algo right in that condition leads to certain death.
You can't not have a macro framework
The algo is a micro implementation of a macro play. Deciding how much capital to allocate to one trading-bot is an expression of your opinion how it stacks up against other portfolio allocation.
An algo micro manages money based on pure data without opinion. But you as a human manages the bot knowing its inclinations.
That can't be done without having opinions, whether you know it or not.
This is parenthood
You teach your child what to do and then let it out in the wild doing it with unpredictable results.
When your child screws up, sometimes it's a function of the wrong environment, sometimes you are to blame.
How receptive the child/bot to your teaching is also your doing.
The teaching doesn't end, provided you have anything to impart to begin with.