## The Quantopian Environment¶

What follows are my opinions, and at times, interpretations of what I see. However, the equations will stand on their own. There is not much interpretation or opinion one can give on an equal sign, except, it is, or it is not!$\,$ And, if it is not, then you have inherited the burden of proof...

Quantopian has a different problem to solve than the usual strategy developer and backtester on its website. I see it as a simple matter of payoff matrix dimension.

A trader, in his/her trading script, tries to mazimize the following 2-dimensional matrix equation: $$\displaystyle{max \; \mathsf{F}(t) = \mathsf{F}_0 + \sum^n (\mathbf{H}\cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)}$$It states: a portfolio's ending value will depend on the initial trading capital put to work ($\mathsf{F}_0$) to which will be added the outcome of all trades and from which will be subtracted all incurred trading expenses.

A relatively simple proposition, but still, all-inclusive.

A single trading strategy $\mathbf{H}$ applied to a price difference matrix would give the following payoff matrix elements: $(h_{d,\,j}\cdot\Delta^i p_{d,\, j})\,$ where $i$ serve as the trade $id$ number and trade counter, $d$ is the time index for the trading day or other trading interval, and $j$ the stock in the portfolio. For example, a price matrix for the S$\&$P500 stocks over a 20-year period would be composed of $d\, \mathbf{x} \, j$ elements: $p_{d,\, j}\,$ with $\,d = 1, \dots,\, 5,040 \,$ and $\,j = 1, \dots, \, 505.\,$ Some 2.5+ million price entries at a daily closing price level. Evidently, the daily price difference from period to period ($\Delta p = p_{d,\, j}\, - p_{d -1,\, j}\,$) would be of the same size.

A trader might do hundreds if not thousands of backtests on different strategies: $\pi = 1, \dots, k\,$ using the above price matrix, or any other of his choice for that matter. And from this, be able to order and select the best performing strategies of the lot: $$\sum (\mathbf{H}_a\cdot\Delta \mathbf{P}) > \sum (\mathbf{H}_b\cdot\Delta \mathbf{P}) > , \dots, > \sum (\mathbf{H}_k\cdot\Delta \mathbf{P})$$No matter how many backtests are executed, the trader will always be able to order the strategies by their respective payoffs: $\mathbf{H}_a > \mathbf{H}_b > \mathbf{H}_k$.

In a way, it becomes the objective of the game: to obtain the highest payoff matrix possible, to gain access to the Atlas strategy: $\mathbf{H}^{^*}$.

However, that strategy should be viewed as a pipedream.

There is a big difference between what you can do and what the Atlas strategy represents. To know which strategy is the Atlas strategy would require backtesting them all, and then ranking them. As was previously shown, that task is more than monumental.

### The Problem¶

The problem is different at the Quantopian level. They try to find the bests backtested programs from hundreds of participants. They want to maximize their own payoff matrix. Adding a dimension to the payoff matrix will give them the ability to monitor all, or as many trading strategies as they want ($k = 1,\, \dots, \, \Theta$): $$\sum_1^n (\mathbf{H}_{k,\, d,\, j}\cdot\Delta^i \mathbf{P}_{k,\, d,\, j})$$where $k$ can be a series of trading strategies picked from their contest participants, their own strategy developers, and/or previously chosen strategies. This selected set of trading strategies would be the best they could find and to which they are ready to consider or have given allocations to after having passed their internal after-contest evaluations.

These $\,k\,$ strategies can easily be ordered according to their respective payoffs as well. In Python: $(H \cdot dP).sort(axis=0)$ would do the trick. From this, we should read the question: how many stock trading strategies do they really need? As $k$ increases, the impact of the top strategies is reduced. Even in a diversification scenario, once having reached $k=100$, adding another strategy to the mix will have minimal impact. This new strategy would have to be better than the average just to slightly improve overall performance. And, displacing the $k^{th} = 100^{th}$, would almost assure that the incremental benefit of doing so would indeed have little impact.

I read in a forum last year that Quantopian's members had done over 4,000,000 backtests up to that time using their simulation platform. Out of all this, they had made some 15 allocations which had passed their after-contest analysis and evaluation. There must have been an NDA somewhere since those 15 are not talking much, neither is Quantopian. It was never mentioned how many of those 15 still have an allocation, nor how much they have made on their 10$\%$ participation to the net profit.

