henrythebest (OP)
Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 111
Merit: 13
Perseverance pays... a lot!
|
![](https://bitcointalk.org/Themes/custom1/images/post/thumbup.gif) |
March 19, 2019, 01:45:23 AM |
|
article originally from FMZ.COM ( A place you can create your own trading bot by Python, JavaScript and C++)
Risk and money management are absolutely critical topics in quantitative trading. We have yet to explore these concepts in any reasonable amount of detail beyond stating the different sources of risk that might affect strategy performance. In this article we will be considering a quantitative means of managing account equity in order to maximise long-term account growth and limiting downside risk.
Investor Objectives It might seem that the only important investor objective is to simply "make as much money as possible". However the reality of long-term trading is more complex. Since market participants have differing risk preferences and constraints there are many objectives that investors may possess.
Many retail traders consider the only goal to be the increase of account equity as much as possible, with little or no consideration given to the "risk" of a strategy. A more sophisticated retail investor would be measuring account drawdowns, but might also be able to stomach quite a drop in equity (say 50%) if they were aware that it was optimal, in the sense of growth rate, in the long term.
An institutional investor would think very differently about risk. It is almost certain that they will have a mandated maximum drawdown (say 20%) and that they would be considering sector allocation and average daily volume limits, which would all be additional constraints on the "optimisation problem" of capital allocation to strategies. These factors might even be more important than maximising the long-term growth rate of the portfolio.
Thus we are in a situation where we can strike a balance between maximising long-term growth rate via leverage and minimising our "risk" by trying to limit the duration and extent of the drawdown. The major tool that will help us achieve this is called the Kelly Criterion.
Kelly Criterion Within this article the Kelly Criterion is going to be our tool to control leverage of, and allocation towards, a set of algorithmic trading strategies that make up a multi-strategy portfolio.
We will define leverage as the ratio of the size of a portfolio to the actual account equity within that portfolio. To make this clear we can use the analogy of purchasing a house with a mortgage. Your down payment (or "deposit" for those of us in the UK!) constitutes your account equity, while the down payment plus the mortgage value constitutes the equivalent of the size of a portfolio. Thus a down payment of 50,000 USD on a 200,000 USD house (with a mortgage of 150,000 USD) constitutes a leverage of (150000+50000)/50000=4. Thus in this instance you would be 4x leveraged on the house. A margin account portfolio behaves similarly. There is a "cash" component and then more stock can be borrowed on margin, to provide the leverage.
Before we state the Kelly Criterion specifically I want to outline the assumptions that go into its derivation, which have varying degrees of accuracy:
Each algorithmic trading strategy will be assumed to possess a returns stream that is normally distributed (i.e. Gaussian). Further, each strategy has its own fixed mean and standard deviation of returns. The formula assumes that these mean and std values do not change, i.e. that they are same in the past as in the future. This is clearly not the case with most strategies, so be aware of this assumption.
The returns being considered here are excess returns, which means they are net of all financing costs such as interest paid on margin and transaction costs. If the strategy is being carried out in an institutional setting, this also means that the returns are net of management and performance fees.
All of the trading profits are reinvested and no withdrawals of equity are carried out. This is clearly not as applicable in an institutional setting where the above mentioned management fees are taken out and investors often make withdrawals.
All of the strategies are statistically independent (there is no correlation between strategies) and thus the covariance matrix between strategy returns is diagonal.
These assumptions are not particularly accurate but we will consider ways to relax them in later articles.
Now we come to the actual Kelly Criterion! Let's imagine that we have a set of N algorithmic trading strategies and we wish to determine both how to apply optimal leverage per strategy in order to maximise growth rate (but minimise drawdowns) and how to allocate capital between each strategy. If we denote the allocation between each strategy i as a vector f of length N, s.t. f=(f1,...,fN), then the Kelly Criterion for optimal allocation to each strategy fi is given by:
Where μi are the mean excess returns and σi are the standard deviation of excess returns for a strategy i. This formula essentially describes the optimal leverage that should be applied to each strategy.
While the Kelly Criterion fi gives us the optimal leverage and strategy allocation, we still need to actually calculate our expected long-term compounded growth rate of the portfolio, which we denote by g. The formula for this is given by:
Where r is the risk-free interest rate, which is the rate at which you can borrow from the broker, and S is the annualised Sharpe Ratio of the strategy. The latter is calculated via the annualised mean excess returns divided by the annualised standard deviations of excess returns. See this article for more details.
Note: If you would like to read a more mathematical approach to the Kelly formula, please take a look at Ed Thorp's paper on the topic: The Kelly Criterion in Blackjack Sports Betting, And The Stock Market (2007).
A Realistic Example Let's consider an example in the single strategy case (i=1). Suppose we go long a mythical stock XYZ that has a mean annual return of m=10.7% and an annual standard deviation of σ=12.4%. In addition suppose we are able to borrow at a risk-free interest rate of r=3.0%. This implies that the mean excess returns are μ=m−r=10.7−3.0=7.7%. This gives us a Sharpe Ratio of S=0.077/0.124=0.62.
With this we can calculate the optimal Kelly leverage via f=μ/σ2=0.077/0.1242=5.01. Thus the Kelly leverage says that for a 100,000 USD portfolio we should borrow an additional 401,000 USD to have a total portfolio value of 501,000 USD. In practice it is unlikely that our brokerage would let us trade with such substantial margin and so the Kelly Criterion would need to be adjusted.
We can then use the Sharpe ratio S and the interest rate r to calculate g, the expected long-term compounded growth rate. g=r+S2/2=0.03+0.622/2=0.22, i.e. 22%. Thus we should expect a return of 22% a year from this strategy.
Kelly Criterion in Practice It is important to be aware that the Kelly Criterion requires a continuous rebalancing of capital allocation in order to remain valid. Clearly this is not possible in the discrete setting of actual trading and so an approximation must be made. The standard "rule of thumb" here is to update the Kelly allocation once a day. Further, the Kelly Criterion itself should be recalculated periodically, using a trailing mean and standard deviation with a lookback window. Again, for a strategy that trades roughly once a day, this lookback should be set to be on the order of 3-6 months of daily returns.
Here is an example of rebalancing a portfolio under the Kelly Criterion, which can lead to some counter-intuitive behaviour. Let's suppose we have the strategy described above. We have used the Kelly Criterion to borrow cash to size our portfolio to 501,000 USD. Let's assume we make a healthy 5% return on the following day, which boosts our account size to 526,050 USD. The Kelly Criterion tells us that we should borrow more to keep the same leverage factor of 5.01. In particular our account equity is 126,050 USD on a portfolio of 526,050, which means that the current leverage factor is 4.17. To increase it to 5.01, we need to borrow an additional 105,460 USD in order to increase our account size to 631,510.5 USD (this is 5.01×126050).
Now consider that the following day we lose 10% on our portfolio (ouch!). This means that the total portfolio size is now 568,359.45 USD (631510.5×0.9). Our total account equity is now 62,898.95 USD (126050−631510.45×0.1). This means our current leverage factor is 568359.45/62898.95=9.03. Hence we need to reduce our account by selling 253,235.71 USD of stock in order to reduce our total portfolio value to 315,123.73 USD, such that we have a leverage of 5.01 again (315123.73/62898.95=5.01).
Hence we have bought into a profit and sold into a loss. This process of selling into a loss may be extremely emotionally difficult, but it is mathematically the "correct" thing to do, assuming that the assumptions of Kelly have been met! It is the approach to follow in order to maximise long-term compounded growth rate.
You may have noticed that the absolute values of money being re-allocated between days were rather severe. This is a consequence of both the artificial nature of the example and the extensive leverage employed. 10% loss in a day is not particularly common in higher-frequency algorithmic trading, but it does serve to show how extensive leverage can be on absolute terms.
Since the estimation of means and standard deviations are always subject to uncertainty, in practice many traders tend to use a more conservative leverage regime such as the Kelly Criterion divided by two, affectionately known as "half-Kelly". The Kelly Criterion should really be considered as an upper bound of leverage to use, rather than a direct specification. If this advice is not heeded then using the direct Kelly value can lead to ruin (i.e. account equity disappearing to zero) due to the non-Gaussian nature of the strategy returns.
Should You Use The Kelly Criterion? Every algorithmic trader is different and the same is true of risk preferences. When choosing to employ a leverage strategy (of which the Kelly Criterion is one example) you should consider the risk mandates that you need to work under. In a retail environment you are able to set your own maximum drawdown limits and thus your leverage can be increased. In an institutional setting you will need to consider risk from a very different perspective and the leverage factor will be one component of a much larger framework, usually under many other constraints.
In later articles we will consider other forms of money (and risk!) management, some of which can help with the additional constraints discussed above.
article originally from FMZ.COM ( A place you can create your own trading bot by Python, JavaScript and C++)
|