# Algorithmic Day Trading as a Yield-Generating Product

*Today’s “Long Story Short” covers how an automated crypto strategy could be treated as a yield-generating investment. This **Kollider** educational series is not financial advice. Please do your own research.*

With the popularity of “yield farming”, the crypto market is abuzz with both traders and investors seeking the best places to put their digital money to work to get a good yield. There are so many newfangled alternatives — like staking or lending, or even newer products like Lightning Pool — that it is important to look at the entire landscape. There’s one viable option that most people don’t even consider: algorithmic day trading strategies.

**Using Backtests to Convert Algo Strategies**

Before we begin, let’s clarify what we mean by something yield-generating. In order for a product to be yield-generating, it must satisfy two conditions:

**Has an expected return on capital that we can estimate.**This does not mean that it is riskless. Even the safest of investments can result in potential loss, even if just in purchasing power. It also does not mean indefinite, just as other yield instruments have a duration.**Mostly passive operation once money is put in.**While we would ideally want zero maintenance, we’ll loosen this property, as a lot of the better yields in crypto (as any “farmer” might tell you) require some proactivity and activity.

So, how can an active day trading strategy possibly be considered a yield product? In the simplest terms, we force a structure to make it look like a yield instrument using backtesting. But the details are a little more complicated, so let’s dig deeper.

First, let’s review how we think about backtesting and algorithmic trading. In a previous, *Long Story Short*, we talked about this type of trading and laid out five steps when backtesting. We keep to this process as it lets us approach strategy building and optimisation iteratively. We encourage you to read that article again, but we’ll largely highlight #3 (running strategies on different settings) and #4 (scoring the performance) here. Not only that, but we can use these two to train certain properties into our algorithmic models.

# Stabilizing the Strategy P&L Returns

In particular, we want to ensure a level of stability in the returns and P&L of any running model. We do so by modifying how we measure the trading model’s score in the backtest. In addition to the usual P&L returns, we’ll also use two more metrics:

**The backtest daily sharpe ratio.**This variation of the sharpe ratio is commonly used by HFT firms. It calculates the average daily return over its standard deviation (note: we’re ignoring the risk-free rate term here). Or more simply, a daily sharpe ratio of 1 implies that we can reasonably expect that our strategy configuration in production can make between 0 and double the average daily return from backtest. The higher the daily sharpe ratio increases, the better and the more likely we would expect to get closer to the average daily return from our backtest results.**The backtest traded volume.**Although this is related to the sharpe ratio, we can often expect more signal than noise if our strategies are trading a lot in backtest vs making one or two trades (i.e., law of large numbers). This is why we focus on “day trading” on purpose. This high-frequency subset generally has a high number of trades in a day, with smaller positions and shorter holding periods.

Now we understand how to measure performance, but we still have to figure out how to get our strategy to actually achieve higher scores. This is where step #3 in the five backtesting steps comes in.

Namely, we’ll have different sets of configurations for our strategy’s parameters to encourage higher volume, smaller positions, quicker stop losses, and shorter holding times. It’s inevitable that we’ll see losses while trading, but we still want to reduce the number and magnitude of those drawdowns as much as possible. Ideally, we want to find a strategy configuration with a P&L chart like in Figure 1.

So, how do we actually set parameters to encourage that behaviour? It’s fairly customised for each strategy, so it’s easiest to illustrate this with an example. Any strategy is a good candidate, as they could all theoretically be tuned to have the desired properties.

# Demonstrating Yield Through Market Making

Let’s use market making to show how we can do this. Here are changes we might make for our three strategy variables (and two new ones we’ve added to try to reduce drawdown sizes):

**Reference Price.**As in our backtesting trading article, let’s assume this is a moving average of recent orderbook mid-prices of some time window. In order to encourage a higher number of trades and volume, we would ideally want this to be faster. So, we’d want to throw in lower values here. Perhaps that means we’d need lower parameter values such as 5 and 10 min vs 1, 6, or 12 hours.**Offset.**Given the shorter time windows for the reference price calculation, we’d also want to get closer to the average. So, we’ll likely have much lower numbers for the offset parameters. There’s no hard-and-fast rule here, but 1–50 basis points probably would be more desirable than >= 500 bp.**Lean.**Similarly, we would probably want shorter holding times and take winners sooner than later. The lean algorithm can differ dramatically. However, let’s assume a basic version with two parameters that control at what position we start leaning and how far back or forward, depending on the position. We may want to consider leaning forward the side that takes us out of a position sooner and more aggressively, even if that means taking a smaller win, but at a much earlier time.**Max Position.**This new parameter lets us cap our max position. Because we are expecting a good amount of turnover for our position due to parameter settings proposed for the reference, offset, and lean, we can keep the max position values smaller. This also helps us determine how much capital can be put into each configuration of the strategy.**Max Loss Threshold.**This new parameter triggers a new execution behaviour. Let’s assume it’s effectively two parameters: if we have a losing position hit the max loss threshold (first parameter), we will reduce our position (second parameter). To reduce the size of drawdowns, we may want to experiment with lower values for both parameters to cut losses sooner and to get down to a much smaller position in case the price movement against us continues.

With those, we now have our sets of parameter values that encourage a higher number of traders, smaller losses, faster wins, etc. That will hopefully result in higher daily Sharpe ratios.

Once we run those multiple configurations of the strategies through backtests, we’ll get variations of the strategy with different scores and with different properties of P&L return expectations, max capital capacity, daily Sharpe ratio.

We may need to keep tweaking both the parameter values and the actual strategy execution (as we had by adding parameters 4 and 5 above), but we should eventually get a set of configurations with high enough Sharpe and P&L returns that we can calculate a reasonably expected P&L return for an amount of capital. If we repeat this configuration-setting backtest for other strategies, we now have multiple instances of these strategies with different P&L returns.

Unlike an actual product that has a fixed yield, the return on a strategy instance isn’t certain, but our backtest and scoring can give enough reasonable P&L return expectations and bounds to allow us to allocate capital. The top P&L returns with the top daily Sharpe ratios can be stable and can now be treated as yield. And because the algorithmic strategies are automated, they are mostly passive. So, we’ve now satisfied the two conditions for a yield-generating product.

Of course, there will still be some maintenance work. Each time market dynamics change, the strategies will have to be re-tested. Additionally, we should monitor whether a “funded” strategy instance is performing as expected from our backtest. Maintenance is, however, quite minimal.

So while there’s an abundance of places to get yield, it’s possible that some of your best options might be your own strategies.

*Know anyone else interested in learning about bitcoin, Lightning, and trading? Follow us on **Twitter** and help us share the word.*