This would suggest that the number of chosen strategies might not be that large. Say less than 50. Already, 25 allocations of \$10 M would use up Point72's \$250 M funding. Note that this might grow going forward.

The point I would like to make is: the above Quantopian payoff matrix should be viewed as strategies sampled from a very large population set. So huge in fact that we would have to use googols of googols in a probabilistic setting.

For Quantopian, it is a lot easier, if not more economical, to have thousands of backtesters doing all those trials (simulations), especially if they volunteered to do the work. And from all this find new alpha sources that they might not have discovered otherwise.

Even there, it will only scratch the probability surface of latent possibilities.

In a way, a contest was the way to go. It could even be used as an HR selection process where participants show their programming skills and understanding of market forces at work before ever considering remuneration except for contest prizes.

Evidently, for Quantopian, the problem is much larger than what the usual backtester is confronted with. If you want to run from 1 to $k$ simultaneous trading strategies you also want to know how they will perform.

The solution is a one-liner in Python: $(H \cdot dP).cumsum()$. It will account for the evolution of every strategy to the penny. Every single trade will be accounted for.

Point72 has a similar type of problem, and, at an even higher level. Its payoff matrix will have an added dimension to account for the other various funds like Quantopian that it might have in its portfolio and its own internally developed strategies.

Adding a dimension to their payoff matrix will solve the problem: $$\sum_1^n (\mathbf{H}_{e, k, d, j}\cdot\Delta^i \mathbf{P}_{e, k, d, j})$$where $e$ is for the various funds they might hold over the duration of their own expanded portfolio. Of which, one of the funds in $\,e\,$ would be Quantopian's. Other entries for $\,e\,$ could be Point72's own portfolio managers with their own $\phi \subset k$ strategies.

Of note, the same Python one-liner would tally the results: $(H \cdot dP).cumsum(axis=0)\,$ for a summary of funds, and $(H \cdot dP).cumsum(axis=1)\,$ for a summary on strategies.

All this to say that traders, even if they have to solve their own payoff matrices, have quite different problems to solve than at higher levels where complexity unfolds.

Nonetheless, the trader should look first at solving his/her own problem by generating the best strategies they can, and let Quantopian find in there the mix they want which might be subject to their own internal constraints, as well as those from Point72, or their other investors.

Presently, Quantopian is looking for low volatility, low beta, and low drawdown solutions. To do this, they are going for beta-neutral and market-neutral scenarios. They have put all of us (well those that volunteered) to the task. Somehow, some will prevail and be at the top of the list when the contest will either end or they have found their allocation candidates.

The ultimate objective sounds nice at first since it would have a tendency to produce smooth equity curves. There is quite a lot of cash laying around that need those low-risk flat and stable equity lines. Saying there is a huge market for this type of product would be an understatement, it is in the trillions of dollars.

But, one could reach those markets only if they can make those equity lines really, really stable, predictable and mostly sustainable. If those trading strategies break down going forward, then what should have been considered their present value?

### The Market-Neutral Equation¶

The market-neutral, beta-neutral strategy has for equation:$$\mathbf{F}(t) = \mathbf{F}_0 + 0.50 \cdot \left(\sum^n (\mathbf{H} \cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)\right) + 0.50 \cdot \left(\sum^n (- \mathbf{H} \cdot -\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)\right)$$with ($-\mathbf{H}$) to represent the shorted inventory and where profits come from declining prices ($-\Delta \mathbf{P}$). Evidently, if $\Delta \mathbf{P}$ is positive on your short trades, you are losing money, just as if $\Delta \mathbf{P}$ is negative on the long side.

Simplifying this equation could result in: $$\mathbf{F}(t) = \mathbf{F}_0 + \sum^n (\mathbf{H}\cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)$$This sounds great. It says that you can have what appears as a free lunch and eat it too. A steady low-risk portfolio with average market returns.

This could have huge implications. Getting the market's average historical return with practically no risk.

You could be market-neutral and have low-beta, low volatility, and low drawdowns. And still, maintain the expected average long-term market CAGR. It goes on the premise that you can make as much on your longs as you do on your shorts, which should be considered doubtful.

Since this type of trading strategy is rebalancing its entire portfolio all the time, it would tend to play much on market noise. This should be OK and should have for consequence that the portfolio's payoff matrix will tend to the market's average CAGR. Saying that the above equation would still stand since it is, on average, catching the market's average long-term upward drift.

However, it is not what I see in all those market-neutral strategies.

They usually barely beat the risk-free rate, and that is if they do. Usually, performance is less than the average market return which could have been had simply by buying low-cost indexed funds. In fact, you are exchanging stability for return. Accepting lower returns for more stability (less volatility).

Since the outcome of a trading strategy depends entirely on the trading methods used, one would have to conclude that the trading methods themselves are at fault, or that the market does not behave as modeled.

For instance, if the trading methods used are not that good at shorting, then we should not expect the short side to do its part. And if the strategy is not that good on the long side either, then we should not expect much from such a market-neutral portfolio.

When you look at a cumulative log-return chart of this kind of strategy compared to its benchmark, you do not see any alpha generation. On the contrary, you see the alpha degrading over time. Saying that overall, not only are you not beating the market average, it will get worse should you give it more time. Meaning that right after a contest, if not before its end, a strategy will start and continue to degrade performance-wise, as if it was a built-in feature.

Notwithstanding, there are benefits in having a smooth equity curve. But, and I think it is a serious but, there might be a high opportunity cost associated with it. The game remains a CAGR game. And because of this, one should look at a trading portfolio, or any stock portfolio for that matter, as a long-term endeavor expressed in terms of decades and not in terms of daily rebalancing on market noise from one period to the next. Such an approach is missing a long-term perspective.

An actively traded fund should first be made to last and generate more than just market averages.

The exception would be if some predictability came into the picture. And by this, meaning that on average, the predictors would be a source of ongoing profits over the life of the portfolio. Having some predictability over a short-term interval might, at times, also be classified as merely coincidental. While you might want predictors that could stand the test of time.

Predictability, should it be present in a trading strategy, has to be seen in its payoff matrix.

Such a proposition should be easy to test. A with and without simulation should give: $$\sum^n (\mathbf{\hat{H}}\cdot\Delta \mathbf{P}) \, - \sum^n (\mathbf{H}\cdot\Delta \mathbf{P}) \, > \, 0$$saying that the strategy with its predictions did produce more profits than without. The test would also show by how much those predictions contributed over the portfolio's lifespan.

For instance, a with and without trading strategy might consider "PsychSignal" which relies on StockTwits as a predictive data source. The above equation would reveal if the moniker "predictive" should be applied?

Of note, $\sum^n (\mathbf{H}\cdot\Delta \mathbf{P})\,$ can be had just by buying low-cost index funds. And even with predictions, we could have: $$\sum^n (\mathbf{\hat{H}}\cdot\Delta \mathbf{P}) \, \to \, \sum (\mathbf{H}_{_{SPY}}\cdot\Delta \mathbf{P})$$making, you guessed it: $$\sum^n (\mathbf{\hat{H}}\cdot\Delta \mathbf{P}) \, - \, \sum (\mathbf{H}_{_{SPY}}\cdot\Delta \mathbf{P}) \, \to \, 0$$ to downright underperform, making:$$\frac{\sum^n (\mathbf{\hat{H}}\cdot\Delta \mathbf{P})}{\sum (\mathbf{H}_{_{SPY}}\cdot\Delta \mathbf{P})} \, < \, 1$$which would suggest that there are out there more productive trading strategies to be had.

It has not been shown in the market-neutral strategies presented on Quantopian that they significantly exceeded market averages over the long term. A kind way of saying I have not seen them yet! But still, it does not say that it cannot be done. Note that, most probably, winning predictive strategies might not be made available for all to see! I know I would not put mine in the public domain like that.

Notwithstanding, this type of trading strategies (beta-neutral and market-neutral) have limiting long-term prospects. Meaning that performance will degrade over time. Already, they do not start that high, and they will not get any better given more time.

To resume, a trader has a two-dimensional payoff matrix to maximize. It is done simply by comparing each strategy's outcome: $$\sum (\mathbf{H}_a\cdot\Delta \mathbf{P}) > \sum (\mathbf{H}_b\cdot\Delta \mathbf{P}) > , \dots, > \sum (\mathbf{H}_k\cdot\Delta \mathbf{P})$$and selecting his/her best performers of the group.

Quantopian has for mission to select the best trading strategies from all contest participants. It has a three-dimensional payoff matrix to evaluate on their internal criteria which are different and more elaborate than those shown to the outside world. A way of saying that whatever the outcome of a trading strategy, they will have preferences. Still, their task is to order the outcome of $k$ strategies: $$\sum_1^n (\mathbf{H}_{k,\, d,\, j}\cdot\Delta^i \mathbf{P}_{k,\, d,\, j})$$and take the best of the group for capital allocations.

While Point72 has a four-dimensional payoff matrix to solve. Here, Quantopian is just part of the $e$ funds and strategies it has to consider. They too will order their funds by their payoff matrix outcome: $$\sum_1^n (\mathbf{H}_{e, k, d, j}\cdot\Delta^i \mathbf{P}_{e, k, d, j})$$where $e$ will determine which will get the funding.

Overall, it is the same equation that needs to be maximized withing the constraints of available capital and acceptable risk levels. $$max\; \mathbf{F}(t) = \mathbf{F}_0 + \sum^n (\mathbf{H}\cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)$$and still, a one-liner in Python: $(H \cdot dP).cumsum()$.

We should not imagine that $e$ is larger than $k$ and that $k$ is that large. Meaning that Point72 considers a limited number of funds using a limited number of trading strategies. Meaning that Quantopian is also considering a limited number of strategies.

### Market Neutrality¶

As part of a final note, one should consider that the following equation, where $\mathbf{H}_{_{SPY}}$ is used as a substitute for the 505 stocks in the S$\&$P500: $$\mathbf{F}(t) = \mathbf{F}_0 + 0.50 \cdot \left(\sum^n (\mathbf{H}_{_{SPY}} \cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)\right) + 0.50 \cdot \left(\sum^n (- \mathbf{H}_{_{SPY}} \cdot \Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)\right)$$ will not resolve into: $$\mathbf{F}(t) = \mathbf{F}_0 + \sum^n (\mathbf{H}_{_{SPY}}\cdot\Delta \mathbf{P}) - \sum^n (\mathbf{E}xp)$$ but into: $$\mathbf{F}(t) = \mathbf{F}_0 - \sum^n (\mathbf{E}xp)$$ And $\mathbf{F}_0$ can be had with practically no effort. You had it to start with.

As for those wondering where is the risk-free rate ($r_f$) in all this? You should get it free for playing the game. However, in the last case (the above equation), it was totally annihilated by trading the market-neutrality scenario.

Looking back at the CAPM as presented in the white paper, we have: $\mathsf{E}[r_i]=r_f+\beta_i^M \cdot (r_M−r_f)$. To make it market-neutral we get: $\mathsf{E}[r_i]=r_f+\beta_i^M \cdot (r_M−r_f) - \beta_i^M \cdot r_M$ which when simplified will give: $\mathsf{E}[r_i]=r_f - \beta_i^M \cdot r_f$. This translates to a reduced risk-free rate which should be relatively close to the actual risk-free rate.

The risk-free rate is there for the long-term investor under the CAPM model. Whereas, for the trader, it completely disappears. It vanishes into thin air: $\mathbf{F}(t) = \mathbf{F}_0 - \sum^n (\mathbf{E}xp)$. It should be observed that if $r_f$, the risk-free rate, is set to zero as in the Quantopian risk model, it would not matter so much since already there was none used or available.

It is understandable why Quantopian would make its "Sharpe" ratio with no risk-free rate. There is none to be had when trading in such a manner. However, they should nonetheless stop calling it a Sharpe ratio, since clearly, it is not. See https://en.wikipedia.org/wiki/Sharpe_ratio.

In this domain, proper use of definitions is a must just to understand each other and make sure we are talking about the same things.

© 2018, May 09. Guy R. Fleury