tag:blogger.com,1999:blog-15400573894583345632024-03-14T05:51:56.843+00:00Asymmetric Wager"In general, one is only right when either wish or fear coincides with reality." - George Orwell (In Front of Your Nose)nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.comBlogger182125tag:blogger.com,1999:blog-1540057389458334563.post-85064577694313326012017-12-28T07:41:00.003+00:002017-12-28T07:47:59.758+00:00Markets | Bitcoin - The Hidden Optionality<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
A lot of things about Bitcoin defy conventional logic. For example, valuation of bitcoin can be treacherous and common sense ranges are a tad too wide for traditional economists or investors<sup>1</sup>. "<a href="https://www.cnbc.com/2017/12/19/robert-shiller-bitcoin-valuation-is-exceptionally-ambiguous.html" target="_blank">Exceptionally ambiguous</a>", so to speak. Then we have confusions as captured in the tweet below.</div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
<div style="text-align: center;">
Bitcoin investor: "I want to get rich really quickly. Oh and by the way, I think Bitcoin will replace fiat currencies." If you really wanted Bitcoin to replace fiat currencies, you would spend it on goods & services, not try to profit from it in fiat currency.</div>
</div>
<div style="text-align: center;">
— (((FrancesCoppola))) (@Frances_Coppola) <a href="https://twitter.com/Frances_Coppola/status/940561660934348800?ref_src=twsrc%5Etfw">December 12, 2017</a></div>
</blockquote>
<script async="" charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
<br />
<div style="text-align: justify;">
The attitude of the crypto-currency enthusiasts is best understood in terms of <a href="https://en.wikipedia.org/wiki/Keynesian_beauty_contest" target="_blank">Keynesian beauty contest</a>. It is not important to have a specific valuation in mind to <a href="https://www.urbandictionary.com/define.php?term=hodl" target="_blank">HODL </a>Bitcoin. All you need is your estimates of what others might value it at. It is not important to start using Bitcoin to pay for your morning coffee to realize the dream of replacing fiat currencies. All you need is to believe that enough of other people believe in doing so. The entire thing is a second order guessing game.<br />
<br />
Theoretically, this set-up makes for an interesting characteristics of Bitcoin price. Since there is hardly any well-accepted valuation, a sudden rally or sell-off will not see the typical stabilizing intervention we see from value investors in other asset classes. Also since most (if not entire) valuation depends on the collective average of investors' expectation, a rally will see further buying and vice versa. This means the time series of price will show intrinsic characteristics of a momentum strategy.<br />
<br />
The chart below captures this feature. The chart on the left shows the empirical distribution of <a href="https://en.wikipedia.org/wiki/Moving-average_model" target="_blank">MA(1) </a>coefficients for daily returns for Bitcoin (black) and S&P 500 (red). The MA(1) coefficients can be interpreted as the response to a random shock in price. A series showing momentum nature will tend to magnify these moves, i.e. will have higher response coefficient. As shown in the chart, the Bitcoin response is highly skewed towards the right compared to S&P. The chart on the right similarly shows the response to a previous trends (<a href="https://en.wikipedia.org/wiki/Autoregressive_model" target="_blank">AR(1)</a> coefficients here). Here again the Bitcoin distribution is skewed towards the right. It even crosses the 1.0 mark, the upper limit of stationarity - turning in to what is called <a href="https://en.wikipedia.org/wiki/Unit_root" target="_blank">explosive process</a> occasionally<sup>2</sup>!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-UXiFEo9Jzvk/WkSGGUx2HfI/AAAAAAAAGnQ/DJx6f4x1F64PAdOIP0MwRv_dAgWgFDFZQCLcBGAs/s1600/btc_response.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="341" data-original-width="1224" height="178" src="https://2.bp.blogspot.com/-UXiFEo9Jzvk/WkSGGUx2HfI/AAAAAAAAGnQ/DJx6f4x1F64PAdOIP0MwRv_dAgWgFDFZQCLcBGAs/s640/btc_response.png" width="640" /></a></div>
<br />
The second characteristics of Bitcoin is its <a href="https://en.wikipedia.org/wiki/Fat-tailed_distribution" target="_blank">fat tails</a>. The chart on the left below shows standardized returns across different asset classes (Bitcoin - thick red, equities - black, FX - blues, gold - gold, commodities - purple, rates - green, inflation - brown, VIX - orange, credits - grey). The peaked value and fat tails for Bitcoin far exceeds other asset classes (closest is the option adjusted spreads of AA credit). The right hand chart shows an easy to understand metric for fatness of tails. This displays the ratios of <a href="https://en.wikipedia.org/wiki/Average_absolute_deviation" target="_blank">mean absolute deviation</a> to <a href="https://en.wikipedia.org/wiki/Standard_deviation" target="_blank">standard deviation</a>. Since standard deviation is a square root of square measure, it is more sensitive to large tail values than mean absolute deviation. The ratio of them shows the fatness of tails. A lower ratio means fatter tails. As the distribution approaches normal distribution (no <a href="https://en.wikipedia.org/wiki/Kurtosis#Excess_kurtosis" target="_blank">excess kurtosis</a>), this ratio approaches 0.8. Here we see by far, the ratio for Bitcoin is the smallest. It also shows strong positive skew.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-fBDOX41rBu4/WkSPmm13bqI/AAAAAAAAGng/hURo80bSrGE5Sj92doNbInKResaPC3SvACLcBGAs/s1600/btc_fatness.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="349" data-original-width="1224" height="182" src="https://4.bp.blogspot.com/-fBDOX41rBu4/WkSPmm13bqI/AAAAAAAAGng/hURo80bSrGE5Sj92doNbInKResaPC3SvACLcBGAs/s640/btc_fatness.png" width="640" /></a></div>
<br />
<br />
The above two observation makes Bitcoin quite a bit of unique asset class. Nevertheless, we tried to explore which asset class comes close to it, in terms of time series characteristics. Here is the outcome - where Bitcoin stands among different asset classes based on a few measures:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-zRrB3DKqGE0/WkSSy_RIlYI/AAAAAAAAGns/n6G87rE_d6Eyit2Z9HnQydR4l1HO7KE8gCLcBGAs/s1600/btc_clustering.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="503" data-original-width="1224" height="262" src="https://2.bp.blogspot.com/-zRrB3DKqGE0/WkSSy_RIlYI/AAAAAAAAGns/n6G87rE_d6Eyit2Z9HnQydR4l1HO7KE8gCLcBGAs/s640/btc_clustering.png" width="640" /></a></div>
<br />
<br />
There are multiple ways of clustering time series. One is "shape-based" - e.g. measuring a geometric distance like <a href="https://en.wikipedia.org/wiki/Euclidean_distance" target="_blank">Euclidean distance</a>. The top left chart shows the asset class hierarchy based on this measure. Bitcoins in this respect behaves similar to gold - very distinct from the carry assets block (VIX and credits), FX, rates, equities and commodities block. On "structural" measure (bottom left), like based on time series correlation, Bitcoin teams up with the commodities block. Finally, based on complexity or information based models (top right and bottom right), Bitcoin reflects the distribution and fat tails characteristics discussed above and behaves more like AA spread or VIX. On the whole, Bitcoin does not appear to be either digital gold, or a currency at all. It is more like a commodity showing fat tails similar to credit spreads and volatility.<br />
<br />
In fact this fatness of tails, along with the momentum characteristics discussed above makes Bitcoin less like an asset class, and more like a derivative. Momentum strategies are comparable to options. Most momentum trading strategies display two characteristics - many small losing trades and a few big winners. The big winners give rise to fat tails (with positive skew). And those small losing trades can be compared to carry cost of an option (theta cost or time value). This interpretation can be readily extended to Bitcoin as well. The good thing about Bitcoin is, given the upwards trends till date, the so-called carry cost has been positive!<br />
<br />
Beyond the economists and valuation experts communities, I suspect most traders understand this optionality of Bitcoin by instinct. You invest an amount you are happy to lose, with a possibility of large upside - this is the optionality of Bitcoin without all these technical details. This says nothing about Bitcoin being a bubble or not. But a long position in Bitcoin in a positive trend (or a short position in a negative trend) is going to act like a long option position. A proper valuation of the Bitcoin, therefore, must include this embedded optionality.<br />
<br /></div>
</div>
<hr />
1. For example <a href="https://www.marketwatch.com/story/is-bitcoin-in-a-bubble-this-metric-suggests-theres-more-room-to-grow-2017-06-08" target="_blank">here</a> is a rather ridiculous attempt. And a rather commonsensical <a href="https://www.bloomberg.com/view/articles/2017-11-30/bitcoin-frenzy-and-trendy-computers" target="_blank">overview</a>.<br />
2. Notice how the S&P AR(1) coefficients distribution gets truncated at 1.0, as it should be for stationary processes</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-61606470648730664642017-10-21T12:28:00.003+01:002017-10-21T12:40:39.602+01:00Systematic Trading | Using Autoencoder for Momentum Trading<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
In a previous <a href="http://prodiptag.blogspot.co.uk/2016/08/systematic-trading-getting-technical.html" target="_blank">post</a>, we discussed the basic nature of various technical indicators and noted some observations. One of the ideas was: at a basic level, most indicators captures the concept of momentum vs mean-reversion. Most do so in the price returns space, but some in a non-linear transformation of the returns space, like signed returns or time since new high/ low. We presented the idea of a PCA approach to extract the momentum signals embedded in these indicators. From there to a trading model, the steps will be to collate this momentum signal (1st PCA component or higher if required) along with other input variables (like returns volatility and/ or other fundamental indicators) to train a separate regression/ classification model (like a random forest or a deep NN).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
One of the issues with using simple PCA is that it is linear and hence may not be appropriate to summarize different measures captured across all these indicators. Here we discuss the next logical improvement - a nonlinear dimensional reduction approach using autoencoder.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As discussed <a href="http://prodiptag.blogspot.co.uk/2017/06/off-topic-wide-and-deep-learning-in-r.html" target="_blank">here</a>, the new Keras R interface has now made it very easy to develop deep learning models in R using the TensorFlow framework. Here we use this interface to train an autoencoder to fit the same set of technical indicators on NSE Nifty 50 Index as before. The steps involved are relatively straight-forward. First we generate and standardize the inputs (technical indicators levels). Then we build the computation graph.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
To do so, first we define the encoding layers (2 hidden layers, the latent coded unit size is 3, to match the first 3 components of the PCA we use for comparison), and two different decoding layers. The two different decoding layers are to enable us to train the auto-encoder as well as compute only decoding independently.</div>
<div style="text-align: justify;">
<br /></div>
<script src="https://gist.github.com/prodipta/57907af57a4f8378638080e4acb9ffd1.js"></script>
<br />
<div style="text-align: justify;">
Next we combine these layers to create the computational graph. One for the encoder only, another for the decoder, and a third one for the end-to-end autoencoder, that we will actually train.<br />
<br />
<script src="https://gist.github.com/prodipta/857f847aa270c12fe6c6f1bf8c38e83f.js"></script>
The rest of it is standard. We define a loss function to map the input to the output, measuring mean squared losses, and train the model. The training is done on data till 2013, and test set is since 2014 till present. Once the training is done, we can use the encoder and decoder separately to generate a dimensionality reduction of the input space and vice-versa.<br />
<br />
The output of the dimensionality reduction is compared with the PCA. As it appears from the correlations, the PCAs are almost one-to-one mapped to the three latent dimensions in the hidden layer generating the encoding. So the encoded layers are orthogonal in our case, although this need not be true always.<br />
<br />
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; margin-left: 4.65pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184; width: 256px;">
<tbody>
<tr style="height: 15.75pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td nowrap="" style="height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" valign="bottom" width="64"></td>
<td style="border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">V1<o:p></o:p></span></b></div>
</td>
<td style="border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">V2<o:p></o:p></span></b></div>
</td>
<td style="border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">V3<o:p></o:p></span></b></div>
</td>
</tr>
<tr style="height: 15.75pt; mso-yfti-irow: 1;">
<td nowrap="" style="background: #F7F8F9; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">PC1<o:p></o:p></span></b></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;"><b>1</b><o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">-0.3<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">0.2<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 15.75pt; mso-yfti-irow: 2;">
<td nowrap="" style="background: #F7F8F9; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">PC2<o:p></o:p></span></b></div>
</td>
<td nowrap="" style="background: #FDFDFD; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">0.1<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: #FDFDFD; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">-0.2<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: #FDFDFD; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;"><b>0.8</b><o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 15.75pt; mso-yfti-irow: 3; mso-yfti-lastrow: yes;">
<td nowrap="" style="background: #F7F8F9; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<b><span style="color: #555555; font-family: "segoe ui" , "sans-serif"; font-size: 8.0pt;">PC3<o:p></o:p></span></b></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">-0.2<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;"><b>-0.9</b><o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border-bottom: solid #CFD4D8 1.0pt; border-left: none; border-right: solid #CFD4D8 1.0pt; border-top: none; height: 15.75pt; padding: 0in 5.4pt 0in 5.4pt; width: 48.0pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-align: right;">
<span style="font-family: "segoe ui" , sans-serif; font-size: 8pt;">0.5<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<br />
The scatter plot below captures the same, but also highlights the some non-linearity, especially the first component of PCA vs the first latent dimension from the autoencoder.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-WNkEQJQyS38/WesxbTBRR5I/AAAAAAAAGP4/xHATzIphyGEB-3aHAYO6M-b47andPCBZQCLcBGAs/s1600/autoencoders.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="349" data-original-width="633" height="352" src="https://3.bp.blogspot.com/-WNkEQJQyS38/WesxbTBRR5I/AAAAAAAAGP4/xHATzIphyGEB-3aHAYO6M-b47andPCBZQCLcBGAs/s640/autoencoders.png" width="640" /></a></div>
<br />
From here the next step is obvious, replace the PCA factors inputs in the momentum trading model in the first paragraph with these latent dimensions from the autoencoder and re-evaluate. This will capture a richer set of inputs that can handle non-linearity and hopefully performs better than linear PCA. Here are some results what other <a href="https://arxiv.org/pdf/1704.03205.pdf" target="_blank">reported</a> (opens PDF). Here are some <a href="http://cs229.stanford.edu/proj2013/TakeuchiLee-ApplyingDeepLearningToEnhanceMomentumTradingStrategiesInStocks.pdf" target="_blank">more</a> (opens PDF) on the using autoencoder for cross-sectional momentum trading. The entire code is available <a href="https://github.com/prodipta/R-examples/blob/master/autoencoder.R" target="_blank">here</a>.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com2tag:blogger.com,1999:blog-1540057389458334563.post-33133242429753008602017-09-22T19:10:00.001+01:002017-09-28T10:48:57.723+01:00Macro | A Paradigm Shift For India's Retail Investors?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
The Indian economy is at an interesting point. We had two large scale policy moves in recent time - the much controversial <a href="https://en.wikipedia.org/wiki/2016_Indian_banknote_demonetisation" target="_blank">Demonetization </a>in November last year, and the implementation of (a somewhat rundown version) of <a href="https://en.wikipedia.org/wiki/Goods_and_Services_Tax_(India)" target="_blank">Goods and Services Tax</a> regime this year. Early this month, we had the first GDP print following these two major steps. The headline prints came in lower than consensus - 5.7 percentage for Q2 vs. 6.5 (and 6.1 last quarter). This was followed by equally weak Industrial Production release. A stronger than expected headline CPI prints did not help, as this squeezes the room for any rate cuts from the RBI.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
A closer look at the GDP data (see component break-down in the chart below) shows some serious weakness. The private consumption part (C) has weakened significantly following the demonetization (the vertical red dashed line). The investment component (I) has been weak for a while (although staged a comeback in the last quarter). Exports growth was not helped by a strong rupee. In last few quarters, government expenditure helped the headline a lot. But the sustainability of this is questionable. We will have the fiscal deficit data out later this month. But the street does not expect anything great. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-zWPv6C-HxeM/WcPcWSW2vOI/AAAAAAAAFhs/gBQee9_s4-s9s7ZvdyFotGU-RX2n92sTACLcBGAs/s1600/gdp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="423" data-original-width="571" height="474" src="https://1.bp.blogspot.com/-zWPv6C-HxeM/WcPcWSW2vOI/AAAAAAAAFhs/gBQee9_s4-s9s7ZvdyFotGU-RX2n92sTACLcBGAs/s640/gdp.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
The story of the <a href="https://en.wikipedia.org/wiki/Index_of_industrial_production" target="_blank">IIP </a>paints a similar picture (see chart below, overall IIP, manufacturing, base materials, consumer durable, consumer non-durable, capital goods, electricity, intermediate goods and mining respectively). While demonetization appears to have caused a negative shock, in general most of them peaked out before that, around early 2016 to be fair. The capital goods, which staged a minor comeback since bottoming out in 2014, again resumed the downward trend, along with most (except consumer durable, and to some extend mining).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-roY2QAdMhjo/WcVDu2922jI/AAAAAAAAFiw/qSJWbch4sZ8mENoVV-hSu0LJLL_SQ5rlACLcBGAs/s1600/iip.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="349" data-original-width="633" height="352" src="https://1.bp.blogspot.com/-roY2QAdMhjo/WcVDu2922jI/AAAAAAAAFiw/qSJWbch4sZ8mENoVV-hSu0LJLL_SQ5rlACLcBGAs/s640/iip.png" width="640" /></a></div>
<br /></div>
<div style="text-align: justify;">
This is all in a relatively benign global macro scenario. In spite of the Fed taper 2.0 announcement, we have little jitters in the markets. Rates, both global and local, are relatively low and volatility remains subdued. Oil prices remain range-bound. A rally in oil along with a weakening INR following Fed and expected ECB taper later this year can worsen the scope of fiscal stimulus. Most in the business sectors does not expect private investments to turn around before end of this year at the earliest. The investment exuberance back in 2004-06 left many corporates laden with unmanageable debt burden and bank balance sheets with NPA.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
In this background of weakening macro story, the Indian equity markets is in a tear. The flagship NSE Nifty Index posted a YTD 21%+ gain, among the best globally and compared to it's own history. The trailing 12-month PE ratio is looking worryingly high. High valuation remains a big concern among investors in this, and most other traditional metrics (a bit better in terms of price to book).<br />
<br />
However, comparing the PE ratio to its historical average is not very good way to capture everything that goes on to determine fair price. In the most basic approach, the price of equity is a function of market risk free rates (say the local sovereign bond) and equity risk premium. Following the approach in this paper from <a href="https://www.aqr.com/library/journal-articles/stocks-vs-bonds-explaining-the-equity-risk-premium" target="_blank">AQR</a>, I modeled the BSE SENSEX P/E based on the risk factors - the bond yields as well as the equity and bond volatilities (as in the original paper) along with current account balance as a percentage of GDP (reflecting the fiscal risk of the economy) and spread of bond yields to US Treasury (captures the flow risks). The last two are more relevant for an emerging market economy like India. The time-series shows a marked shift in relationship between pre- and post-crisis era. I fitted the model only on (monthly) data from 2010 onward to capture the recent dynamics. As it turns out, the bond vol has little contribution to market risk premia for India. The bond yield and equity vol shows significant but low correlation, whereas the CA deficit and spread to treasury captures a significant portion of the variance. The chart below shows the fit on this model (adjusted R-squared ~0.72).</div>
<div style="text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-AxmM9FCX0B8/WcUyNCAafeI/AAAAAAAAFig/_uPx9iY1VqUNPxj5d-lWUNrFXeXv8TKhwCLcBGAs/s1600/pe.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="423" data-original-width="1096" height="246" src="https://4.bp.blogspot.com/-AxmM9FCX0B8/WcUyNCAafeI/AAAAAAAAFig/_uPx9iY1VqUNPxj5d-lWUNrFXeXv8TKhwCLcBGAs/s640/pe.png" width="640" /></a></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
According to this model, the PE ratio is only slightly on the over-valuation side - not a cause of great alarm. According to this model, the market was highly over-valued around late 2011, and early 2015. We saw corrections in both cases. Also the under-valued period, early this year, was followed by upward corrections as well. This model does not forecast a large correction anytime soon unless we rally up a lot quickly from here (obvious caveat: these are in-sample results).<br />
<br />
But what is most interesting, and perhaps most significant is the recent flows that we have seen in Indian equity markets. Traditionally, the equity markets in India has been shunned by a large portion of retail investors. The experience of <a href="https://en.wikipedia.org/wiki/Harshad_Mehta" target="_blank">scams </a>in <a href="https://en.wikipedia.org/wiki/Ketan_Parekh" target="_blank">1990s </a>and the melt-downs, once during dot-com busts and another in 2008, did not helped. The foreign portfolio investors dwarfed the domestic flows in cash equities for a long time (although it is a different story in F&O). But since 2014, something changed. The extra-ordinary flows in to the equities markets, led by domestic mutual funds (presumably on the back on retail savings channeled to equities) completely outpaced the foreign flows.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-LFvpFVqAr4M/WcPccPEF9dI/AAAAAAAAFhw/HZwNbU_NWTo-_Q2nucb6m5F1TqKprYBwwCLcBGAs/s1600/fii.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="423" data-original-width="571" height="474" src="https://1.bp.blogspot.com/-LFvpFVqAr4M/WcPccPEF9dI/AAAAAAAAFhw/HZwNbU_NWTo-_Q2nucb6m5F1TqKprYBwwCLcBGAs/s640/fii.png" width="640" /></a></div>
<div style="text-align: justify;">
Is this a mass optimism following the 2014 election outcome and equity rally? Or are we witnessing a major shift in the savings behaviour of retail investors in India. The retail money has missed the initial come-back equity rally following the 2008 crash, and a part of the early 2014 rally as well, where the foreign investors made out handsomely. But much of the late rally in Indian equities has gone to the retail pockets. Is this dumb money chasing recent gains? We do not know for sure, but as we argued above, we are some distance away from any valuation melt-down in Indian equities. And the flow signifies the loss tolerance of the retails - who are sitting on some comfortable profits - has quite a bit room before panic. And finally, the weakening property markets and demonetization may have incentivized a permanent change in retail behaviour.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
We do not know for sure. But what is the implication if it is indeed a fundamental shift in savings behaviour? As argued above, the macro in India is down, but with policies properly executed, the turn-around can be sharp. If oil remains range-bound and the Fed and ECB do not stray afar from the implied forward curves, we will have little in terms of global shock to upset the local economy. On the other hand, the efforts to put banking sector NPA in shape, along with the full kick-back of the GST regime should significantly improve the badly needed private investments. Add to this mixture this retail savings paradigm shift, and we are looking at the very beginning of a multi-year rally in Indian equity markets.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-68336831265260661782017-08-23T16:26:00.004+01:002017-08-23T16:26:36.726+01:00Off Topic | How Not To Discourage Banks from Short Term Trading<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Lately we have had a <a href="https://www.ft.com/content/39db4fd0-49e8-11e7-919a-1e14ce4af89b" target="_blank">lot of talks</a> about Volcker <a href="https://www.bloomberg.com/news/articles/2017-08-01/volcker-rewrite-is-said-to-start-as-trump-regulators-grab-reins" target="_blank">repeal or replace</a>. Does Volcker rule do what it is supposed to? Is it good or bad, and for whom? There are many issues, lobbying and conversations going on right now. Here is the latest <a href="https://corpgov.law.harvard.edu/2017/08/18/regulating-motivation-a-new-perspective-on-the-volcker-rule/" target="_blank">proposal</a> from Harvard Law School:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
To achieve the objectives of the Volcker rule, we propose that banks be prohibited from basing compensation on trading-based profits. Our prohibition would encompass both ex ante compensation on trading-based profits (such as contracts or non-legally binding representations that the individual’s pay will be tied to their trading profits) and ex post compensation (such as discretionary bonuses the amount of which set based on a trader’s trading profits). Violations of this rule would result in a fine to the entity, claw-back of the individual’s impermissible incentive pay, and potential criminal liability for intentional violations.</blockquote>
The essence of the argument from the authors are:<br />
<ol>
<li>Banks compete in the securities market with other banks and firms to make short term trading profit (the target of the rule). Since this is a zero-sum game, only those banks who are able to attract top traders are able to turn in a positive profit, while others will be discouraged (by potential losses).</li>
<li>Since banks also compete in the labour market - i.e. to attract trading talent, banning profit-linked compensation will force talented traders to hedge funds.</li>
</ol>
<br />
Wham! together, the end result is banks getting second-tier trading talents who must compete against the first-tier traders from hedge funds and will lose money in the zero sum game that short term trading is. Hence banks in general will be discouraged to trade short term at all.<br />
<br />
There are some serious issues with this proposals and authors' understanding how short term trading, compensation and banks work in general.<br />
<br />
Firstly the way banks and hedge funds make money can be significantly different. A top-tier trader in a bank will not necessarily be a top-tier in a hedge funds. In short term trading, there are three ways to make money - 1) You have superior information of who owns what and who wants to trade which way 2) have a balance sheet advantage - to overwhelm markets or to hold your ground or 3) have superior analytical capabilities (better guts, models AI, whatever for short term price prediction) and/or pure trading skill. <br />
<br />
Banks usually excel in #1 and #2 because of their dealing role (may be not #2 much anymore, but also they do not have to cross the bid-ask spread). Hedge funds have limited access to these information and balance sheet advantages, but are supposed to have an edge in #3. Many top traders from a banking set-up fail in a hedge fund environment because of this. The trading and making money work differently.<br />
<br />
So even if banks lose out top trading talents to hedge funds, by no means they will lose their edges that they specialize in (more true for OTC-heavy asset classes like fixed income and less applicable for exchange-heavy asset classes like equities). The advantages belong more to the seat than the man (or woman as the case may be) occupying it.<br />
<br />
And then the compensation scheme itself is weak. The easiest way to link trader's incentives to performance - where you cannot directly link it to trading profit - is to tie it to job security. Hire top talents with a very high fixed compensation. Prune the second-raters in next cycle. Rinse and repeat. The top talents will be attracted - if they are indeed better, they will know they can perform. A compensation scheme linked to trading profits is a series of call option on trader's PnL. Tweaking this to high fixed compensation is similar, just a series of digital calls (instead of a vanilla calls), with a knock-out feature (based on trading profit).<br />
<br />
<br />
<br />
<br />
</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com1tag:blogger.com,1999:blog-1540057389458334563.post-441312325431968772017-08-08T18:38:00.004+01:002017-08-08T18:48:32.782+01:00Markets | Trading the "Bond Bubble"<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
One of the most confusing conundrum in recent time has been the curious case of stubbornly weak inflation and upbeat economy with low unemployment.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
The US GDP number, while not spectacular, has been solid. Atlanta Fed GDP-Now picked up significantly in recent time. The consensus forecast for medium term GDP (2018) also improved from the start of the year and now stands at 2.3 percent. Unemployment rate remains near record lows, below pre-crisis number. According to <a href="https://www.bls.gov/jlt/" target="_blank">JOLTS</a> surveys, both quit rate and job opening rate matches or betters the pre-crisis cyclical highs. Even the relatively more pessimistic Fed <a href="https://fred.stlouisfed.org/series/FRBKCLMCIM" target="_blank">labor market conditions index</a> has improved significantly from the lows of early 2016. But both market and survey based inflation expectations are going the other way. The 5y treasury break-even inflation came-off ~40bps from highs of early this year and now stands at 1.65 percent. Similar is the story for break-even swaps markets. To match, the medium term consensus inflation forecast has come down from 2.4 percent early this year to 2.2 percent. The fall is even steeper for 2017 forecast, from 2.5 percent as recent as April, it is now at 2.10 handle. And this does not appear to be driven by oil or commodities. Both Brent and WTI have been range-bound since mid of last year. Even the set-back in general commodities prices (see <a href="https://www.bloomberg.com/quote/BCOM:IND" target="_blank">Bloomberg Commodity</a> or <a href="http://www.crbtrader.com/crbindex/" target="_blank">CRB index</a>) early this year is now on the path of recovery. The <a href="https://en.wikipedia.org/wiki/Phillips_curve" target="_blank">Phillips curve</a> is either <a href="https://www.stlouisfed.org/on-the-economy/2015/september/phillips-curve-unemployment-down-inflation-low" target="_blank">flat</a>, <a href="https://www.bloomberg.com/news/videos/2017-08-04/pimco-s-crescenzi-wonders-if-phillips-curve-exists-video" target="_blank">dead</a> or was <a href="http://stumblingandmumbling.typepad.com/stumbling_and_mumbling/2017/08/fiscal-policy-with-a-flat-phillips-curve.html" target="_blank">never there</a>.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
This conflicting development seemed to have a win-win impact on major asset markets. Instead of the fabled <a href="https://www.bloomberg.com/news/articles/2017-07-21/prepare-yourselves-the-great-rotation-may-finally-be-at-hand" target="_blank">great rotation</a>, we have seen strong money flows in both stocks and bonds - blame it on the re-balancing of portfolios, or general optimism. <br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-gac14EsjCow/WYmxZEZaD6I/AAAAAAAAFf0/mD6cSJc4n60XI-kTO5TbtAL8gLW263EOgCLcBGAs/s1600/asset_flows.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="424" data-original-width="572" height="474" src="https://1.bp.blogspot.com/-gac14EsjCow/WYmxZEZaD6I/AAAAAAAAFf0/mD6cSJc4n60XI-kTO5TbtAL8gLW263EOgCLcBGAs/s640/asset_flows.png" width="640" /></a></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br />
The stock market benefited from solid economy and strong earnings, with valuation also supported by low rates. But the positioning remains cautious (with a correction in the <a href="http://prodiptag.blogspot.com/2017/03/markets-most-peculiar-positioning-build.html" target="_blank">gamma positioning</a> as well).<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
A more interesting development is happening in the bonds markets. The bonds markets seem to have sided with the low inflation view - that no matter what the Fed does - inflation, and rates, are not going anywhere anytime soon. The over-all positioning remains solidly in the long territory. But the peculiarity is in the strong flattening bias build-up. Early this year we saw a massive swing in long maturity bonds positioning, from extreme shorts to moderate longs. This was presumably driven by the built-up and subsequent unwinds of the <a href="https://www.bloomberg.com/news/articles/2017-04-27/the-trump-trade-is-alive-the-reflation-trade-is-all-but-dead" target="_blank">Trump Trade</a>. As a side-effect, this has resulted in the extreme flattening positioning on the street. It appears everyone is positioned for a low pace of rate hikes from the Fed, and anchored low inflation expectation - resulting in a yield curve flattening. Last few times we had this kind of extremes (early 2010, mid 2012, around just before <span id="goog_2022999621"></span><a href="http://www.investopedia.com/articles/personal-finance/060415/what-taper-tantrum-and-should-you-fear-it.asp">Taper tantrum</a> <span id="goog_2022999622"></span>and start of 2015) we had a very strong steepening that bloodied all these speculative position well and good.<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-Csslx5RPgPQ/WYmKNDkaEpI/AAAAAAAAFfk/MeWgW502CEMdjIxbeXg3KA_LhjASsxY5ACLcBGAs/s1600/tsy_pos.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="424" data-original-width="572" height="474" src="https://2.bp.blogspot.com/-Csslx5RPgPQ/WYmKNDkaEpI/AAAAAAAAFfk/MeWgW502CEMdjIxbeXg3KA_LhjASsxY5ACLcBGAs/s640/tsy_pos.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: justify;">
Most of the players in the markets are already wary of overall bonds positioning. <a href="https://www.bloomberg.com/news/articles/2017-08-06/blackrock-vanguard-say-bond-market-s-got-this-trade-all-wrong" target="_blank">Some</a> are calling out a <a href="https://www.bloomberg.com/news/articles/2017-07-31/no-bubble-in-stocks-but-look-out-when-bonds-pop-greenspan-says" target="_blank">bond bubble</a>. <a href="https://krugman.blogs.nytimes.com/2010/08/22/the-taylor-rule-and-the-bond-bubble-wonkish/" target="_blank">Some</a> are ready to take the opposite view. If you are in the markets to trade and not for punditry, it is hard to take a strong view. This extreme positioning in the curve provides a cheap (in terms of risk to reward ratio) way to position for a bonds sell-off. Or forget bursting the bubble, even a Fed <a href="http://prodiptag.blogspot.co.uk/2017/02/fomc-ides-of-march.html" target="_blank">balance sheet normalization</a> can be the trigger. It is not at all certain balance sheet normalization will lead to increase in term premia and long term yields. But most theories say so. And if the Fed decides to hold short term policy rates during this normalization, this steepening can play out in both bull or bear scenario. And honestly, nobody has any clue how the Chinese are going to change their treasury buying patterns after the <a href="https://www.bloomberg.com/news/articles/2017-02-28/trump-talk-joins-party-politics-at-china-s-npc-quicktake-q-a" target="_blank">National Congress</a> in the Autumn. If the current premier is able to stamp his authority, as generally expected, this may mark a definitive shift in policy from GDP growth target to economic stability. That, in turn, will have far reaching ripples for global asset markets.<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
At current level, the US curve is the flattest among all major currencies (except 5 year vs. 10 year area where JPY curve is flatter). A steepening in USD rates is a highly asymmetric trade - the trade to position for a bond bubble, whether you believe in it or not.<br />
<br />
<hr />
1. Data source: <a href="https://www.ici.org/research/stats/flows" target="_blank">ICI</a> for funds flow data, <a href="http://www.cftc.gov/MarketReports/CommitmentsofTraders/index.htm" target="_blank">CFTC</a> commitment of traders for positioning data (latest 1st August)<br />
2. Steepening position is implied from short end (2 year and 5 year) and long end futures positioning, expressed in equivalent (approximate) duration at 10 year point.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-29646281424110855452017-06-25T09:42:00.000+01:002017-06-25T09:47:52.184+01:00Off Topic| Wide and Deep Learning in R<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
R is an excellent environment for quick and dirty data science. I am a R user and obviously a bit biased, but between Python and R, R has always had the edge for data visualization and quick hypothesis testing. If you do not find the latest and greatest methods of bleeding edge analytics somewhere available already within the strong R package ecosystem, it is more or less safe to assume it does not exist anywhere else either. And forget Python, the IDE from R Studio is perhaps the best IDE across any development platform (although the Visual Studio perhaps has a better debugging interface). But one area where R has been weak is in machine learning, especially in the deep learning area. And with the explosion of interest (and fad?) in deep learning, this has become quite a glaring gap.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
But hopefully not anymore. We already have Google's <a href="https://www.tensorflow.org/" target="_blank">TensorFlow </a>available in R for a while. But to be honest, it did not have much feel of R in it and looked like a deprecated version of the Python release. However, very recently the R Studio folks released a R support for the excellent <a href="https://keras.io/" target="_blank">Keras </a>high level API, with back-end of TensorFlow. This feels like R (with some quirk like in memory modification of objects) and works like a charm. Although it runs on top of a local python platform, the package exposes pretty much all the functionalities Keras support.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You will already find a list of examples in their site <a href="https://rstudio.github.io/keras/index.html" target="_blank">here</a>. Here is to add a <a href="https://github.com/prodipta/R-examples/blob/master/wide_and_deep.R" target="_blank">basic example</a> of how to set up a <a href="https://www.tensorflow.org/tutorials/wide_and_deep" target="_blank">wide and deep learning</a> network. This involves creating two separate learning network. The wide one has only one layer (effectively a logistic regression of sort). The deep network is created separately. The output of two is combined (concatenated) in a final decision layer (this is slightly different architecture than the TensorFlow example). This is run on the usual <a href="https://archive.ics.uci.edu/ml/datasets/adult" target="_blank">Census Income</a> data-set. The error rate for this set up is around 16 - comparable to other methods officially reported.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-36063542356526192822017-06-06T14:34:00.000+01:002017-06-06T14:56:44.365+01:00Markets | Positioning For The UK Election<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
UK goes in to elections this week. Since the surprise announcement in April, the polling has narrowed quite a bit between the two major parties. (See chart below - although note a large part of Labour gain has been at the expense of smaller parties, especially UKIP). However although the markets had a sharp initial reaction to the announcement, the moves subsequently have been more cautious. The outcome of the election is touted as determining the direction of Brexit negotiation. And markets appear to be waiting to assess the situations once the results are out. However, what the market will focus on in Thursday evening is not only the UK's divorce from the European Union.<br />
</div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-DCt0d4ldUQI/WTaJOh2XfKI/AAAAAAAAFbU/cFETOYzZsvgZN-JkkrIkj9dMMU7k5lPeACLcB/s1600/polls.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="423" data-original-width="543" height="311" src="https://1.bp.blogspot.com/-DCt0d4ldUQI/WTaJOh2XfKI/AAAAAAAAFbU/cFETOYzZsvgZN-JkkrIkj9dMMU7k5lPeACLcB/s400/polls.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div>
<div style="text-align: justify;">
Looking past the Brexit, the major differences between the Tories and Labour campaign is their respective stance on tax and government spending. If conservatives have their ways, it will basically continue the status quo, without any significant change in taxation or spending.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
On the other hand, the labor plans to increase taxation (focused on corporates and top earners) as well as infrastructure spending. The National Transformation Fund with a corpus of £250b proposed by the Labour compares to a £23b National Productivity Investment Fund of the Tory government. The net effect is an increased need for borrowing, put at <a href="https://www.ft.com/content/dfe26fea-300b-11e7-9555-23ef563ecf9a">45b estimates by the Tories</a>. The other major campaign difference will perhaps add to this bill. The Labour maintains a so called "soft Brexit" approach, and a change in government in London may actually increase goodwill in Brussels. But Labour's negotiation aims also implies the UK may actually end up footing a substantial Brexit bill.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Put together, these means increased issuance of Gilts for a Labour government compared to the Tories. So in an unlikely scenario of a major Labour win, all the market forces and economics fall nicely in place. Gilts will sell-off on the back of fiscal plans - along with a steepening of the curve. Sterling pound will rally, supported by both the new Brexit stance and a rising yields. Equities will sell off, triggered by both taxation and a rallying pound and rising yields. For a strong conservative win, the impact is mostly in market sentiments than any dramatic departure in economics. <br />
</div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-aKHYmV0X5Js/WTaUuXTM-zI/AAAAAAAAFbk/XeoNFKwTbGAHNr3AgvTYspMk8ZjAwpMfwCLcB/s1600/correls.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="424" data-original-width="1108" height="244" src="https://2.bp.blogspot.com/-aKHYmV0X5Js/WTaUuXTM-zI/AAAAAAAAFbk/XeoNFKwTbGAHNr3AgvTYspMk8ZjAwpMfwCLcB/s640/correls.png" width="640" /></a></div>
</div>
<div style="text-align: justify;">
As we see from the charts above, the correlation in Tory polling vs. GBP and Gilts have mostly switched to negative off-late (and to rather positive territory for Labour). These correlations implies a Tory win will have some downside impact for GBP. But strong win may even see a small upside driven by a reduced political uncertainty before the economics kicks in. Gilts have little scope to respond vigorously, facing the inflation pressure on one hand and a more than expected Dovish BoE on the other - marginally positive for Gilts (yields go down). Equities will perhaps shrug off all of it.<br />
</div>
<div style="text-align: justify;">
That leaves us with the scenario of a Labour-led coalition government. This will in general hurt the market sentiments, with a higher chance of a addled up Brexit negotiation and potentially another election around the corner. This will be a sort of risk-off moment for UK, with sell-off in pounds and equities and a rally in gilts. This will also be a shock event - as at present the betting markets prices in a 90+ % probability of a Conservative majority. Assigning some reasonable probabilities to various outcome, the pay-off matrix looks like below. And it suggests a short GBP position before the election.</div>
<div style="text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-pRvWJpZFwbk/WTabiCPhPtI/AAAAAAAAFbs/WnkAI679G4knQOFsQIf1aKJjeJ1euGhPACLcB/s1600/table.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="164" data-original-width="836" height="124" src="https://4.bp.blogspot.com/-pRvWJpZFwbk/WTabiCPhPtI/AAAAAAAAFbs/WnkAI679G4knQOFsQIf1aKJjeJ1euGhPACLcB/s640/table.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
Position-wise we have seen a large reversal of positions in futures (as per CFTC reports) after the election announcement - a large decrease in net speculative shorts in Sterling pound. On the other hand, the currency options market shows a significant increase in negative skew pricing (demand to protect from a sterling crash). In fact the GBP 1 week 10 delta risk reversals is near the highs around the Scottish referendum in 2014 (although much less than the highs reached around Brexit referendum). So it appears we have some options positioning (or at least demands) - indicating a position switch from futures to options. Assuming most dealers in the FX markets will have the opposite position, this adds to a negative bias on Sterling.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-16771871187423294842017-05-06T00:14:00.002+01:002017-05-06T00:38:56.797+01:00Markets | VIX - Waiting For Godot<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
By now everyone and their cats are aware that volatility across markets and asset classes are low, been so for a long time, and shows no signs of reversal. <a href="http://www.cboe.com/products/vix-index-volatility/vix-options-and-futures/vix-index">VIX</a>, the US market benchmark vol index is around it's historic lows. The <a href="https://www.bloomberg.com/quote/MOVE:IND">MOVE Index</a> - the bond markets benchmark from BofA/ML - is no better. CVIX - an FX benchmark from Deutsche - is doing a bit better but nothing assuring. People have <a href="https://ftalphaville.ft.com/2017/05/05/2188402/21-questions-about-50-cent/">punted, hoped and feared</a> a come back of volatility, but so far we have not seen any sustained sign of it.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The reasons and the expectations from analysts come under mainly two flavours. The first narrative is that volatility is artificially <a href="https://www.bloomberg.com/news/articles/2017-05-03/do-volatility-tracking-securities-keep-the-vix-artificially-low">suppressed </a>by big league <a href="http://www.zerohedge.com/news/2017-05-04/what-could-lead-volatility-explosion-jpms-kolanovic-explains">volatility sellers</a> (speculators, but more importantly those <a href="https://www.ft.com/content/5ad9b0ee-30d6-11e7-9555-23ef563ecf9a">ETFs </a>folks and systematic <a href="https://www.forbes.com/sites/vineerbhansali/2017/05/01/why-is-volatility-so-low-and-what-should-we-do-now/#61558695656f">risk factors</a> people). The second narrative is market in general is going through a hopeful <a href="https://www.bloomberg.com/view/articles/2017-05-02/low-volatility-and-the-risks-of-crowded-trades">optimistic </a>patch supported by central bank puts. Both groups believe volatility is going to explode sooner or later. According to the first narrative, a potential driver is a random shock, that will force re-balance in ETFs and risk factors strategies and will amplify the move. The second version is we are just a few bad economic prints or some geo-political mis-steps away from a runaway volatility.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
While both of these narratives have some merits, none of them is either sufficient or complete. Or even useful for any practical purpose. There are different opinions, but I tend to side with the arguments from risk factors people (like AQR) that this line of arguments vastly over-estimates the impact of risk factors portfolios. And it is hardly fair to blame some folks for selling vols in a steep roll-down scenario as we have these days (we have <a href="http://prodiptag.blogspot.co.uk/2016/07/markets-rise-of-vol-tourists.html">written </a>about it before). On top there is certainly some influence from street positioning. As we have <a href="http://prodiptag.blogspot.co.uk/2017/03/markets-most-peculiar-positioning-build.html">written </a>about before, for a long time now, the dominant positions of the big hedgers (read big banks and market making houses) in the markets have been long gamma, putting a stabilizing effect and pinning the vol down. The second "complacency" narrative appears less plausible, but of course cannot be ruled out.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
But irrespective of which one (or may be even both) you believe in, none is useful to take a position in volatility. Essentially the argument is: volatility is trading in a distorted way and we need an external event to set it right. It is cheap since such an event will surely come some time in future. Unfortunately, by definition, we cannot predict much about the timing of an unexpected external event. And presumably you do not have the luxury of an infinite stop-loss on the bleeding you will have while you wait for that vol exploding event to materialize.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In fact the only predictable statement to make about the direction of volatility is: when the rates go up, VIX will follow. And here is why.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
To start, note that although the VIX is near historical lows, it is not cheap. The realized has been lower. And the second fundamental thing to note that in the post-crisis world, the volatility has transcended its status as just a "fear gauge" and has become an asset class in its own right. And in this world of unconventional monetary policy and low rates, volatility has become intrinsically tied to the level of rates. The chart below captures this point.<br />
<br /></div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/--EyvgMjkzZw/WQ0HJ-u6UKI/AAAAAAAAFaU/fYDOduo0ucMo-2P7CZVNbugQenvDZEjVwCLcB/s1600/vol_yield.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="324" src="https://1.bp.blogspot.com/--EyvgMjkzZw/WQ0HJ-u6UKI/AAAAAAAAFaU/fYDOduo0ucMo-2P7CZVNbugQenvDZEjVwCLcB/s640/vol_yield.PNG" width="640" /></a></div>
<br /></div>
<div style="text-align: justify;">
We <a href="http://prodiptag.blogspot.co.uk/2012/10/the-big-short-vol-trade_10.html">talked </a>about this point way back in 2012 (from bonds markets point of view). When you treat volatility as an asset class (where selling volatility is a surrogate <a href="https://en.wikipedia.org/wiki/Carry_(investment)">carry </a>strategy) it becomes clear to see the connection. Consider an asset allocator who has an option to either sell volatility and collect the premiums, or buy some equivalently risky carry product, e.g. a high yield corporate bonds portfolio.<br />
<br />
To make apple-to-apple comparison, we can think of a hypothetical "volatility bond". Given the existing spread of risky (BBB) bonds to treasury, we can deduce the probability of default of such an investment. From this, we can hypothesize a volatility bond, which consists of selling an out-of-the-money (OTM) call spread and put spread on S&P 500, each 100 point wide. The strike of the short options are such that the probability (implied from volatility) of them ending up in the money is equal to the probability of default of the high yield portfolio above (worth 100 in notional). In both cases the maximum we can lose is $100 (note in the case of short vol strategy, only one of the call or put spread can be in the money and exercised against us). So the yield from the high yield portfolio, and the premium collected (let's call that volatility yield) are comparable returns from portfolios with comparable risks. The chart above shows the yields from these two roughly equivalent portfolios. As we can see, in this rough approximation, the vol yield has in fact been higher than comparable BBB yield through out the post-crisis period, and moved in steps. The relative value before the crisis was unbalanced. It would have paid to buy OTM options spreads, funded by a high yield portfolio (anecdotally, there was an equivalent popular trade there during that time, but in the wrong market - the infamous Japanese widow maker). But at present the markets are pretty much in sync with each other and appear efficient. Far from the "distortion" argument in the narratives above.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The only way the vol can rationally go up from here is if the general risk portfolio yields also go up. That can happen in two ways. Either spread to risk-less rates (like treasury) increases (signifying a risk-off event like in the narratives above). Or through a secular rise in rates - which basically takes us back to Fed and inflation. As argued in the <a href="http://prodiptag.blogspot.co.uk/2017/05/macro-cross-asset-correlation-update.html">last post</a>, pretty much everything we can expect now hangs on future inflation path.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The results are outcome of an approximate analysis. We obviously ignored some important issues (like skew and convexity of these deep OTM strikes) and made some shortcuts (a digital set-up is more appropriate than a options spreads as in here). We also missed a bit more fundamental point here, which is correlation. S&P 500 is a much broader index than the high yield universe, and the comparison above is more appropriate as the market-wide correlation goes up. As the correlation goes lower, we can afford to sale closer to the money options spread in S&P to retain the same riskiness in the portfolio, thus making the volatility yield even higher. And as we have it, the correlation (again see the <a href="http://prodiptag.blogspot.co.uk/2017/05/macro-cross-asset-correlation-update.html">last post</a>) is down off late. But the main point remains unchanged - Vol is low but NOT cheap (although last few points in recent time in 2017 points to some relative cheapness).<br />
<br />
Perhaps it is a good time to stop complaining about low VIX prints and watch those HY spreads and inflation development carefully instead.</div>
<div style="text-align: justify;">
<br /></div>
<hr />
<div style="text-align: justify;">
All data from CBOE website/ Yahoo Finance/ Bloomberg</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-50801472844820683752017-05-01T19:14:00.001+01:002017-05-01T19:41:48.566+01:00Macro | Cross Asset Correlation Update<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
The markets seem to slowly leave behind the massive focus on fiscal impulse following the US presidential election, and the inordinate amount of stress and optimism about the <a href="http://prodiptag.blogspot.co.uk/2016/11/macro-how-sustainable-is-us-dollar-rally.html">US dollar rally</a>. This is already reflected at least in terms of asset price behaviours, if not media and analysts focus yet.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Cross asset macro drivers for 2017 YTD (based on first factors extracted from principle component analysis for each asset class) looks much like H1 of 2016, which saw a cautious rally in risk assets following the early stress period - albeit now it comes with reduced influence of oil prices and volatility on risk asset prices. This stands markedly different from the H2 of either 2015 or 2016 - which saw a pick up cross asset correlation (with very different outcome, a risk-off move in H2 2015 and a risk-on rally in H2 2016). The <a href="https://en.wikipedia.org/wiki/Minimum_spanning_tree">MST </a>charts below captures this dynamics pictorially.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-T0dytj6oxIs/WQdsx8e7f7I/AAAAAAAAFZs/nd_Evic9O4EMR_c6ILIReRufJIQCgCcEwCLcB/s1600/MST2016-2017.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://1.bp.blogspot.com/-T0dytj6oxIs/WQdsx8e7f7I/AAAAAAAAFZs/nd_Evic9O4EMR_c6ILIReRufJIQCgCcEwCLcB/s640/MST2016-2017.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Among the risk assets, DM equity factor shows increased positive sentiments to rates (i.e. increased yields leading to rally). Inflation has become more important for DM equities as well, while FX has virtually no influence. For EM equities, the latest trends has been a slight de-sensitization to rates and FX movement, although they remain significant. The credit factor also picked up its correlation to rates (and FX, which is mostly influenced by EM credits part), while retaining correlation to inflation.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-NsENC3twVOc/WQdtBdAgQuI/AAAAAAAAFZw/pnZyzQHV3vodNm2gkK4c-xfNQRe-qiZvACLcB/s1600/risk%2Basset%2Bcorrelation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="330" src="https://3.bp.blogspot.com/-NsENC3twVOc/WQdtBdAgQuI/AAAAAAAAFZw/pnZyzQHV3vodNm2gkK4c-xfNQRe-qiZvACLcB/s640/risk%2Basset%2Bcorrelation.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This makes the rates and inflation path the most important determinants for risk assets at present - at least from Developed Markets equity investors' point of view. Markets will always react (or over-react) to tax cuts expectations and presidential elections. But we are now, it appears, back to the basics.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On this fundamental note, we have seen some recent encouragement in global inflation space. The left chart below shows GDP weighted CPI inflation (global top 20 economies as well as Developed Markets within that). Since the recent bottoming out at start of 2016, we have seen a secular rise in inflation, which is more pronounced for the DM case. However, the core inflation scenario (not presented here) is far from running hot. Core inflation in the US and China have improved from 2015 lows, but much less dramatically. Only in the case of Euro area this has been solid (from very low levels). One the other hand, global credit growth (right chart below) appears to have topped out in a secular manner. On the positive sides, the wage growth in the US (not shown here) has been encouraging and sustained.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-_lPsB1I7J34/WQdtZx2XJHI/AAAAAAAAFZ0/ot-mcOibyaca95_AEbEEBg1BBmrBjt5ZgCLcB/s1600/creditimputs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-_lPsB1I7J34/WQdtZx2XJHI/AAAAAAAAFZ0/ot-mcOibyaca95_AEbEEBg1BBmrBjt5ZgCLcB/s640/creditimputs.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If we consider these points, in the context of extraordinary monetary accommodation that exists across the globe today, we should be more hesitant to conclude we are heading towards a definite normalization anytime soon, in spite of <a href="http://blogs.ft.com/gavyndavies/2017/04/02/global-surveys-or-hard-data-which-are-the-fake-news/">strong sentiments</a>. The rates market seems to agree. We have seen inflation recoveries in 2011 (remember the ECB hike mistakes) and also in early 2014. It was a misfire in both cases. A weakening credit impulse and barely normal inflation in the face of extraordinary monetary stimulus represents a global demand which is far from recovered. This makes the case for removal of these extraordinary monetary measures very difficult - most policy makers are still biased to err on the upside inflation naturally. That is unless we see the whites in the eyes of inflation - in which case, it either may be too late, or have to be too harsh and steep. For now, the forward looking inflation measures (both market based like break-even inflation and model based like <a href="https://www.clevelandfed.org/our-research/indicators-and-data/inflation-nowcasting.aspx">Cleveland Fed now-cast</a>) remain stable without any sign of worrisome upward pressure. This means the risk assets will largely avoid negative reaction by a possible June Fed hike (market probability of 67% as of date priced in). The key risk in this regard remains any <a href="http://prodiptag.blogspot.co.uk/2017/02/fomc-ides-of-march.html">(mis-)communication or premature taper</a> on the central bank balance sheets.</div>
<hr />
<div style="text-align: justify;">
All data from St Louis Fred <a href="https://fred.stlouisfed.org/">Database</a></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-52790380130444385592017-03-25T16:05:00.000+00:002017-03-25T16:05:25.501+00:00Markets | The Most Peculiar Positioning Build Up Since US Election<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Last week's S&P sell-off was apparently a big news. We had some serious analyses why it happened like <a href="https://www.bloombergquint.com/opinion/2017/03/23/the-many-culprits-in-tuesday-s-market-selloff">here</a> and of course the usual noise about end of Trump trade and reflation trade. Also the indomitable cottage industry of the permabears quickly felt a sense of vindication. However, the real surprise was why it took so long for S&P 500 to suffer a 1% down day. If we have only one 1% down day since October (roughly say 100 trading days), it is equivalent to an approx 7% annualized vol. VIX has been near record low, but at the 12-13 handle, looks quite rich given this 7% realized (or a bit over 8% if the standard deviation of daily returns is used to calculate the annualized vol). In fact the realized volatilities are very very timid and just barely off the historical lows.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In this light one the most interesting development that I suspect few has noticed is the curious build up of S&P option positioning. CFTC publishes the participant-wise positioning data at both futures and combined levels. The combined data is calculated by adding the futures equivalent option positioning (delta equivalent) to the futures data. So the difference between these two shows us the net option positions in delta equivalent terms. And as the chart below shows, it has never been more peculiar.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/--0COrXftrQY/WNaRofyUxiI/AAAAAAAAFX4/NUwAPlZwUXQmU9GhIdUn9qpGLgsu0_MpQCLcB/s1600/positioning.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://1.bp.blogspot.com/--0COrXftrQY/WNaRofyUxiI/AAAAAAAAFX4/NUwAPlZwUXQmU9GhIdUn9qpGLgsu0_MpQCLcB/s640/positioning.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Among the major categories in CFTC reports, asset managers at present have a historically large short positions in options, against the dealers and the CTA/ leveraged money managers. This is a remarkable build-up of positions since the US presidential election. It is interesting to note the usual trading incentives of these major players. The dealers are mostly market makers and their positions are in general reflective of other players' views. Leveraged/ CTA funds, to a large extent, are momentum driven. The asset managers on the other hands perhaps represent the most discretionary part, although most of them will be long-only players. In fact they as a group have built up a combined long position after the US election results - no surprise there. Along with this particularly interesting short build up in options space - quite unexpectedly.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The large short delta equivalent option positions from asset managers can be built in two ways. Buying puts - which is a common hedging strategy for the asset managers, or selling (covered) call - which is again a very standard income strategy. But their impact on the market dynamics are quite different. We do not have enough information above to see which one is more dominant. So to do that we look at what the behavior of S&P 500 price itself tells us.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
From the chart above, we see the dealers positioning mirrors that of the asset managers. If the asset managers are mostly long puts, that will mean dealers are short puts and hence short gamma. On the other hands if the asset managers are net short delta equivalent in options through short calls, the dealers will be net long gamma (long calls). And since the dealers, as market makers, will tend to run a hedged book - this will lead to some expected gamma signature in the market dynamics. When the dealers are net long gamma, they will tend to sell in a rally and buy in a sell-off (sticky gamma). This will have a stabilizing effect on S&P. The reverse is true when they are net short gamma (slippery gamma), a move reinforcing itself away from stability. We compute an approximate measures of this relationship. First we see the how much the open to low move is reversed by low to close move for each day in a given time period (20 days) for S&P 500. Then we use least square regression to estimate a beta between these two moves. This beta signifies how likely in a given day, a down move will witness opposing flows to reverse it completely or partially. A high beta signifies a large pressure of opposing flow (beta = 1 means all downside move reversed by day end). The major drivers in this reversal will be the dealers long gamma hedging activities and potentially the buy-the-dip or momentum flows from other players (apart from other flows which we assume to have a zero net effect on the balance over a time periods). We call this beta (kernel-smoothed to capture the trend) downside gamma. The chart below shows this juxtaposed with the above positioning data, as well as S&P 500.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-4SG_N2KpZ2c/WNaTK3EC1-I/AAAAAAAAFYE/kQyKwS4rsK0cXgXXO17YHcju4Hae3zBiwCLcB/s1600/gamma.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="178" src="https://1.bp.blogspot.com/-4SG_N2KpZ2c/WNaTK3EC1-I/AAAAAAAAFYE/kQyKwS4rsK0cXgXXO17YHcju4Hae3zBiwCLcB/s640/gamma.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The interesting thing to note that during the last large short delta equivalent option positioning build up by asset managers (following Brexit), the downside gamma measure actually dipped, signifying a net short gamma for the dealers, and hence long put positioning from the asset managers. The current positioning, following the same logic, points to a large short call positioning from the asset managers. In fact there were some <a href="http://www.zerohedge.com/news/2017-02-15/multi-billion-trade-meltdown-here-reason-markets-inexplicable-surge">noises </a>around this in February<a href="http://www.zerohedge.com/news/2017-02-15/multi-billion-trade-meltdown-here-reason-markets-inexplicable-surge"> </a>as well. As a result of this, the recent moves in S&P has been remarkably resilient. However as of last Tuesday's (21st March) data, it seems this long gamma positioning is coming off from the peak. Which has also coincided with a reduction in net short delta positioning of the asset managers in the option space. Theoretically, this means we can now expect a pick up in realized volatility in S&P. And it is time to shelve the buying-the-dip intraday strategy till the next opportunity comes.</div>
<div style="text-align: justify;">
<br /></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-10681044318928170062017-03-22T20:55:00.000+00:002017-03-22T21:02:50.038+00:00Off Topic: A Package to Send Text Messages From R<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
If you often run long processes in R and want to get the results notified to you once finished, but not always around to check it on the terminal, this is a very useful package. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Of course one option is to send a mail from R (there are quite a few packages for that). However, this may not be a very safe option if you are running the R process on a remote machine (on the cloud). Most mail packages in R will require you to enter your mail password in clean text. While this is okay for your local machine, on the cloud it is a little bit unsafe. Another difficulty is your R process will have to sign in to your mail account (Gmail for example) to be able to send the message. However, your mail provider can refuse - like Google will, citing an unidentified app access. To bypass that you have to considerably reduce your security option in your mail account - which is not ideal.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Texting the message using a third party service like <a href="https://www.twilio.com/">Twilio </a>is a great alternative. They offer a free-tier account (with no expiry as they claim). If you are not a heavy user, my best guess is that will be sufficient in most cases. This package simply wraps the REST API interface from Twilio for the simple text messaging service inside an R package for convenience. All that is needed is signing up for the service and obtain the assigned mobile number, and authentication details and you are good to go. I am not sure about the restrictions on international texts, but this works fine for me for local texts. Results direct to my mobile with insignificant time delay.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can download the package from <a href="https://github.com/prodipta/sendText">here</a>. The installation and usage (pretty straightforward) are in the readme file in the repository.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-82851135975293717842017-02-24T19:29:00.003+00:002017-02-25T11:46:43.324+00:00FOMC | The Ides of March<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
We have quite a bit of built up anticipation for the March FOMC. The Fedspeak analysis of "Fairly Soon" has been interpreted by most as leaning towards a March hike. Some are even claiming the rates markets are <a href="https://www.bloomberg.com/news/articles/2017-02-22/el-erian-warns-bond-market-it-s-underestimating-march-fed-odds">underestimating the probability</a> of a March hike.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-rGbUDm0jM2s/WLBaJFkDTpI/AAAAAAAAFVk/s96dRhTtEKUl4J6JjOYHePnLGTDHqPWVgCLcB/s1600/fomc.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://1.bp.blogspot.com/-rGbUDm0jM2s/WLBaJFkDTpI/AAAAAAAAFVk/s96dRhTtEKUl4J6JjOYHePnLGTDHqPWVgCLcB/s400/fomc.gif" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
The chart above shows implied 3-month treasury forward curve term structure since the 2014 (after the highs from 2013 Taper Tantrum). In early 2014 the market estimates of long run equilibrium rates were just about 4 percent. Since then we have come a long way. As we see we have three major clustering of market estimates - one at around sub 2 percent (during Brexit rally), another just above 2 percent (early 2016) and the most common level at just about 3 percent. The sell-off after the US presidential election has just brought us back to this 3 percent level. Coincidentally, after disagreeing with the markets on this long run terminal rate for a long time (erring consistently on the upper side), the FOMC also now more or less <a href="https://www.bloomberg.com/graphics/fomc-dot-plot/">agrees</a> with this level. So after quite a while markets and the FOMC seem to have converged in outlook. </div>
<br />
<div style="text-align: justify;">
Given this background, I think whether the FOMC hikes in March or not is now a far less important question than what it used to be a couple of years or even a year back. Before March FOMC, we have a round of PCE (Fed's favored measure of inflation) as well as employment and GDP data release scheduled. Unless we have a major upward surprise, March probably will be a no-hike meeting. And more importantly, given the improving economy, markets are in a much better position to absorb a hike anyways. The US and global inflation are improving, but it is much tamed than the "reflation trades" coverage makes it sound. Inflation was a worry (on the downside) before, now slowly it is ceasing to be so. There are few signs the FOMC is behind the curve as of now.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
What can really take the market off-guard, is however, the question of Fed balance sheet. If and when FOMC plans to reduce its QE-bloated balance sheet, and how they communicate this point. Hiking is a way of tightening. But a controlled balance sheet reduction is also another way. While the former affect the short term rates more (a bear flattening), the later should be more prone to affect the long end rates (bear steepening). A reason why FOMC may actually opt this is to address the historically compressed <a href="https://www.newyorkfed.org/research/data_indicators/term_premia.html">risk premia</a> - see the left chart below. Even with the recent sell-off, the risk premia remain at a depressed levels. The short end pressure felt on the back of FOMC moves more or less leaned towards a flattening of the curve than any significant correction of risk premia. While the European and Japanese bonds are trading at super-depressed levels, perhaps it is not entirely to the Fed to correct this. But adjusting balance sheet is definitely a direct way to address this.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-lRx66ohBMns/WLCABb-b5II/AAAAAAAAFWA/9G5QCKUuxow7vg2uPRyBf5bphjK_LjcEQCLcB/s1600/fomc_bs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="https://4.bp.blogspot.com/-lRx66ohBMns/WLCABb-b5II/AAAAAAAAFWA/9G5QCKUuxow7vg2uPRyBf5bphjK_LjcEQCLcB/s640/fomc_bs.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
The most important reason NOT to do this it the unpredictable potential impact. This has the strongest potential to send confusing signal to the market, perhaps resembling a taper tantrum version 2.0. The right-hand chart above shows a quick check to identify the pain points based on the current Fed holdings vis-a-vis supply. The vulnerability is concentrated in the long end, especially if this is adjusted for the duration risk (not shown here). The primary reason this may create unwanted responses is that it is not at all well understood. Balance sheet reduction after a massive QE is a completely new thing for both the Fed and the market. The last FOMC minutes (published last week) discussed this issue explicitly for the first time, if I remember correctly. So it is fair to expect this will definitely come up in the March discussion as well. At present FOMC <a href="https://www.federalreserve.gov/monetarypolicy/fomcminutes20170201.htm">expects </a>re-investing to continue "until normalization of the level of the federal funds rate is well under way". The most important event for the markets from the March FOMC will be any potential change on this view. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Realistically, this can be the trigger that can bring us back to the 4-handle level of long term equilibrium rates we had at the end of 2013. Trump fiscal push blow ups and run-away inflation seems pretty far-fetched at present. The asymmetric positioning here is bear steepening.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Similarly on the equity and risk assets side, this can have the most unexpected and damaging impact than a regular FOMC hike. Possibly more than even an adverse French elections. The National Front candidate Marine Le Pen, even if elected as the President against all odds, will find it hard to muster enough support in the parliament to call for a national referendum to leave the Euro area. And even if the referendum is held and a majority votes to leave, it is not clear that will actually be followed through - going by the outcome of the <a href="https://en.wikipedia.org/wiki/French_European_Constitution_referendum,_2005">2005 referendum</a>.</div>
<div style="text-align: justify;">
<br /></div>
<hr />
<div style="text-align: justify;">
all data from Federal Reserve and US Treasury.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-75121037421607504802017-01-14T14:14:00.000+00:002017-01-14T14:14:40.662+00:00Markets | Quick Take on Presidential Inauguration<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Next week's Presidential Inauguration is a much awaited phenomenon - for general public as well as for the financial markets across the globe. Dow 20K is mostly an arbitrary mark for a market index designed for pre-computer era (and some equally arbitrary Theoretical Dow <a href="http://blogs.wsj.com/moneybeat/2017/01/10/the-dow-has-already-crossed-20000-theoretically/">has already crossed the benchmark</a>). But it appears the entire market is somewhat directionless at present. Since the election, it has made certain assumptions on the policies of the upcoming government and has shown some very strong move across asset classes (see <a href="http://prodiptag.blogspot.co.uk/2016/11/markets-trump-trade.html">here</a>, <a href="http://prodiptag.blogspot.co.uk/2016/11/macro-how-sustainable-is-us-dollar-rally.html">here </a>and <a href="http://prodiptag.blogspot.co.uk/2016/12/macro-2017-year-ahead.html">here</a>). However, we still have very little in terms of concrete policy direction to rely upon. The latest press conference did not quite live up to the expectation of details on policies. A strong guidelines on future policy in the inauguration can provide a new direction to the market one way or the other. And this can kick start the next phase in the market.</div>
<br />
<div style="text-align: justify;">
The charts below show the market impact of Presidential inauguration since the post-war era (excluding first term of Barack Obama, which was in many ways an outlier). The X-axis is the number of business days from the inauguration day. The chart on the right shows normalized moves of the S&P 500 Index from 3 month before to 3 month after for each inauguration. The chart on the left shows the median line and the uncertainty around it. It appears more often than not, the markets usually rallies in to the inauguration, experiences a slight correction going in to the exact date, and tops out around 1 or 2 weeks after the actual date before picking up its own course. (Note we have not corrected for the usually positive trends for the markets in general and hence we should not focus much on the trends here but change in the direction of the trends instead.) However we have quite an amount of uncertainties around this. Looking closely at the right hand side chart we see this pattern was more or less followed by around 10 or 11 times out of last 17 cases. (The legends on the right chart are initials of the presidents followed by a digit signifying the term, if required)</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-9PzzIQDvPyQ/WHkA4N8_MMI/AAAAAAAAFT4/2WRNP6udDwgX4SgxQjfC9cXRHbr7py8KwCLcB/s1600/chart1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://4.bp.blogspot.com/-9PzzIQDvPyQ/WHkA4N8_MMI/AAAAAAAAFT4/2WRNP6udDwgX4SgxQjfC9cXRHbr7py8KwCLcB/s640/chart1.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
Overall positioning-wise, we have nothing extreme in either way. Post elections the leveraged funds (CTAs and hedge funds) and asset managers have increased their long (from <a href="http://www.cftc.gov/Marketreports/CommitmentsofTraders/index.htm">CFTC reports</a>). The dealers have become slightly short the markets - but all well within range. On VIX, however the dealers and asset managers remain long against the leveraged players.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-QMheT_kK-Wc/WHkA8c-jxDI/AAAAAAAAFT8/PKHZ0OBCd3QGJziah6VIQQP1EhR77IBfQCLcB/s1600/chart2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://3.bp.blogspot.com/-QMheT_kK-Wc/WHkA8c-jxDI/AAAAAAAAFT8/PKHZ0OBCd3QGJziah6VIQQP1EhR77IBfQCLcB/s640/chart2.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
This, and trend analysis of the recent intraday movement of S&P 500 suggests the street (i.e. the players who hedge) is mostly long gamma at this point. See the chart below (and see <a href="http://prodiptag.blogspot.co.uk/2016/09/markets-volatility-ahead.html">here </a>for interpretation). This means a large sell-off is quite unlikely in the short term. On top of this, we have the asymmetric scenario on the policy clarity. If President-elect Trump does announce clear guidelines on his policies, this will likely confirm the market assumptions (very low chance of a major negative surprise) and market can have the next leg of rally. On the other hands, impact of rhetorics and vagueness will most likely be muted as there is always the next time. This suggests a long positioning for the equities. However the case of dollar is quite different. We have a very strong long dollar positioning from the leveraged players and any disappointment can be felt quite hard in the dollars.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/--wVK_c0Ei6M/WHok-9-Of5I/AAAAAAAAFUM/A5E449TMzEEL3JfjBallPGUurKcLegfswCLcB/s1600/trends2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://4.bp.blogspot.com/--wVK_c0Ei6M/WHok-9-Of5I/AAAAAAAAFUM/A5E449TMzEEL3JfjBallPGUurKcLegfswCLcB/s640/trends2.png" width="640" /></a></div>
<div>
<br /></div>
<div style="text-align: justify;">
Finally, while you can't miss the obvious market reaction to Trump's win, it is fairly easy to miss - what I think the most dramatic - real economy reaction. The <a href="http://www.nfib.com/surveys/small-business-economic-trends/">NFIB</a> small business optimism and outlook went over the top following the election, much more than the overall business outlook and optimism measures. The charts shows the standardized measure and the spread. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-IpcNDwEDcyw/WHkAzqeMy1I/AAAAAAAAFT0/8d2tbVPCiQgB_h9dU1-g9duwF_NQ-7V0gCLcB/s1600/chart3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="428" src="https://2.bp.blogspot.com/-IpcNDwEDcyw/WHkAzqeMy1I/AAAAAAAAFT0/8d2tbVPCiQgB_h9dU1-g9duwF_NQ-7V0gCLcB/s640/chart3.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
I think in itself, this is quite significant. Historically, we have only two similar situations when the business indicators were significantly positive and small business optimism outperformed overall measures. Once was during the recovery of early 90s and secondly during the recovery of early 2000s. While we have too few data points to draw any statistical conclusion, in both cases we had sustained economic improvement and overall positive market performance. Of course small business optimism does not necessarily mean it will be realized, nor what is good for small businesses is also necessarily good for overall markets. But perhaps we have too many people bracing for a crash now?</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-67651202347469386352017-01-04T20:41:00.000+00:002017-01-14T11:56:03.157+00:00Systematic Trading: Back-testing Classical Technical Patterns<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<a href="https://www.blogger.com/" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://www.blogger.com/" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><br />
<div style="text-align: justify;">
Following up from my <a href="http://prodiptag.blogspot.com/2016/10/systematic-trading-r-package-for.html" target="_blank">last post</a> on systematic pattern identification in time series, here is the part on identifying and back-testing classical technical analysis patterns. This is based on the <a href="http://web.mit.edu/people/wangj/pap/LoMamayskyWang00.pdf" target="_blank">classic paper</a> by Lo, Mamaysky and Wang (2000). The major improvement added here lies in defining local extrema in terms of perceptually important points (as opposed to the kernel regression based slope change technique proposed in the paper). In my view, the kernel method can be too noisy and much less robust with real data.</div>
</div>
<div style="text-align: justify;">
<div style="text-align: justify;">
<br /></div>
</div>
<div style="text-align: justify;">
<div style="text-align: justify;">
The R package <i><a href="https://github.com/prodipta/techchart" target="_blank">techchart </a></i>has two functions for identifying classical technical patterns. The function <i>find.tpattern</i> will sweep through the entire time series and find all pattern matches. It takes in the time series as the first parameter (an <i>xts</i> object), a pattern definition to search for, and a couple of tolerance parameters. The first one is used for matching the pattern itself. The second one <i>pip.tolerance</i> is used for finding the highs and the lows (perceptually important points) on which the pattern matching is based. These tolerance numbers are in terms of multiple of standard deviation. Below is an example:</div>
</div>
<br />
<div class="chunk" id="unnamed-chunk-1">
<div class="rcode">
<div class="source" style="background-color: whitesmoke; border: 1px solid rgb(247, 247, 247); padding: 0px 1em;">
<pre class="knitr r"><span class="hl std" style="color: #585858;">x</span> <span class="hl kwb" style="color: #b05a65;"><-</span> <span class="hl kwd" style="color: #bc5a65; font-weight: bold;">getSymbols</span><span class="hl std" style="color: #585858;">(</span><span class="hl str" style="color: #317ecc;">"^GSPC"</span><span class="hl std" style="color: #585858;">,</span> <span class="hl kwc" style="color: #55aa55;">auto.assign</span> <span class="hl std" style="color: #585858;">= F)</span>
<span class="hl std" style="color: #585858;">tpattern</span> <span class="hl kwb" style="color: #b05a65;"><-</span> <span class="hl kwd" style="color: #bc5a65; font-weight: bold;">find.tpattern</span><span class="hl std" style="color: #585858;">(x[</span><span class="hl str" style="color: #317ecc;">"2015"</span><span class="hl std" style="color: #585858;">],</span> <span class="hl kwc" style="color: #55aa55;">tolerance</span> <span class="hl std" style="color: #585858;">=</span> <span class="hl num" style="color: #af0f91;">0.5</span><span class="hl std" style="color: #585858;">,</span> <span class="hl kwc" style="color: #55aa55;">pip.tolerance</span> <span class="hl std" style="color: #585858;">=</span> <span class="hl num" style="color: #af0f91;">1.5</span><span class="hl std" style="color: #585858;">)</span>
<span class="hl kwd" style="color: #bc5a65; font-weight: bold;">chart_Series</span><span class="hl std" style="color: #585858;">(x[</span><span class="hl str" style="color: #317ecc;">"2015"</span><span class="hl std" style="color: #585858;">])</span>
</pre>
</div>
</div>
<div class="rimage default">
<br /></div>
<div class="rcode">
<div class="source" style="background-color: whitesmoke; border: 1px solid rgb(247, 247, 247); padding: 0px 1em;">
<pre class="knitr r"><span class="hl kwd" style="color: #bc5a65; font-weight: bold;">add_TA</span><span class="hl std" style="color: #585858;">(tpattern</span><span class="hl opt">$</span><span class="hl std" style="color: #585858;">matches[[</span><span class="hl num" style="color: #af0f91;">1</span><span class="hl std" style="color: #585858;">]]</span><span class="hl opt">$</span><span class="hl std" style="color: #585858;">data,</span> <span class="hl kwc" style="color: #55aa55;">on</span><span class="hl std" style="color: #585858;">=</span><span class="hl num" style="color: #af0f91;">1</span><span class="hl std" style="color: #585858;">,</span> <span class="hl kwc" style="color: #55aa55;">col </span><span class="hl std" style="color: #585858;">= </span><span class="hl kwd" style="color: #bc5a65; font-weight: bold;">alpha</span><span class="hl std" style="color: #585858;">(</span><span class="hl str" style="color: #317ecc;">"yellow"</span><span class="hl std" style="color: #585858;">,</span><span class="hl num" style="color: #af0f91;">0.4</span><span class="hl std" style="color: #585858;">),</span> <span class="hl kwc" style="color: #55aa55;">lwd</span><span class="hl std" style="color: #585858;">=</span><span class="hl num" style="color: #af0f91;">5</span><span class="hl std" style="color: #585858;">)</span>
</pre>
</div>
</div>
<div class="rimage default">
<br /></div>
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-acf7e2sU11w/WG1RC5-81HI/AAAAAAAAFS8/I9kuVwj64JgCT4fX07fLtmyxT9g-JyyFgCLcB/s1600/pattern1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://4.bp.blogspot.com/-acf7e2sU11w/WG1RC5-81HI/AAAAAAAAFS8/I9kuVwj64JgCT4fX07fLtmyxT9g-JyyFgCLcB/s640/pattern1.png" width="640" /></a></div>
<br />
Apart from returning the pattern matches, it also returns some descriptions and characteristics of the match. As below:<br />
<br />
<div class="chunk" id="unnamed-chunk-2">
<div class="rcode">
<div class="source" style="background-color: whitesmoke; border: 1px solid rgb(247, 247, 247); padding: 0px 1em;">
<pre class="knitr r"><span class="hl kwd" style="color: #bc5a65; font-weight: bold;">summary</span><span class="hl std" style="color: #585858;">(tpattern)</span>
</pre>
</div>
<div class="output" style="border: 1px solid rgb(247, 247, 247); padding: 0px 1em;">
<pre class="knitr r">## ------pattern matched on: 2015-06-23 --------
## name: Head and shoulder
## type: complete
## move: 1.49 (percentage annualized)
## threshold: 2079.52
## duration: 57 (days)
</pre>
</div>
</div>
</div>
<br />
<div style="text-align: justify;">
While this is useful, you already must have spotted the catch. As this function looks at all available data at once to find a pattern, future prices influences past patterns. While this is useful for looking at a time series we need another function for rigorous back-testing. The second function available, <i>find.pattern</i> is to be used for this purpose. This function takes in similar arguments. It returns matched patterns. The match is based on either a completed pattern, or a forming one. A forming pattern is extracted by bumping the last closing price up or down by 1 standard deviation in the next bar and checking if it completes the pattern.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The process of identification of pattern is decoupled from the process of extracting patterns from the data - as proposed in the Lo et al (2000). The pattern defining function in the package is <i>pattern.db</i>. This follows a similar implementation as <a href="https://github.com/systematicinvestor/SIT/blob/master/R/rfinance2012.r" target="_blank">here </a>by <a href="https://systematicinvestor.wordpress.com/" target="_blank">Systematic Investor Blog</a>, with some added features. The implementation of pattern.db in the package techchart contains some basic patterns - head and shoulder (HS), inverse head and shoulder (IHS), broadening top (BTOP) and broadening bottom (BBOT) - the default in the above functions being HS. However it is trivial to define any pattern (as long as it can be expressed in terms of local highs and lows) and customize this pattern library.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
With this framework, it becomes quite straightforward to test and analyze pattern performance, run back-test on pattern based strategies and/ or combine patterns along with other indicators to devise trading strategies at any given frequency. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Here is a straightforward implementation of such a back-test, using the <a href="https://r-forge.r-project.org/R/?group_id=316" target="_blank">quantstrat </a>package. The strategy is quite straightforward. For a given underlying, we scan data for a head-and-should (or inverse head-and-shoulder) match. Once we find a match, we enter a short (long) position if a short term moving average is below (above) a long term one. Once we enter in to a short (long) position, we hold it for at least 5 days, and exit on or after that if a short term moving average is above (below) a long term one. We apply this strategy across S&P500, DAX, Nikkei 225 and KOSPI. The chart below shows the strategy performance.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-6D1k4ipalO4/WG1YJaFYRuI/AAAAAAAAFTM/Cq8mvArbFBMOdEzStrQ5cyblhtzo4e5XwCLcB/s1600/back-test2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="364" src="https://1.bp.blogspot.com/-6D1k4ipalO4/WG1YJaFYRuI/AAAAAAAAFTM/Cq8mvArbFBMOdEzStrQ5cyblhtzo4e5XwCLcB/s640/back-test2.png" width="640" /></a></div>
<div style="text-align: justify;">
The thick transparent purple line is the average performance across these underlying indices. The performance metrics are as below. It also has (not shown here) a strong positive skew characteristics. </div>
<div style="text-align: justify;">
<br /></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; margin-left: 4.65pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184; width: 532px;">
<tbody>
<tr style="height: 15pt;">
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 159pt;" width="212"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">Performance metrics<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">S&P<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">DAX<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">NKY<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">KOSPI<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; border: currentColor; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">ALL<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 159pt;" width="212"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">Annualized Return<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0566<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0536<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0678<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0528<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0639<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 159pt;" width="212"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">Annualized Std Dev<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.1233<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0982<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.1413<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.1205<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.0692<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 15pt;">
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 159pt;" width="212"><div class="MsoNormal" style="line-height: normal; margin-bottom: 0in;">
<span style="font-family: "lucida console"; font-size: 10pt;">Annualized Sharpe (Rf=0%)<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.4591<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.546<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.4797<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.4382<o:p></o:p></span></div>
</td>
<td nowrap="" style="background: white; height: 15pt; padding: 0in 5.4pt; width: 48pt;" width="64"><div align="right" class="MsoNormal" style="line-height: normal; margin-bottom: 0in; text-align: right;">
<span style="font-family: "lucida console"; font-size: 10pt;">0.9234<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Not spectacular, but nonetheless interesting. The R code for this back-test is <a href="https://github.com/prodipta/R-examples/blob/master/technical_patterns_back-testing.R" target="_blank">here</a>. Apart from techchart, you would need to install quantmod and quantstrat (and associated packages) to run this. Please note, running this pattern finding algorithm can take considerable time depending on the length of the time series and system characteristics.</div>
<div style="text-align: justify;">
<br /></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com2tag:blogger.com,1999:blog-1540057389458334563.post-68327325771330765162016-12-26T03:39:00.001+00:002016-12-26T03:39:35.455+00:00Macro | 2017 - The Year Ahead<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
2016 has been the year of surprises - The Brexit, the US Presidential election, the Italian referendum, the massive de-monitization in India, the Nobel prize in literature - you name it. But perhaps the real surprise was how the markets shrugged off each of these supposedly to catastrophic events.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As <a href="http://prodiptag.blogspot.com/2016/11/macro-how-sustainable-is-us-dollar-rally.html" target="_blank">discussed </a>earlier, this year has been the year of the dollar. The chart below on the left compares volatilities across asset classes in terms of cumulative daily moves greater than 1.5x the daily standard deviation. The dollar has been the clear winner. But also notice the sharp pick up in rates (US 30y here) late this year, reflecting the sell-off after the US election. The chart on the right shows the reversal and continuation of trends across asset classes during the year. The solid performance of risk assets after the sell-off early in the year, in spite of the dollar rally, increase in yields and continued weakness in the Chinese Yuan, has been nothing short of unexpected.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-cBD9GF5x7w4/WGBOQ_-8L9I/AAAAAAAAFSg/Z-VjVGzx-Bw4YYhCzB2iyIx3SQF02vBtACLcB/s1600/markets.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://4.bp.blogspot.com/-cBD9GF5x7w4/WGBOQ_-8L9I/AAAAAAAAFSg/Z-VjVGzx-Bw4YYhCzB2iyIx3SQF02vBtACLcB/s640/markets.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Going in to the next year, however, much of it depends on the performance of the US economy - more specifically the continued strength of the private consumption components and the much expected revival of the investment expenditure. The charts below show what to expect in each of these going in to 2017. A simple linear model points to the strong dependence of the house prices, real rate and labor productivity. The biggest risk to this component of GDP from rising rate is the house price, which has been strong in 2016. The upside risk is of course a much awaited improvement of the productivity (without a runway inflationary pressure).</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-5Nts65SXX1U/WFvHOU0hytI/AAAAAAAAFR0/F3WK1KztM88kTD-U6UsqSYuIyPMqDDlagCLcB/s1600/gdp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="208" src="https://4.bp.blogspot.com/-5Nts65SXX1U/WFvHOU0hytI/AAAAAAAAFR0/F3WK1KztM88kTD-U6UsqSYuIyPMqDDlagCLcB/s640/gdp.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
The investment expenditure, on the other hand, is largely driven by the inflation (NOT real rate, based on this empirical <a href="https://en.wikipedia.org/wiki/Autoregressive_model" target="_blank">AR(1)</a> model) and expectation about the economy (here represented by the Conference Board leading Index for the US). This part will be crucially determined by the policies of the new administration. The built-up expectation about fiscal spending and its impact on keeping the US growth engine running I think is a bit over-rated. In fact fiscal stimulus in an economy with tight labor market can be more inflationary than expected. The biggest upside may possibly be in the private investments front, which has been running remarkably low for a recovery compared to past episodes. A judicious mix of policy can change this. An improvement in tax regime and infrastructure spending may make US assets attractive not only for domestic, but also for overseas investors. On the other hand, the storm kicked up over trades and foreign policies can be unsettling for long term investments. This is too early to conclude in either way - but this will definitely be the major source of risks, either good or bad. And if this hypothesis is true, this will mean a decoupling of the movement of rates, risk assets and dollars, conditional on no extraordinary increase in inflation or inflation expectation.</div>
<br />
<div style="text-align: justify;">
The last bit about contained inflation is the base case scenario. Over-all 2016 has seen global inflation picking up in the second half of the year. This to a large extent is driven by the recovery in energy prices and commodities in general. We are still to see any thing on the core inflation that will be any cause of concern. In fact global core inflation is down marginally in the second half in 2016, with notable exception of China. The medium to long term inflation forecast remains stable. The recent rally in inflation break-even markets, while impressive, is coming off from a very low level. We have <a href="http://prodiptag.blogspot.co.uk/2015/10/inflation-think-global-in-chart.html" target="_blank">discussed before</a> the weakening relationship of wage pressure and headline inflation. Nevertheless wage growth is least of any concerns. We do have decent growth in wages in the US, but they are hardly extraordinary compared to pre-crisis periods, and elsewhere globally it remains subdued.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-TzMKcZ5hXJQ/WFvDV46uOjI/AAAAAAAAFRo/2rQWPM52dWcr6GfLBWhXzt7fYjEkUHmSQCLcB/s1600/inflation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="442" src="https://1.bp.blogspot.com/-TzMKcZ5hXJQ/WFvDV46uOjI/AAAAAAAAFRo/2rQWPM52dWcr6GfLBWhXzt7fYjEkUHmSQCLcB/s640/inflation.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
2016 has also been remarkable in at least two other aspects. First, we have seen a definite improvement in global PMI, not only limited to the US anymore. And also the significant contraction in US (negative) current account balance since the post-crisis QE world has now turned a corner and we have a marginal expansion in US current account deficit again. This is all the while with an expansion of Chinese current account surplus along with strong Euro area balance and contraction in current account surplus in petro-dollars economies. If the recent recovery of oil prices <a href="http://prodiptag.blogspot.com/2016/01/macro-from-peak-oil-to-trough-oil.html" target="_blank">sustain</a>, we will see the last bit changing in to positive territories again. That leaves the post-crisis anomaly of the very large Euro area surplus. The global imbalance in trade (and <a href="https://en.wikipedia.org/wiki/Savings_identity" target="_blank">alternatively net savings</a>) is shown the chart below on the left. During the 2000s, the US consistently ran an increasing current account deficit and a shrinking interest rate differential (see the right hand chart below, weighted rates differential to Euro and Japan economies). The dollar more or less followed the suit, weakening during most part of early 2000s. If we assume the QE is more or less done for the ECB and in 2017 we will focus back on tapering in the base case scenario, then it is hard to see that rates differential widening any further. Add to this the massive current account imbalance of the Euro area, and 2017 might as well be the turn-around year for the Euro, instead of the consensus long dollar trade (barring political accidents).</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-53gEXWjKymo/WFldsPpRkfI/AAAAAAAAFRQ/k9j7wP-0ZbkIXemuSeC0WxPxi5IvAYkvgCLcB/s1600/dollars.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://1.bp.blogspot.com/-53gEXWjKymo/WFldsPpRkfI/AAAAAAAAFRQ/k9j7wP-0ZbkIXemuSeC0WxPxi5IvAYkvgCLcB/s640/dollars.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
Finally, one of the biggest anticipation in 2017 is the great asset rotation, investors fleeing the bonds universe from the rising rate fear and piling in to equities. Again, there is hardly a strong case for that. Firstly, the demographics in the developed world does not allow a strong return to equities. Secondly, the fear about overseas official accounts dumping treasuries is largely unfounded - primarily most of them have been snapped up by the private sectors, and if we have steady energy prices we will see a lot less selling of treasuries by the petro-dollar economies. China, of course remains vulnerable with a steady outflow, but the outcome is unexpected here. A large dumping of treasuries by China, driven by PBoC's need to supply dollar demand in the domestic economy, will mostly be a risk-averse move and will have the opposite effect on US yields than what a large sell-off might suggest (i.e. a flight-to-safety rally instead of a bonds sell-off). As far as the US households are concerned, they started the great rotation a while back already - as the chart below show.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-uMGD_oqnh-0/WFvmHVG2tTI/AAAAAAAAFSE/U-HIKCoa-v4YsnO-HgsOq3mwQsNPDniGgCLcB/s1600/flow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://4.bp.blogspot.com/-uMGD_oqnh-0/WFvmHVG2tTI/AAAAAAAAFSE/U-HIKCoa-v4YsnO-HgsOq3mwQsNPDniGgCLcB/s640/flow.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Overall, we can conclude from above that the major macro drivers for 2017 will be 1) US house prices and US fiscal and trade policies 2) Euro area economic indicators, especially credit impulse 3) The uncertain role of the emerging market economies in face of rising rates and dollars and finally 4) The re-balancing of global excess savings. We should expect a limited rise of rates and inflation (and inflation expectation). Also risk assets face no immediate strong head-winds yet as we expect the upside risk to bond yields and inflation limited. Finally, as we near the end of monetary activism and divergence, going forward we will see a higher de-correlation among asset classes. The major tail risks remain the Chinese economy - where expected risks of accident are low (but with a large impact of course). Among idiosyncratic risks, the UK economy may be vulnerable to a dragged-on negotiation on Brexit, which also potentially may have some mirror impact on the Euro area.</div>
<br />
Given this, here we list the top macro trades for the coming year. Note these are the major themes and ways to express them, not a fire-and-forget strategy to be executed on the first trading day of the year.<br />
<br />
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184; width: 907px;">
<tbody>
<tr style="height: 29.2pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="background: #0A419B; border-bottom: solid white 3.0pt; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<b><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Economic
Theme</span></b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #0A419B; border-bottom: solid white 3.0pt; border-left: none; border-right: solid white 1.0pt; border-top: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<b><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Market
Impact</span></b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #0A419B; border-bottom: solid white 3.0pt; border-left: none; border-right: solid white 1.0pt; border-top: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<div class="MsoNormal" style="line-height: normal;">
<b><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Trade</span></b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 1;">
<td style="background: #CCCFDE; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">US Policy
Regime Shift – pro-business (tax friendly), pro-fiscal (infra spending)
with a risk of foreign confrontation</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Macro:
Consumption (and employment) has limited upside, the main upside lies in
investment pick-up. Downside for house prices and trades</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Market:
Selectively positive for equities, negative for rates, Limited upside for
dollars.</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l5 level1 lfo1; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Pay USD rates against GBP</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l5 level1 lfo1; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Long equity options with knock-out on lower
rates</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l5 level1 lfo1; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Forward vol around (1y5y5y or similar)
through vol-triangle, or simply 1y5y vs. 1y10y vol spread to protect
against unexpected inflation/ sharp bear flattening.</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l5 level1 lfo1; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Rates receivers with lower rates knock-in
for hedging economic shocks (long equities hedge, positive carry on
upper left on forwards levels)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 2;">
<td style="background: #E7E8EF; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">European/ Global Recovery</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Macro:
higher rates, higher Euro (against USD and GBP) and higher inflation – with
political surprise downside for Euro Area. Normalization of EU trade balance.</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l6 level1 lfo2; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Long Euro FX calls with knock-in on higher
rates</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l6 level1 lfo2; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">GBP vs. EUR inflation breakeven tightener
(pay GBP breakeven)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l6 level1 lfo2; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Opportunistic <a href="http://prodiptag.blogspot.co.uk/2016/10/macro-quiet-riot-continental-version.html" target="_blank">rates steepener convergence</a></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 3;">
<td style="background: #CCCFDE; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Brexit
Implication</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Unsustainably
high priced-in inflation in UK. Equities so far priced-in only sterling
weakness (FTSE in dollar terms sold off same as GBP since Brexit, this does
not incorporate any weakening of the economy)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l2 level1 lfo3; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Short FTSE 100 quantoed in euro vs. SX5E or
beta-weighted SX7E (highly correlated to Euro rates)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l2 level1 lfo3; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">GBP vs. EUR inflation breakeven tightener
(pay GBP breakeven)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 4;">
<td style="background: #E7E8EF; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">China Put</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">A flare up
of Chinese crisis. Chinese market prices more controlled, than dependent
countries</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l1 level1 lfo4; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">China rates payer vs AUD</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l1 level1 lfo4; tab-stops: list .5in;"><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Short
EM bonds (especially if you see a strong dollar rally ahead of us)<o:p></o:p></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 5;">
<td style="background: #CCCFDE; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">EM
underperformance</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Dollar
strengthening, and economies closely linked to dollar following the rates
moves</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo5; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Buy dollar against EM CCY basket</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo5; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Short EM bonds (</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">especially
if you see a strong dollar rally ahead of us</span><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 6;">
<td style="background: #E7E8EF; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Euro Area
Crisis Hedge</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Reversal
of peripheral spread tightening</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #E7E8EF; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l3 level1 lfo6; tab-stops: list .5in;"><span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Long Germany break-even vs. Italy (follows closely
the CDS spread)</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
</ol>
</td>
</tr>
<tr style="height: 29.2pt; mso-yfti-irow: 7; mso-yfti-lastrow: yes;">
<td style="background: #CCCFDE; border-top: none; border: solid white 1.0pt; height: 29.2pt; padding: .05in .1in .05in .1in; width: 137.0pt;" valign="top" width="183">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Run-away
inflation cheap hedge</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 252.8pt;" valign="top" width="337">
<div class="MsoNormal" style="line-height: normal;">
<span style="font-family: ""calibri"","serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">The
(unlikely) scenario of central banks losing control or way behind the curve. The idea is while normal inflationary pressure will push real yields, runaway inflation will force monetization, given the debt-to-GDP ratios of major economies.</span></div>
</td>
<td style="background: #CCCFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; height: 29.2pt; padding: .05in .1in .05in .1in; width: 290.45pt;" valign="top" width="387">
<ol start="1" style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; mso-list: l4 level1 lfo7; tab-stops: list .5in;"><span style="font-size: 12.0pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN; mso-hansi-font-family: Calibri;">near-OTM
rates payers vs. inflation, against far-OTM inflation caps against
rates.</span><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></li>
</ol>
</td>
</tr>
</tbody></table>
<br />
Have a great year ahead!</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-66807572559363265232016-11-28T00:00:00.002+00:002016-11-28T00:09:55.941+00:00Macro | How Sustainable is the US Dollar Rally<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
The dollar rally that started since the conclusion of US presidential election shows not much signs of abatement. 2014 was<a href="http://prodiptag.blogspot.co.uk/2014/12/freak-oil-long-term-perspective.html" target="_blank"> the year of crude oil</a>, when the fantastic sell-off in crude set much of the moods prevailing in the world economy - from equities to rates. In 2015, this slowly turned over to dollar, partly through the surprise CNY depreciation, and later through Fed rate hike expectation. And without any doubt, despite all the noises around the Brexit and Italian referendum votes (early Dec), the dominating factor for risks is again US dollars. The figure below shows a quantitative look at the cross market risk drivers using <a href="https://en.wikipedia.org/wiki/Minimum_spanning_tree" target="_blank">Minimum Spanning Tree</a> methodology (based on correlation). It shows clearly the dollar is in the center of the cross market driving force. A very similar situation to what we had back in 2013, but more concentrated role for the dollars to set the market sentiments. We already had a not-so-<a href="http://prodiptag.blogspot.com/2016/10/macro-quiet-riot-continental-version.html" target="_blank">quite riot in rates</a> following the dollar strength post election. The emerging market currencies and equities have taken significant beatings. And top houses are calling for this dollar strength to be <a href="https://www.bloomberg.com/news/articles/2016-11-18/here-are-goldman-sachs-top-trade-ideas-for-2017" target="_blank">one of the top trades in 2017</a>. Naturally it begs the question how much leg is still left in this dollar rally.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-gbwPz7dButk/WDtvlEDMNzI/AAAAAAAAFOI/Y1MJaduTu1ItA5Ru2FdnSQ1QXG0jaJKBgCLcB/s1600/dollar1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="562" src="https://4.bp.blogspot.com/-gbwPz7dButk/WDtvlEDMNzI/AAAAAAAAFOI/Y1MJaduTu1ItA5Ru2FdnSQ1QXG0jaJKBgCLcB/s640/dollar1.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
To take a long-term look, the dollar rally is by no means extreme. In nominal terms the broad-based trade weighted dollar index is near its historical highs. However, when we compensate for the inflation differentials between the US and its trade partners, the rally is well within the historical range (still 13% off from the 2002 peak) - as the chart below shows. Note the rally in dollar since 2014 has been almost equal for the real and nominal exchange rate - 17% vs 20%.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-8Ib3gXXeehk/WDtvwO6Ol7I/AAAAAAAAFOM/mXEG_ZvnPbE6SKE66vZ5EErpfrrTQNB9ACLcB/s1600/dollar3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://4.bp.blogspot.com/-8Ib3gXXeehk/WDtvwO6Ol7I/AAAAAAAAFOM/mXEG_ZvnPbE6SKE66vZ5EErpfrrTQNB9ACLcB/s640/dollar3.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
But while this rally may not be extreme, it may not be sustainable either. A large part of the recent dollar strength has been on the back of expectation of US policy change, specifically a possible fiscal stimulus. The economic argument behind is that a fiscal stimulus, coupled with a budget deficit will increase interest rates and hence the exchange rate. In fact this is what was observed during early 1980s in the US (although it has not much support from observations in other non-US advanced economies). The actual mechanism is far from clear. There are <a href="https://www.kansascityfed.org/publicat/econrev/PDF/3Q96HAKK.pdf" target="_blank">extensive studies</a> on budget deficit reduction and its impact on exchange rates, but reverse studies are rare. Theoretically, the direct impact (of increasing budget deficit) goes through the interest rate and asset return channel above and lead to a higher exchange rate (as demand for higher interest assets goes up among foreigners). On the other hand, increased budget deficit can increase the long term inflation expectation and hence expectation of future dollar depreciation. The second part of the policy is trade - which is basically a tightening pressure on the US current account deficit - if President-elect Trump follows though his promises. Typically for the US the current account in recent history has been driven to a large extent by demand for financials assets from overseas investors. This means a tightening of current account will have to be matched by reduced demand for US financial assets by foreign investors, resulting in a currency depreciation now (and possibly an appreciation later). In fact the post-crisis dollar weakness has resulted in a significant tightening of current account for the US already. A further sustained tightening in general may not be great for either the US or global economy. The other possible factors, i.e. the overall demand (or GDP differential) or real rate differential with major trading partners are relatively straightforward, an increase in both leading to a stronger dollar.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Looking in to the above set of arguments empirically, we run a quick <a href="https://en.wikipedia.org/wiki/Vector_autoregression" target="_blank">vector auto-regression</a> estimates with real dollar exchange rate, real rate differential, current account (% GDP), budget balance (% GDP) and GDP differential as endogenous variables (differential with GDP-weighted Euro area and Japan data representing rest of the world). The results are as shown in terms of impulse response - i.e. response of dollar real exchange rate for unit positive move in budget balance (FD), current account balance (ca), real rates differential (rates) and GDP differential (GDP). It seems at least for our data (spanning 1995 to 2014, quarterly), Trumps policy of budget deficit (negative fd) and tightening current account (positive ca) has off-setting impact for dollar real exchange rate. In fact there are good chances the current account tightening impact (negative for dollar in near term, positive long term) can overwhelm. An increase interest rates may make US assets attractive among foreign investors, but without matching trades the flows in to those assets will be difficult to sustain. Among other drivers, while inflation in US has been steady, including wage growth, we have seen some early signs of a come back of inflation in the Euro area. The main thing to look out there is the pick up in Euro area credit growth after a stall start of this year.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-gSYAGQK7OiI/WDtyqZ-r6CI/AAAAAAAAFOY/bs6dv3k1u9EbGZAuLjFWHLrYkj98Rgn4QCLcB/s1600/dollar2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="342" src="https://4.bp.blogspot.com/-gSYAGQK7OiI/WDtyqZ-r6CI/AAAAAAAAFOY/bs6dv3k1u9EbGZAuLjFWHLrYkj98Rgn4QCLcB/s640/dollar2.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Given this ambiguous impact of policy, and hopefully a declining need for policy divergence and a head-room for trade-weighted dollars of only ~13% to reach all time high in real terms, it does not look like the dollar rally has much room left. one of the surprise trigger can come from ECB and/or BoJ in December, with QE in Europe still priced in. And the Dec Fed hike - which is almost a certainty now - will act to defuse this rally. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Interestingly, while from the emerging market point of view, the recent dollar rally was kind of risk-off, it was hardly so for Euro. Euro - which has lately became a funding currency like the Yen, sold off steeply. Arguably there was not much positioning to blame either, so this makes it a very interesting move. The Euro area as a whole has accumulated a huge current account surplus in its glut for savings in the post-crisis period. A substantial change in trade relationship with the US may start to unravel that. If you are positioning for the consensus Euro dollar parity, think again. 2017 may see a major reversal in Euro instead dollar.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Note: all data from the St Louis Fed FRED database.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-11969584113374892592016-11-05T13:33:00.001+00:002017-01-08T08:38:22.488+00:00Markets | The Trump Trade?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<a href="https://en.wikipedia.org/wiki/Keynesian_beauty_contest" target="_blank">Keynesian beauty contest </a>is an interesting concept that shows a group of perfectly rational agents trying to predict the outcome of an event may not converge on the most expected case, provided their risk and reward depends on what most others think. I think something similar happens in the markets around a big event. Rarely it is clear what are the implications of different possible outcomes of such events. In such a scenario, a trader's immediate pay-off depends on how good he is at predicting market reaction (as opposed to the actual implications). As a result collectively the market ends up reacting in some ways that very few people may actually believe.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Next week's presidential election is such an event. There are strong evidences that economy has significant impact on election outcomes. however the <a href="http://www.nber.org/digest/oct06/w12073.html" target="_blank">reverse result</a> is very weak if <a href="http://www.nber.org/papers/w12751" target="_blank">any</a>. Performance of a large globally connected economy depends on more things beyond the control of the Oval Office than we give credit for. However the markets seem to have already formed an opinion and trading according to the poll results in recent week. This is not only the US market but across the globe. The common denominator is an expectation of underperformance with a republican win.<br />
<br />
The consensus is more or less a status quo with a democratic victory and large uncertain changes with the republic candidate in office. Honestly, I think it is too early to say what will be the policy changes as we hardly have any clue on specific policies apart from election promises. For example it is usually considered republican victory will be good for defense stocks. However if Mr Trump carries out his promise on cutting down on NATO, will that necessarily be the case? He promised to unwind trade agreements. But sure there will be something to replace it, will that be very different than the existing one, and will that have really any significant impact on trades, prices and job? Or may be you should buy Apple? - he is sure to threaten EU to withdraw the taxation case and make America great again! My personal take is Mr Trump promised things, but post election (if he wins) it will be hard to deliver on many of them except in a much run-down version. Hence in the base case, sooner than later, we focus back on things like earnings and economy and inflation once the initial reaction is over.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, the market is close to pricing in a crash scenario for an outcome favoring the republican candidate. The <a href="http://www.cboe.com/micro/charts/vix.aspx" target="_blank">VIX</a> (and <a href="http://www.cboe.com/micro/vvix/" target="_blank">volatility of VIX</a>) are tad shy of last August peaks. The implied skew and (near-month) implied correlation in S&P 500 are racing sky-wards (and interestingly with a quite flat vol convexity, i.e. high skew and very low smile). There is a high amount of uncertainty. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
And if you are planning to take decision (being flat is one of them), I have already written about how to <a href="http://prodiptag.blogspot.co.uk/2016/06/markets-brexit-positioning-under.html" target="_blank">generally think about</a> positioning under uncertainties before. If you are a hedger, you know what you need to do - that's quite it. And if you are a speculator, after all the analyses and mumbo-jumbo, basically you have to choose a side (rally or sell-off) and stick to it. And the only things that matter are:</div>
<div style="text-align: justify;">
</div>
<ol>
<li>what is your expectation and how that looks from risk-reward already priced in the markets and </li>
<li>How to optimize your responses in case you are wrong.</li>
</ol>
<br />
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-jxUqr27Psak/WB3bZH34PjI/AAAAAAAAFM8/SndhOPbSDo4qpNfw_Ct5QQcYHFMIbQKMQCLcB/s1600/equities.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="532" src="https://2.bp.blogspot.com/-jxUqr27Psak/WB3bZH34PjI/AAAAAAAAFM8/SndhOPbSDo4qpNfw_Ct5QQcYHFMIbQKMQCLcB/s640/equities.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The first one is commonly understood. At present the markets are definitely pricing a large sell-off. This is in the background of decent economic news and improving global PMIs. Technically most markets across the globe has or on the verge of confirming a bearish signal (see chart above). The asymmetric pricing in the downside suggests there are large price move expected, but at the same time it makes the risk-reward unattractive compared to the upside. And based on the past history in S&P which has breached a technical support recently, the distribution of near term returns favors the upside statistically (albeit with a rather large uncertainty spread around that). The chart shows the historical price distribution after such technical breaches (categorized in to three types of technical formation - megaphone, triangle and channel, and whether the existing trend was ascending or descending, and also if the breach is of resistance (up) or support (down))<sup>1</sup>. We are in a down breach within an ascending megaphone (see the figure above).</div>
<div style="text-align: justify;">
<br /></div>
<iframe frameborder="0" height="800" scrolling="no" src="//plot.ly/~prodiptag/164.embed" width="900"></iframe>
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<div>
As far as the second point is concerned, if you are positioning for downside and it turns out wrong, your responses are limited if you assume it will be a relief rally, (not a sustained one). Alternatively, if you are positioning for the upside and if you are wrong, you will have plenty of opportunities to react. We will sure enter a period of high volatility and there will be plenty of trading opportunities.</div>
<div>
<br /></div>
<div>
So it appears purely based on the second criteria, a long risk positioning is preferred<sup>2</sup>. Of course this assumes the outcomes are fairly priced from criteria one and you do not have any strong view on either outcome.<br />
<br />
<hr />
Note: 1) This is based on systematic technical analysis, for details see <a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjA-9b43JHQAhWmL8AKHdFDC9YQFggrMAA&url=https%3A%2F%2Fprodiptag.blogspot.com%2F2016%2F10%2Fsystematic-trading-r-package-for.html&usg=AFQjCNG2jTPB-_7G7300hqOIYJYoMLdMoA&sig2=32go_eUBA3O4-Zj6ihHSNw&bvm=bv.137904068,d.d24" target="_blank">here</a>, for code page go <a href="https://github.com/prodipta/techchart" target="_blank">here</a>. You can select or de-select series on this interactive chart<br />
2) this is not an investment or trading advice, do your own due diligence, form your own opinion. See the disclaimer page.</div>
</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-14141645700645091852016-10-28T19:47:00.002+01:002016-10-28T19:47:41.629+01:00Macro: The Quiet Riot - Continental Version<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
For the past few weeks, the fixed income market has seen a significant change in moods.<br />
<br />
The earliest <a href="http://www.bloomberg.com/news/articles/2016-09-06/there-s-been-a-quiet-riot-in-japanese-government-bonds" target="_blank">trigger </a>was in the JGBs market in late July, then it was the Gilts in late September following a pause from BoE. This week it definitely felt like the Bunds. Treasuries are down too from July highs, but in a much gradual fashion compared to the rest.<br />
<br />
Now while we do have individual explanation (with the 20/20 hindsight) for all these (BoJ <a href="http://uk.reuters.com/article/uk-japan-bonds-boj-idUKKCN1200WB?il=0" target="_blank">steepening chatter</a>, Brexit, ECB <a href="http://www.marketwatch.com/story/ecbs-constancio-denies-qe-taper-rumors-2016-10-06" target="_blank">QE rumors</a> and, of course, Fed hike expectation), these moves signals some fundamental changes common across the markets as well. For one, this sell-off in rates is markedly different that recent large moves or the 2013 taper tantrum in terms of the accompanying movement of the inflation expectation. This is the first large sell-off in rates where the real rates (I used 10y yield less the 5y swap breakeven rate) were stable. Clearly the common thread has been inflation expectation - led by the Sterling inflation market, in response to a weakening currencies. But this was not limited only to GBP. Backed by the strong recovery of the commodity prices and oil, inflation markets across regions rallied, recovering from the bottom in Q1 this year. Even the Euro inflation is flat on YTD basis after this recent move.</div>
<div style="text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-N-yhmBbwJ6c/WBN2vnWUy6I/AAAAAAAAFL0/1hl-qBAv1Mc1pFMNfo9Ruo3VGpL4dIYrQCLcB/s1600/chart1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://2.bp.blogspot.com/-N-yhmBbwJ6c/WBN2vnWUy6I/AAAAAAAAFL0/1hl-qBAv1Mc1pFMNfo9Ruo3VGpL4dIYrQCLcB/s640/chart1.png" width="640" /></a></div>
<div style="text-align: justify;">
However, it is still too early to say if this points to an inflation scare. We are far off from seeing the white of the eyes of inflation. Large part of the recovery in inflation is driven by commodity prices which just came off multi-year lows. With over-capacity in many sectors, and a <a href="https://blog-imfdirect.imf.org/2016/10/27/a-new-normal-for-the-oil-market/" target="_blank">new cost/ supply equation</a> for oil (see <a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjv9-roif7PAhVhL8AKHZh0BbIQFggcMAA&url=http%3A%2F%2Fprodiptag.blogspot.com%2F2016%2F01%2Fmacro-from-peak-oil-to-trough-oil.html&usg=AFQjCNHDRz01BzlIa_7vEX38uouX4e05xw&sig2=ZRS_j46jtBZqssUYSwmq0A&bvm=bv.136811127,bs.1,d.bGg" target="_blank">here </a>too), there is no strong case for the commodity rally to overshoot substantially from here. On the demand side, apart from the <a href="https://www.frbatlanta.org/chcs/wage-growth-tracker.aspx?panel=1" target="_blank">healthy wage growth</a> in the US, things are not significantly better. UK is still trying to figure out the consequences of Brexit. The collapse of the credit impulse in the Euro area late last year is yet to recover and Japan seems increasingly stuck.<br />
<br /></div>
<div style="text-align: justify;">
The suddenness of the move suggests a large driver of the sell-off may be positioning, especially in Euro and GBP. Bunds <a href="https://www.quandl.com/data/CHRIS/EUREX_FGBL1-Euro-Bund-Futures-Continuous-Contract-1-FGBL1-Front-Month?utm_medium=graph&utm_source=quandl" target="_blank">open interest on Eurex were near historical high</a> since 2008 before the selloff. This was definitely not helped by a rather tight-lipped Draghi on the last ECB. ICE Gilt positioning also indicated asymmetry with position build-up after Brexit. For core rates, this means the recent sell-off will stabilize as the pressure from positioning is diffused eventually. However, it is clear that we are approaching near the end of the era of quantitative easing. The next big move in rates will not be triggered by Fed. It will be the policy announcement from BoJ in Nov, followed by ECB's decision on QE in Q1 next year. Fed is priced in, and with all probabilities, will carry out a measured hike in December. It will be mostly a non-event.<br />
<br />
What is rather interesting is how the current monetary policy plays out for the curve. It is clear we are increasingly approaching the <a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjlyd6Yjv7PAhWcOsAKHUtmB7UQFggcMAA&url=http%3A%2F%2Fprodiptag.blogspot.com%2F2016%2F08%2Fmacro-end-of-qe-topia.html&usg=AFQjCNHB5HPAKLT8T1CEaSLIx1lfYUCVAA&sig2=LVW8toDVlYgEaM8VN9dN3g&bvm=bv.136811127,bs.1,d.bGs" target="_blank">end of QE-topia</a>, with some central banks moving to normalize, and some still leaving considerable liquidity in the system and trying to lean on the next lever. This apparent divergence in the first order (the level of rates) is leading a convergence drive in the second order (the yield curve slope). BoJ is actively seeking to steepen the curve to alleviate concerns of the banking sectors, among other things. ECB will be glad to have the Euro area curve steepen back. The Fed is <a href="http://www.zerohedge.com/news/2016-10-16/fed-boj-now-curve-steepening-business-what-means-markets" target="_blank">allegedly </a>getting in the same business. The latest round of rates sell-off, unlike most before in recent time, was mostly a bear steepening move. Unfortunately, steepeners are not as juicy as they used to be in terms of carry a couple of years back, but still this is the trade to be in for the medium term - either in absolute term or cross-markets.<br />
<br />
On the equity side, contrary to general view, this is not at all negative. Inflation recovering from current levels shows strength of the macro drivers. In fact in recent years, S&P 500 has shown more asymmetric correlation to inflation expectation than outright rates itself (see chart below). The thick tail on the right hand side has been dominated by inflation downside (i.e. correlated sell-off in equities with collapse in inflation expectation). A recovery in inflation expectation should be positive, at least initially, and ultimately uncorrelated to equity performance (runaway inflation is still a distance myth). This is especially true given the strong commitment from the Fed on its intention of slow paced hikes.</div>
<div style="text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-horIlpnSZWs/WBN2397QeLI/AAAAAAAAFL4/b9PlIBne_pw3efuPU_LMgsqFuavjUn31ACLcB/s1600/correlation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://1.bp.blogspot.com/-horIlpnSZWs/WBN2397QeLI/AAAAAAAAFL4/b9PlIBne_pw3efuPU_LMgsqFuavjUn31ACLcB/s640/correlation.png" width="640" /></a></div>
<div style="text-align: justify;">
The S&P appears to be in a consolidation state - in a typical triangle formation, before the next leg (usually up from here).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-0ax185IfTVI/WBOc-MVnIoI/AAAAAAAAFMc/5Z-miTWODskXJ_ji4xz5wp49TRjPZ8vMQCLcB/s1600/spx.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://2.bp.blogspot.com/-0ax185IfTVI/WBOc-MVnIoI/AAAAAAAAFMc/5Z-miTWODskXJ_ji4xz5wp49TRjPZ8vMQCLcB/s640/spx.png" width="640" /></a></div>
<br />
The downside for equities from here is in fact event risks, and not macro. The US presidential election is one -although apparently the market <a href="https://www.economy.com/getlocal?q=01B8E0B9-03AE-4574-94E5-FE36F4D0D9B5&app=download" target="_blank">does not care</a>. Italian referendum is another - and again the history does not make a strong case for it either, if you go by the off-hand manner in which market digested the outcome of recent southern European election outcome.</div>
<div style="text-align: justify;">
<br /></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-43789482755929996352016-10-22T09:48:00.000+01:002016-10-22T09:48:43.172+01:00Systematic Trading | An R Package for Automated Technical Analysis<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
This is an R package for automated technical analysis and some ground stuff for some pattern matching algorithm I plan to build. This is available at <a href="https://github.com/prodipta/techchart" target="_blank">github</a> - you can directly <a href="https://cran.r-project.org/web/packages/githubinstall/vignettes/githubinstall.html" target="_blank">install it from github</a> or you can fork or download. Currently it has three functionalities - 1) perceptually important points 2) change points for time series with linear deterministic trends and 3) automated technical support/ resistance/ price envelope identification (useful for back-test, but I have not found the time yet). It has also an undocumented module for technical pattern identification, which is in fluid state. Please note the is in early version and features/ data structures may undergo substantial changes in later version. I copy paste the R vignette below.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<head>
<title>Techchart: Technical Feature Extraction of Time Series Data</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<link href="data:text/css;charset=utf-8,body%20%7B%0Abackground%2Dcolor%3A%20%23fff%3B%0Amargin%3A%201em%20auto%3B%0Amax%2Dwidth%3A%20700px%3B%0Aoverflow%3A%20visible%3B%0Apadding%2Dleft%3A%202em%3B%0Apadding%2Dright%3A%202em%3B%0Afont%2Dfamily%3A%20%22Open%20Sans%22%2C%20%22Helvetica%20Neue%22%2C%20Helvetica%2C%20Arial%2C%20sans%2Dserif%3B%0Afont%2Dsize%3A%2014px%3B%0Aline%2Dheight%3A%201%2E35%3B%0A%7D%0A%23header%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0A%23TOC%20%7B%0Aclear%3A%20both%3B%0Amargin%3A%200%200%2010px%2010px%3B%0Apadding%3A%204px%3B%0Awidth%3A%20400px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Aborder%2Dradius%3A%205px%3B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Afont%2Dsize%3A%2013px%3B%0Aline%2Dheight%3A%201%2E3%3B%0A%7D%0A%23TOC%20%2Etoctitle%20%7B%0Afont%2Dweight%3A%20bold%3B%0Afont%2Dsize%3A%2015px%3B%0Amargin%2Dleft%3A%205px%3B%0A%7D%0A%23TOC%20ul%20%7B%0Apadding%2Dleft%3A%2040px%3B%0Amargin%2Dleft%3A%20%2D1%2E5em%3B%0Amargin%2Dtop%3A%205px%3B%0Amargin%2Dbottom%3A%205px%3B%0A%7D%0A%23TOC%20ul%20ul%20%7B%0Amargin%2Dleft%3A%20%2D2em%3B%0A%7D%0A%23TOC%20li%20%7B%0Aline%2Dheight%3A%2016px%3B%0A%7D%0Atable%20%7B%0Amargin%3A%201em%20auto%3B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dcolor%3A%20%23DDDDDD%3B%0Aborder%2Dstyle%3A%20outset%3B%0Aborder%2Dcollapse%3A%20collapse%3B%0A%7D%0Atable%20th%20%7B%0Aborder%2Dwidth%3A%202px%3B%0Apadding%3A%205px%3B%0Aborder%2Dstyle%3A%20inset%3B%0A%7D%0Atable%20td%20%7B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dstyle%3A%20inset%3B%0Aline%2Dheight%3A%2018px%3B%0Apadding%3A%205px%205px%3B%0A%7D%0Atable%2C%20table%20th%2C%20table%20td%20%7B%0Aborder%2Dleft%2Dstyle%3A%20none%3B%0Aborder%2Dright%2Dstyle%3A%20none%3B%0A%7D%0Atable%20thead%2C%20table%20tr%2Eeven%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%2E5em%200%3B%0A%7D%0Ablockquote%20%7B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Apadding%3A%200%2E25em%200%2E75em%3B%0A%7D%0Ahr%20%7B%0Aborder%2Dstyle%3A%20solid%3B%0Aborder%3A%20none%3B%0Aborder%2Dtop%3A%201px%20solid%20%23777%3B%0Amargin%3A%2028px%200%3B%0A%7D%0Adl%20%7B%0Amargin%2Dleft%3A%200%3B%0A%7D%0Adl%20dd%20%7B%0Amargin%2Dbottom%3A%2013px%3B%0Amargin%2Dleft%3A%2013px%3B%0A%7D%0Adl%20dt%20%7B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Aul%20%7B%0Amargin%2Dtop%3A%200%3B%0A%7D%0Aul%20li%20%7B%0Alist%2Dstyle%3A%20circle%20outside%3B%0A%7D%0Aul%20ul%20%7B%0Amargin%2Dbottom%3A%200%3B%0A%7D%0Apre%2C%20code%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0Aborder%2Dradius%3A%203px%3B%0Acolor%3A%20%23333%3B%0Awhite%2Dspace%3A%20pre%2Dwrap%3B%20%0A%7D%0Apre%20%7B%0Aborder%2Dradius%3A%203px%3B%0Amargin%3A%205px%200px%2010px%200px%3B%0Apadding%3A%2010px%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Acode%20%7B%0Afont%2Dfamily%3A%20Consolas%2C%20Monaco%2C%20%27Courier%20New%27%2C%20monospace%3B%0Afont%2Dsize%3A%2085%25%3B%0A%7D%0Ap%20%3E%20code%2C%20li%20%3E%20code%20%7B%0Apadding%3A%202px%200px%3B%0A%7D%0Adiv%2Efigure%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0Aimg%20%7B%0Abackground%2Dcolor%3A%20%23FFFFFF%3B%0Apadding%3A%202px%3B%0Aborder%3A%201px%20solid%20%23DDDDDD%3B%0Aborder%2Dradius%3A%203px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Amargin%3A%200%205px%3B%0A%7D%0Ah1%20%7B%0Amargin%2Dtop%3A%200%3B%0Afont%2Dsize%3A%2035px%3B%0Aline%2Dheight%3A%2040px%3B%0A%7D%0Ah2%20%7B%0Aborder%2Dbottom%3A%204px%20solid%20%23f7f7f7%3B%0Apadding%2Dtop%3A%2010px%3B%0Apadding%2Dbottom%3A%202px%3B%0Afont%2Dsize%3A%20145%25%3B%0A%7D%0Ah3%20%7B%0Aborder%2Dbottom%3A%202px%20solid%20%23f7f7f7%3B%0Apadding%2Dtop%3A%2010px%3B%0Afont%2Dsize%3A%20120%25%3B%0A%7D%0Ah4%20%7B%0Aborder%2Dbottom%3A%201px%20solid%20%23f7f7f7%3B%0Amargin%2Dleft%3A%208px%3B%0Afont%2Dsize%3A%20105%25%3B%0A%7D%0Ah5%2C%20h6%20%7B%0Aborder%2Dbottom%3A%201px%20solid%20%23ccc%3B%0Afont%2Dsize%3A%20105%25%3B%0A%7D%0Aa%20%7B%0Acolor%3A%20%230033dd%3B%0Atext%2Ddecoration%3A%20none%3B%0A%7D%0Aa%3Ahover%20%7B%0Acolor%3A%20%236666ff%3B%20%7D%0Aa%3Avisited%20%7B%0Acolor%3A%20%23800080%3B%20%7D%0Aa%3Avisited%3Ahover%20%7B%0Acolor%3A%20%23BB00BB%3B%20%7D%0Aa%5Bhref%5E%3D%22http%3A%22%5D%20%7B%0Atext%2Ddecoration%3A%20underline%3B%20%7D%0Aa%5Bhref%5E%3D%22https%3A%22%5D%20%7B%0Atext%2Ddecoration%3A%20underline%3B%20%7D%0A%0Acode%20%3E%20span%2Ekw%20%7B%20color%3A%20%23555%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%0Acode%20%3E%20span%2Edt%20%7B%20color%3A%20%23902000%3B%20%7D%20%0Acode%20%3E%20span%2Edv%20%7B%20color%3A%20%2340a070%3B%20%7D%20%0Acode%20%3E%20span%2Ebn%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Efl%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Ech%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Est%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Eco%20%7B%20color%3A%20%23888888%3B%20font%2Dstyle%3A%20italic%3B%20%7D%20%0Acode%20%3E%20span%2Eot%20%7B%20color%3A%20%23007020%3B%20%7D%20%0Acode%20%3E%20span%2Eal%20%7B%20color%3A%20%23ff0000%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%0Acode%20%3E%20span%2Efu%20%7B%20color%3A%20%23900%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%20code%20%3E%20span%2Eer%20%7B%20color%3A%20%23a61717%3B%20background%2Dcolor%3A%20%23e3d2d2%3B%20%7D%20%0A" rel="stylesheet" type="text/css"></link>
</head>
<body>
<div class="fluid-row" id="header">
<h1 class="title">
Techchart: Technical Feature Extraction of Time Series Data</h1>
<h4 class="author">
<em>Prodipta Ghosh</em></h4>
<h4 class="date">
<em>2016-10-09</em></h4>
</div>
The R package <code>techchart</code> is a collection of tools to extract features from time series data for technical analysis and related quantitative applications. While R is not the most suitable platform for carrying out technical analysis with human inputs, this package makes it possible to extract and match technical features and patterns and use them to back-test trading ideas. At present, the package covers four major areas:<br />
<ul>
<li>Perceptually Important Points (PIPs) identification</li>
<li>Supports/resistance identification (either based on PIPs or the old-fashioned Fibonacci method)</li>
<li>Change point analysis of trends and segmentation of time series based on underlying trend</li>
<li>Identification of technical envelopes (like trend channels or triangles) of a time series</li>
</ul>
<div class="section level2" id="perceptually-important-points">
<h2>
Perceptually Important Points</h2>
PIPs are an effort to algorithmically derive a set of important points as perceived by a human to describe a time series. This typically can be a set of minima or maxima points or a set of turning points which are important from a feature extraction perspective. Traditional technical analysis - like technical pattern identification - relies heavily on PIPs. In addition, a set of PIPs can be used to compress a time series in a very useful way. This compressed representation then can be used for comparing segments of time series (match finding) or other purposes. In this package, we have implemented the approach detailed <a href="https://www.cs.cmu.edu/~eugene/research/full/search-series.pdf">here</a>.<br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">spx <-<span class="st"> </span>quantmod::<span class="kw">getSymbols</span>(<span class="st">"^GSPC"</span>, <span class="dt">auto.assign =</span> <span class="ot">FALSE</span>)
spx <-<span class="st"> </span>spx[<span class="st">"2014::2015"</span>]
imppts <-<span class="st"> </span>techchart::<span class="kw">find.imppoints</span>(spx,<span class="dv">2</span>)
<span class="kw">head</span>(imppts)</code></pre>
</div>
<pre><code>## pos sign value
## 2014-02-03 22 -1 1741.89
## 2014-03-07 45 1 1878.52
## 2014-03-14 50 -1 1841.13
## 2014-04-03 64 1 1891.43</code></pre>
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">chart_Series</span>(spx)
<span class="kw">points</span>(<span class="kw">as.numeric</span>(imppts$maxima$pos),<span class="kw">as.numeric</span>(imppts$maxima$value),<span class="dt">bg=</span><span class="st">"green"</span>,<span class="dt">pch=</span><span class="dv">24</span>,<span class="dt">cex=</span><span class="fl">1.25</span>)
<span class="kw">points</span>(<span class="kw">as.numeric</span>(imppts$minima$pos),<span class="kw">as.numeric</span>(imppts$minima$value),<span class="dt">bg=</span><span class="st">"red"</span>,<span class="dt">pch=</span><span class="dv">25</span>,<span class="dt">cex=</span><span class="fl">1.25</span>)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAEgCAMAAABb4lATAAABPlBMVEUAAAAAADoAAGYAOpAAZrYA/wAzMzMzM1ozM38zWlozWqAzf8E6AAA6AGY6Ojo6OpA6ZmY6ZpA6ZrY6kJA6kLY6kNtERERERGdERIhEZ6hEiMVaMzNaM39af8FaoOFmAABmAGZmOjpmOpBmZjpmZmZmZrZmkNtmtv9nRERnqOJ/MzN/M39/WqB/f8F/oOF/wf+IRESIiIiIxf+QOgCQOjqQOmaQZpCQkLaQkNuQ27aQ2/+gWjOg4f+oZ0So4v+2ZgC2Zjq2eTO2kDq2tv+2///BfzPBf1rBf3/Bwf/B///FiETF///UmFfbkDrbkGbbtmbb/7bb/9vb///hoFrhoH/h///iqGfi///w1Jjw8Lbw8PD/AAD/tmb/wX//xYj/25D/29v/4aD/4qj//7b//8H//8X//9v//+H//+L////udIlaAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAW+klEQVR4nO2dj7/dNnXA1eZFMNqtDHgBuhG6DfpaxpathW7LgFcgBVp4BRIKxLlp1iZ7Q///PzBZP4+kI1uy/e615XM+yb3Pss6R5K/18/pYTJA0LezUGSC5WSHAjQsBblwIcONCgBsXAty4EODGhQA3LgS4cSHAjQsBblwIcONCgBeS63cZu/VQXLKX7suj52886AOvztW5MFAfmvi95nsPUfVLpg/0oY8vwy+AtREhwAvJ4Uxe+ovDrYf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Lcejpi5iXlwMreYJLnW7jSy2TLdAOADfh9Xm1kT4O2WiVayGhcC3LgQ4MaFADcuBLhxIcCNy/8DcC353KnKiIsAAAAASUVORK5CYII=" style="display: block; margin: auto;" title="" /><br />
The function takes in a time series object (in xts format), and a tolerance level for extreme points identification (can be either a percentage or a multiple of standard deviation). It returns an object which has the list of all PIPs identified, marked by either a -1 (minima) or 1 (maxima), as well as the maxima and minima points separately as xts objects<br />
</div>
<div class="section level2" id="identification-of-change-point-in-linear-deterministic-trends">
<h2>
Identification of Change Point in Linear (Deterministic) Trends</h2>
Change point analysis has recently become an increasingly important tools for both financial and non-financial time series. There are quite a few packages in R to implement the major algorithms. However, most of them is focused on stationary time series, where in most cases the typical price series encountered in financial market will be non-stationary. The <code>cpt.trend</code> function in this package implement a change point analysis for non-stationary time series to identify multiple changes in the deterministic linear trends. The implementation is based on identifying change in simple regression coefficients (with penalty) and extends to multiple change point identification using the popular binary segmentation methodology. See <a href="https://arxiv.org/pdf/1101.1438.pdf">here</a> for a discussion on different methods. The function <code>find.major.trends</code> extends this functionality to automatically search a time series for the most top level changes in trends by starting with a high value of penalty and decreasing in each step till a set of trends found.<br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">spx <-<span class="st"> </span>quantmod::<span class="kw">getSymbols</span>(<span class="st">"^GSPC"</span>, <span class="dt">auto.assign =</span> <span class="ot">FALSE</span>)
spx <-<span class="st"> </span>spx[<span class="st">"2014::2015"</span>]
cpts <-<span class="st"> </span>techchart::<span class="kw">find.major.trends</span>(spx)
<span class="kw">summary</span>(cpts)</code></pre>
</div>
<pre><code>## change points:
## [1] 411
## segments summary:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 93.0 172.5 252.0 252.0 331.5 411.0</code></pre>
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">chart_Series</span>(spx)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAM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ouafU58dUGyhv/4i/q/5k+2zA4ot0s9BXXc+YiAqGIha7EXyDywxEBVELQbiIIOBEsFAiWCgRDBQIhgoEQyUCAZKBA1UzDK6AFWnisal5FSqsHnjbbed2HT7ljEQAzEQA40FiMMFAyWCgRLBQIlgoEQwUCIYKBEMlAgGSgQDJYKBEsFAiWCgRDBQIkKgy4fFDp5/UFx/JGbUqypBPF6IH2dvn4SVPz9UL6e7tqpZsUVVV7nNrsXUtUOydnLXcdWzt4rKthrrh0Bif8uFKD7e1YuPd1UJLouF3M6NBiBvxTZVK0BNuz7/dVy59a7jqmc/EwZ3HsW7FpurqV8I0muHp4X+zT09NLtcmKoLVXL+d6l7/PNfVYDE2scLVcVbsU1VWbn1rsWK1d9Nu13HVSWQqCf6yY0T0U+ua6rLjx/V1S/+cyL3s6M72Oe6lefmcMSrKZGrvv3PJqByxVZVZYXWuxYvZx/123VcVQGd7qolYtnpjqrxQXmKxfULwVgs1M7cr9F2Qfn61K16XBTFbuLX6PaSrCort941mnOpx67jqqYHLUWLdlyXwYb6hTz7XCvVuXf2E91I9arPRr30POgGy4XomGqxdyEwe0lUNZVb71r+Jhf9dh1XNdcgu0t189AdraZ+Ia4BH+7aVqqr99L8vtWrf4UPj1Kc3eq289NF9VaSqGoqt961meqza6KqvIuJymJHS31DE+vcOKmrz89BiWCgRDBQIhgoEQyUCAZKBAMlgoES8X+omM/At8IkcwAAAABJRU5ErkJggg==" style="display: block; margin: auto;" title="" /><br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">add_TA</span>(cpts$segments[[<span class="dv">1</span>]],<span class="dt">on=</span><span class="dv">1</span>,<span class="dt">lty=</span><span class="dv">3</span>, <span class="dt">col=</span><span class="st">"red"</span>)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAMAAAAjXV6yAAABa1BMVEUAAAAAADoAAGYAOpAAZrYzMzMzM00zM1ozM38zOjozOm0zTZU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L3JmEfvj1Ty/kjG4KQYi3rO1ADyMjYpWgJU1/TxT+PCjZuOix59lzO4eD1umldXUb7gSE/tHRbqm7u9p5sc66JjGXP8F0F3/3s/LgHiuffHsoiXsUlRUbhx0zxj+btp1nRcVADi5bienDngenJaoTp57XpV+eI/B6KdLaVg76peHuvh8E8dI7Ke+3sdIJexUVFRoHHT/OPoldmajotKQIcjmcLTDrdkiZfdFIvLFxxjMZaN2a/RqKD4vG2z7hdFMcp8jbaVbFFRuHHTqOfSDE3HRbUGTXiPtqzKYE35Qsw+20s5946+qTopP9VsVKnHgRpMxlwxZbK3EOhWMkV14cZNi29yPFvTcVG9Bpkm5clDKVpF+YKvAT8ZmV7K1Xuiv2/56a/w4Sj57JannW+Py6eSTFFduHHTOjRL04mi4izGC/OGJuqExvOcOagqT9dBGSFAGSFAGSFAGSFAGSFAGSFAGSFAGfk/GeKdyakUhp8AAAAASUVORK5CYII=" style="display: block; margin: auto;" title="" /><br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">add_TA</span>(cpts$segments[[<span class="dv">2</span>]],<span class="dt">on=</span><span class="dv">1</span>,<span class="dt">lty=</span><span class="dv">3</span>, <span class="dt">col=</span><span class="st">"red"</span>)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAMAAAAjXV6yAAABs1BMVEUAAAAAADoAAGYAOpAAZrYzMzMzMzwzM00zM1ozM38zNDQzOm0zPHczTZUzWlozWqAzf8E0Mzw0PHc0UrE6AAA6AGY6M006Ojo6OpA6ZrY6bcc6kJA6kNs8MzM8Mzw8NFI8d/9ERERERGdERIhEZ6hEiMVNMzNNM01NOm1Nlf9SNDNSsf9aMzNaf8FaoOFmAABmAGZmOjpmOpBmZmZmZrZmkNtmtv9nRERnqOJtOjNxOzN3PDN3PDR3d/93//9/MzN/M39/WqB/f8F/oOF/wf+IRESIiIiIxf+OSzOQOgCQOjqQOmaQZpCQkLaQ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GFJEwoGKQMg2g8lZRmxvciiXWV9607kjVzXuWAWVAGVAG1BdAWbRkQBHJgCKSAUUkA4pIBhSRDCgiGVBEMqCIZEARyYAikgFFJAOKSAYUERfQ0VPFGh4+Utx+nu7wT56CuDuifw7u2XOVX9rmH/vrSlUWbKCqlZs0Tbdu2w5qR5v2VQ/uLkp11eq7gGh74xFN3l0X2bvrPAXHxYjVc6wGkFWwiWoJUF3Th9/2lRs37asefI4yePS83zStrkK/oEhv294vxDf35rZsciRVRzzl8PeM7u7nv1kCREvvjriKVbCJKlNu3DQtWP5umjXtqzJAVI/aybE9aie3C1RHT5+v0i/+s8faWRMG9pLo5aE8HPopU1jRe/5cB8gUbKTKFBo3TT8OHmvXtK/KAe2v8xyat7/GNR4xQ8zXLyjGYsQb01+jMkH2+aYuulsUxXrka9StRFWZcuOmUY6lFk37qtKCxrRHa9pksEa/YKNP95KPvYNPi07yTzEaRe6hYwbjETVMnm1NBLKViKpUbtw0+yZH7Zr2VeUcpJrkJw9haBX6BZ0DvrWuesln77H8vvmnPcO7R0lHNz/tfHZUPpVEVKVy46blVpumA6rsLEaVaUNjcUKjZY7tVenn66CIZEARyYAikgFFJAOKSAYUkQwoIhlQRP4PLh0vN1v4y08AAAAASUVORK5CYII=" style="display: block; margin: auto;" title="" /><br />
</div>
<div class="section level2" id="supports-resistance">
<h2>
Supports/ Resistance</h2>
Supports and resistance levels are very popular tools for technical analysis. The function <code>find.pivots</code> implements a couple of ways to identify supports and resistance levels for a price series. Using the option <code>FIB</code> will produce a set of Fibonacci levels around the most recent price point. The option <code>SR</code> will run an algorithm to find co-linear points along x-axis (horizontal line) to find levels most tested in recent times. A set of levels as well as xts representation of the lines defined by them are returned<br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">spx <-<span class="st"> </span>quantmod::<span class="kw">getSymbols</span>(<span class="st">"^GSPC"</span>, <span class="dt">auto.assign =</span> <span class="ot">FALSE</span>)
spx <-<span class="st"> </span>spx[<span class="st">"2014::2015"</span>]
sups <-<span class="st"> </span>techchart::<span class="kw">find.pivots</span>(spx, <span class="dt">type =</span> <span class="st">"FIB"</span>)
<span class="kw">summary</span>(sups)</code></pre>
</div>
<pre><code>## supports and resistance:
## next 3 supports:1982.249 1936.355 1890.461
## next 3 resistance:2130.82</code></pre>
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">sups <-<span class="st"> </span>techchart::<span class="kw">find.pivots</span>(spx, <span class="dt">type =</span> <span class="st">"SR"</span>, <span class="dt">strength =</span> <span class="dv">5</span>)
<span class="kw">summary</span>(sups)</code></pre>
</div>
<pre><code>## supports and resistance:
## next 3 supports:2043.688 1992.551 1895.028
## next 3 resistance:2070.407 2111.588</code></pre>
</div>
<div class="section level2" id="price-envelop-identification">
<h2>
Price Envelop Identification</h2>
Price envelopes features are an integral part of technical analysis. For example technical analysts look for features like trending channel, or ascending triangles etc to identify continuation or breakout from current price actions. The function <code>find.tchannel</code> identifies the most recent such envelopes using an implementation of the popular Hough transform algorithm in image processing, along with some heuristics.<br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">spx <-<span class="st"> </span>quantmod::<span class="kw">getSymbols</span>(<span class="st">"^GSPC"</span>, <span class="dt">auto.assign =</span> <span class="ot">FALSE</span>)
spx <-<span class="st"> </span>spx[<span class="st">"2016-01-01::2016-09-30"</span>]
tchannel <-<span class="st"> </span>techchart::<span class="kw">find.tchannel</span>(spx,<span class="fl">1.25</span>)
tchannel</code></pre>
</div>
<pre><code>## name: channel
## type: neutral
## direction: 0
## threshold: NA</code></pre>
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">chart_Series</span>(spx)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAMAAAAjXV6yAAABNVBMVEUAAAAAADoAAGYAOpAAZrYzMzMzM1ozM38zWlozWqAzf8E6AAA6AGY6Ojo6OpA6ZmY6ZpA6ZrY6kJA6kLY6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TkSuQmCC" style="display: block; margin: auto;" title="" /><br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">add_TA</span>(tchannel$xlines$maxlines[[<span class="dv">1</span>]],<span class="dt">on=</span><span class="dv">1</span>, <span class="dt">lty=</span><span class="dv">3</span>, <span class="dt">col=</span><span class="st">"brown"</span>)</code></pre>
</div>
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAMAAAAjXV6yAAABd1BMVEUAAAAAADoAAGYAOpAAZrYzMzMzM00zM1ozM38zTZUzWlozWqAzf8E6AAA6AGY6M006Ojo6OpA6ZmY6ZpA6ZrY6bcc6kJA6kLY6kNtERERERGdERIhEZ6hEiMVNMzNNM01NOm1Nlf9aMzNaM39af8FaoOFmAABmADpmAGZmOmZmOpBmZgBmZjpmZmZmkNtmtv9nRERnqOJtOjNtx/9/MzN/M39/WqB/f8F/oOF/wf+IRESIiIiIxf+QOgCQOjqQOmaQZpCQkLaQkNuQ27aQ2/+VTTOVTTqVlf+V//+gWjOg4f+lKiqoZ0So4v+2ZgC2Zjq2Zma2kDq2tma2tv+2///BfzPBf1rBwf/B///FiETF///HbTrHbU3H///bkDrbkGbbtmbb/7bb/9vb///hoFrhoH/h///iqGfi///w8PD19fX/lU3/tmb/wX//xYj/x23/25D/29v/4aD/4qj//5X//7b//8H//8X//8f//9v//+H//+L///+lQNo+AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAP90lEQVR4nO2dC2PcRhGAFccLhbaQAoFzH0AAh7Q0vQRKwZDQAg6Uqr0UuJS0hQtgE3rppZgmDpjuj2ffmn3rdDrnJM0kJ1uandHu531Imt1TQVGSUjzuDGy6IKCMIKCMIKCMIKCMIKCMIKCMIKCMIKCMIKCMIKCMIKCMbBqgk+tFcfaATooz+2zv+NKU0llRbAsdPFjt0tlIWr5xUMOcJxip3WJcOYnKpgFasMJMxouzB+w/XRRbU3WEq8DBapftywIfvVLHfGZ2tzk/7SQuYU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+5lBnRDOoDMmebjVkj9O1mo2AJXIkDmoxPXp8y15MIIHHIq0GjxeWxyNHEB8Rbvap0HqDKjLm3uxyREWbgZ8RVhs7GVbOx0+PMtlUL9EvgShjQvXv3+GebfYp7agd+xOYi+yzYZwpTjPjOmH0uu8nNzjllZ2mPlZlw8FVXqzMy8pwdqV/OuafiDsWmUFm1tBP2OdCn29KKpQEFC5g/kNGOsrbjtk5FHYeZgnQGUGun0r94NWijAa2gXa+zJQAVg5RlAAWPphTJ64WGuuQlSLOcLG+HgDIaBJTRIKCMBgFlNGlvKAgoJwgoIwgoIwgoIwgoIwgoIwgoIwgoIwgoIwgoIwgoIwgoIwgoIzagk+ti0oMJXW9N1ZHZmOvOHmS8OfMpKuNm7pTA2Qmru/QndggPyo3n0wYk4pAsrTgPU89kZJI5HYtdP+5riTufojJu5E4LBLSyy8DEDuZBhK/FYddnYc3fuLMvpkN8/SX1h1iMxZHjPzKzd3+Q/fu4szcq40buKkBV8H1ll8GJHSevT2XRfZ+FNX/jJlccPfM3Bej4pYOb0k5Gt5NB7MDsjcq4ibsgoNVdBiZ2HF/c1o49n4U1f0OQmxVFIe0uTVWd4tp3p7nTe7M37lilWdZdEFArLv2JHYuRqUGOz8Kav6Ea4rGoQUdfmpojsnkv0i3cm71RGTdxp51a0zdWdhmY2CGrk+qDXJ8Fq3GXRxqQ6r0lIE55tMQYwdGzzR/4pDMJyBpylnWnhFXLbd5lnBv7o1gjlxPexJjDYqSnxwk7PYq5Ptu/DqrbcB6/1MopAsoIXklnBAFlBAFlBAFlBAFlBAFl5P+vknm7JwLQYgAAAABJRU5ErkJggg==" style="display: block; margin: auto;" title="" /><br />
<div class="sourceCode">
<pre class="sourceCode r"><code class="sourceCode r">quantmod::<span class="kw">add_TA</span>(tchannel$xlines$minlines[[<span class="dv">1</span>]],<span class="dt">on=</span><span class="dv">1</span>, <span class="dt">lty=</span><span class="dv">3</span>, <span class="dt">col=</span><span class="st">"brown"</span>)</code></pre>
</div>
<img alt=""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VJtEFmnAUpcWdGEpBovTkgSnlUo4+g6Mnh13TRGQekdTl1oxNCiuUGbTKOj+1erFGUE1rFSITFSC6PY3ayFzPjbH8clFpxDl+SUpoBRSSPpCOSAUUkA4pIBhSRDCgiGVBE/g/maS0kyelwUgAAAABJRU5ErkJggg==" style="display: block; margin: auto;" title="" /><br />
The function returns an object with parameters of the envelopes found (if any), as well as the xts representation of the envelopes lines<br />
</div>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com2tag:blogger.com,1999:blog-1540057389458334563.post-10581093062554488192016-10-15T13:17:00.000+01:002016-10-15T14:32:09.611+01:00Central Bank Watch: FOMC Minutes (and RBI)<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
It is highly interesting to see the <a href="http://ftalphaville.ft.com/2016/10/13/2177209/bernstein-sets-itself-against-the-dcf-model-in-a-zero-rate-world/" target="_blank">views </a>and <a href="http://ftalphaville.ft.com/2016/10/14/2177257/aswath-damodaran-doesnt-quite-agree-with-bernsteins-bashing-of-dcf-models-under-zero-rates/" target="_blank">counter-views</a> on the impact of low rates on the <a href="https://en.wikipedia.org/wiki/Discounted_cash_flow" target="_blank">DCF </a>industry. I think both miss the subtle point <a href="http://prodiptag.blogspot.co.uk/2016/08/macro-end-of-qe-topia.html" target="_blank">here </a>. All these DCFs and <a href="https://en.wikipedia.org/wiki/Present_value" target="_blank">PVs</a> and pretty much everything else depends on an assumption of properly functioning lending and borrowing market. The question is: if negative rate does persist for long, will that assumption breakdown, or will adapt.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Speaking of rates, the <a href="https://www.federalreserve.gov/monetarypolicy/fomcminutes20160921.htm" target="_blank">FOMC minutes</a> released this week was very informative. It was a much ambivalent FOMC than we have seen earlier. It appears the September hold decision was a close call. So it is safe to assume it will be so in November and December (if no hike in Nov) as well.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On the major points that drives the"data dependent" FOMC, it seems the consensus is on the labor markets. Since the last meetings, we had more or less similar or slightly improved wage data. However, this week's job opening (JOLT) was a bit disappointing. On economic growth expectation, retails sales data from Friday was more or less on the mark, matching street expectation, and capital goods from earlier has shown improvement as well. Even the much discussed negative influence of foreign GDP has subsided. Eurozone forecast edged up to 1.3% from 1.2%, and UK forecasts from 0.50% to 0.70% (since Sep FOMC). </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, surprisingly, on both of these parameters, Fed's own measure is going the other way. The Labor Market Condition Index and the Atlanta Fed's GDP now-casting have both nose-dived in recent readings.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-Ah8DBkewGdM/WAIULRSdoLI/AAAAAAAAFKY/CEj2t_Jq1iUSAMsEVn7mwuQZ4uqu_loxQCLcB/s1600/fedgraph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://2.bp.blogspot.com/-Ah8DBkewGdM/WAIULRSdoLI/AAAAAAAAFKY/CEj2t_Jq1iUSAMsEVn7mwuQZ4uqu_loxQCLcB/s640/fedgraph.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
On the inflation front, the both the CPI and PCE edged up since. The CPI is still suffering from energy prices drag. Given the recent moves in oil prices, this should have a positive impact on data before the next meeting. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-vf4Ig-cdp4I/WAITEBD03VI/AAAAAAAAFKM/IdrsaYWac8Ejbx9OxJWynSpES4C794NfACLcB/s1600/cpi.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="218" src="https://1.bp.blogspot.com/-vf4Ig-cdp4I/WAITEBD03VI/AAAAAAAAFKM/IdrsaYWac8Ejbx9OxJWynSpES4C794NfACLcB/s640/cpi.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Overall, I expect the data to be neutral for both employment and growth and marginally hawkish for inflation for the November meeting. The possibility of a November hike is still lower. Partly, that will be a surprise for the markets - which currently prices in a 17% chance of a hike at November FOMC and a 64% at the Dec meeting. As I <a href="http://prodiptag.blogspot.co.uk/2016/05/june-fomc-last-chance-of-fed-to-make.html" target="_blank">discussed before</a>, Fed has never hiked before without a substantial chance priced in by the markets.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
That said, one particular line of arguments stands out from the released minutes:</div>
<blockquote class="tr_bq" style="text-align: justify;">
<span style="background-color: white; font-family: "arial" , "helvetica" , sans-serif; font-size: 12.8px;"> A few participants referred to historical episodes when the unemployment rate appeared to have fallen well below its estimated longer-run normal level. They observed that monetary tightening in those episodes typically had been followed by recession and a large increase in the unemployment rate. Several participants viewed this historical experience as relevant for the Committee's current decisionmaking and saw it as providing evidence that waiting too long to resume the process of policy firming could pose risks to the economic expansion, or noted that a significant increase in unemployment would have disproportionate effects on low-skilled workers and minority groups.</span></blockquote>
<div style="text-align: justify;">
There were only two major hike cycles not followed by a rise in unemployment in recent history. One was following the early 80s recession, and the other following the early 90s recession. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-cjOvUe1reuE/WAISpWPgETI/AAAAAAAAFKI/7Wqsml0Mvrcct5RKAHA641UgObkdQfKvwCLcB/s1600/fredgraph.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="246" src="https://2.bp.blogspot.com/-cjOvUe1reuE/WAISpWPgETI/AAAAAAAAFKI/7Wqsml0Mvrcct5RKAHA641UgObkdQfKvwCLcB/s640/fredgraph.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This points towards a strong commitment of FOMC towards a gradual rate hike, even if the initial hike has to be brought forward in time. It will be very surprising if we do not have another hike by the end of the year. But this, along with the now-lower long term equilibrium rates, also means it will NOT be particularly threatening to US equities or rates in general (both slopes and levels). Fade the move if any respond violently to FOMC one way or the other.. Both equities and rates should depend less on FOMC and more on intrinsic and unexpected events.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Talking of unexpected evens, the one is of course the US presidential election. The general expectation is a sell-off if Mr Trump wins. Although I fail to see a rally even if it is Mrs Clinton. And of course market expectation can be wrong. In 2012, it was widely expected that a Obama win will be bad for equities, and indeed there was minor sell-off leading up to the election day. However the results marked the start of a long stretch of bull run.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
October was also a historic moment for Reserve bank of India. It was a new Governor (following the exit of Raghuram Rajan) and its first ever Monetary Policy Committee decision. And it was a decision quite difficult to understand - an (mostly) unexpected 25 bps cut. RBI revised GDP higher, and both real rate and inflation lower. A lower real rate expectation usually means a lower potential GDP. That means a higher GDP will lead to a potential overheating. A lower inflation rate is not consistent with this, unless RBI is expecting substantial imported disinflation.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-fCDeP6f9f3Y/WAIbu_1YhZI/AAAAAAAAFKs/pM_IRmiyH1w9CkqvzvmA99tJTksEEunTgCLcB/s1600/rbi.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="https://3.bp.blogspot.com/-fCDeP6f9f3Y/WAIbu_1YhZI/AAAAAAAAFKs/pM_IRmiyH1w9CkqvzvmA99tJTksEEunTgCLcB/s640/rbi.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
India's decreasing credit growth is a worry, but it is not clear higher rates are the culprit here. The decline is driven mostly by the industrial sector - which presumably has more on its plate than to worry about higher rates. And in any case the pass through of RBI rate cuts by the banking sector has not been exemplary in recent time -which has been mired in its own significant bad loan problems. It was appeasing to the markets (and politics perhaps), but hard to imagine how much, if at all, it will help the economy forward.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-30161391998846198182016-09-18T13:07:00.001+01:002016-09-18T13:25:20.741+01:00Markets: Volatility Ahead<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Finally we had a little bit of excitement back in the markets, and a vindication of sort for the numerous bears. Analysts from <a href="http://ftalphaville.ft.com/2016/09/16/2175187/its-all-about-macro-charted/" target="_blank">Citi confirm</a> the macro drivers to blame. Indeed the cross market correlation has been on the rise. Below table shows the current cross market correlation<sup>1</sup>. As it shows, rates and inflation still remain the major drivers, along with a very high level of correlation between commodities and currencies.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-clOhvjttwmI/V9wE11IeDpI/AAAAAAAAFIY/NAKi9LivyLkzGZn8A7qYY2CwAu7q_7QTwCEw/s1600/chart1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="https://1.bp.blogspot.com/-clOhvjttwmI/V9wE11IeDpI/AAAAAAAAFIY/NAKi9LivyLkzGZn8A7qYY2CwAu7q_7QTwCEw/s640/chart1.png" width="640" /></a></div>
<br />
<br />
<span style="text-align: justify;">The chart below shows average correlation across asset classes. The recent spike is still far away from the levels around August 2015, but clearly captures the market sentiment.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-QsJnc9hTZaE/V9wFALRD4GI/AAAAAAAAFIc/ubQ5YwUZLfMzI5y2rAVMnVM8IC2EoKKkQCLcB/s1600/chart2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="474" src="https://3.bp.blogspot.com/-QsJnc9hTZaE/V9wFALRD4GI/AAAAAAAAFIc/ubQ5YwUZLfMzI5y2rAVMnVM8IC2EoKKkQCLcB/s640/chart2.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
And this sentiment is what is reflected in the latest <a href="http://www.aaii.com/sentimentsurvey" target="_blank">AAII release</a> last week. The market neutrals and bears remain significantly above the historical average as we have during most of this post-crisis bull runs. The change to highlight is an increase in bears at the expense of mostly the neutrals. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For a contrarian, this would signal a limited scope of continued sell-off. However the other factor is positioning on the derivatives side. I have <a href="http://prodiptag.blogspot.com/2016/07/markets-rise-of-vol-tourists.html" target="_blank">written about this</a> before, but you must have already observed the change in the intraday price patterns in S&P. During much of last few months, it showed a strong mean-reverting characteristics (opening price shocks reversed during the day). For last few session starting from the 9th sell off, it seems the intraday trends are self sustaining now. That is confirmed on more quantitative measures as well. The chart <sup>2</sup> below shows two approximate indications of short gamma positioning of the dealers. The idea behind this is in a market where the dealers (i.e. the hedgers, as opposed to players who hold options positions unhedged) are short gamma (net sellers of options), the natural hedging activity will create price pressure that will tend to amplify a price move (a up move in to a sustained rally and vice versa). On the other hand, when the dealers are net long, this will tend to stabilize price moves. Much of the stability in S&P intraday move for past few months can, at least partially, be attributed to net long position from the dealers, which appears changing now, as the short term intraday trends get stronger and sustain longer.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-t0I6Hwd7_Z8/V95651fu7jI/AAAAAAAAFJE/M-kiEoC00ogzhgWdSPCn9I0SvJDwxH5TQCLcB/s1600/trends.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://2.bp.blogspot.com/-t0I6Hwd7_Z8/V95651fu7jI/AAAAAAAAFJE/M-kiEoC00ogzhgWdSPCn9I0SvJDwxH5TQCLcB/s640/trends.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
On the valuation side, however, S&P is still not screaming over-valued. Below chart shows world equity markets valuation vs trends (past 1-year returns) in two measures. The left one is the regular P/E measure, on which S&P is quite in the red zone, along with India and only second to Mexico. However, just going by historical P/E in a world of zero rates can be highly misleading. In terms relative valuation to bonds, S&P is quite in the middle.<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-7ZC1fxmm-6Q/V9wTQkofqFI/AAAAAAAAFIw/Kj3AX5_EnV0SRfjepNTvX5S55TV8cI2_QCLcB/s1600/chart4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="350" src="https://1.bp.blogspot.com/-7ZC1fxmm-6Q/V9wTQkofqFI/AAAAAAAAFIw/Kj3AX5_EnV0SRfjepNTvX5S55TV8cI2_QCLcB/s640/chart4.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
If you followed the <a href="http://prodiptag.blogspot.com/2016/08/trade-ideas-macro-trades-fall-winter.html" target="_blank">trades from my last post</a>, it would have been a good couple of weeks capturing most of the major moves in the markets in the right direction. Looking ahead, if you are a bear, the investor sentiments and the valuation is not at a very helpful support to go big short at current levels. On the other hand the change in the gamma signature of the markets tells us unless something changed after Friday's expiry, we will continue to see decent swings and volatility will pick up. Although vols are not particularly cheap (relative to realized, yet), and I think given the reasons <a href="http://prodiptag.blogspot.com/2016/07/markets-rise-of-vol-tourists.html" target="_blank">discussed before</a>, it still makes more sense to buy options than to buy VIX here.</div>
<br />
<div style="text-align: justify;">
A traders' market after a long time. Brace for the upcoming Fed, but more for the BoJ. Going beyond equities, the major moves in rates (one of the major driers across asset classes now) has been set in motion by BoJ arguably. The recent bout of steepening in fixed income started with a <a href="http://www.bloomberg.com/news/articles/2016-09-06/there-s-been-a-quiet-riot-in-japanese-government-bonds" target="_blank">bout of sell-off</a> in JPY rates markets. This transmitted to rest of the world following ECB, with sharp steepening across EUR, USD, and GBP. The built up to the month end BoJ is almost palpable, and if not FOMC, at least this is almost certain to be an interesting event.</div>
<hr />
1. This is based on smoothed data (<a href="https://en.wikipedia.org/wiki/Kernel_smoother" target="_blank">Gaussian kernel </a>smoothed with 5-day bandwidth) to capture medium-term correlation.<br />
<div style="text-align: justify;">
2. The left chart is based on identifying trends quantitatively using <a href="https://en.wikipedia.org/wiki/Change_detection" target="_blank">change point</a> techniques. The idea is as trends become more sustaining the ratio of max to median trends will increase, as shown in the chart. The right hand chart shows absolute value of beta in a simple regression of intraday price to time, capturing the strength of the trend (if any) irrespective of its direction (rally or sell-off).<br />
3. Data from Bloomberg and Google Finance</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-80033994281647503022016-08-31T19:49:00.000+01:002016-08-31T19:50:53.484+01:00Trade Ideas: Macro Trades - The Fall-Winter Collection<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
The speech from Fed Chair in the Jackson hole was quite <a href="http://www.bloomberg.com/news/features/2016-08-26/janet-yellen-s-jackson-hole-speech-annotated" target="_blank">uneventful</a>. The far more interesting was this <a href="https://www.kansascityfed.org/~/media/files/publicat/sympos/2016/econsymposium-sims-paper.pdf?la=en" target="_blank">one</a>. It was a while back the ever useful <a href="http://blog.mpettis.com/2015/01/interview-on-chinese-cpi-and-ppi-data-for-december/" target="_blank">Michael Pettis</a> hinted at how rate cuts can be deflationary - exactly the opposite of mainstream central bank thought process. This represents another argument, and how crucial fiscal participation is in delivering monetary objectives.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Talking of central banks, this month is another one for central bank focus. Starting with ECB next week, followed by BoE around middle of the month, and ending with Fed and BoJ towards the end, the mood of the market is expected to swing based on these policy outcomes. The general expectation is a hawkish Fed while the rest continues the dovish stance. Here are the top 5 trade to consider for the moment.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>#1: <u>Pay USD 10y swap spread</u></b>: USD swap spread was hammered just after the last FOMC hike in December, but now on a slow yet firm upward trend. Theoretically, swap spread should be determined by the expected futures spread on GC rate vs libors. While empirically this had little influence for US treasury swap spreads in the past, still this is an important metrics. And if you have not been gone for long for the summers, it is hard to miss the <span id="goog_1413299601"></span>sharp widening<span id="goog_1413299602"></span> of the spot spread of GC vs libor - mainly influenced by the s<a href="http://www.bloomberg.com/news/articles/2016-08-08/there-s-a-big-dollar-crunch-brewing-in-markets" target="_blank">harp increase in libor rate</a>. There is a good reason for this, as the market regulations kicking in forced quite a few prime money market funds from bank-issued commercial papers to US treasuries, pushing up the borrowing cost for the banks. It appears so far this yet has to be passed through the swap spread prices in any form or substance. On top, a pay position in swap spread (pay swap, receive treasury) has been highly directional with general rates levels historically. Given this correlation and the current levels (near the bottom of the trend channel), this represents an efficient position for any FOMC hawkishness, especially unexpected ones. This also benefits from a positive roll-down. In addition, this position is empirically should be somewhat long volatility - quite an asymmetric position at current levels.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-6uYBPFT55gQ/V8b24mn1DhI/AAAAAAAAFHs/XjAJS70mZq0ju4aJGnhmIEPYCWEexQXLgCLcB/s1600/pic1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://2.bp.blogspot.com/-6uYBPFT55gQ/V8b24mn1DhI/AAAAAAAAFHs/XjAJS70mZq0ju4aJGnhmIEPYCWEexQXLgCLcB/s640/pic1.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
<b>#2: <u>Pay GBP 10s30s steepener</u></b>: Following Brexit, the long end sterling curve steepened sharply, followed by an equally sharp flattening after the early August BoE. This is presumably a reaction from the QE announcement, but it is not entirely intuitive. While we had similar sharp flattening move in Euro after ECB QE in early 2015, the large difference in size between this two perhaps points towards a bit over-reaction (ECB's initial €60b per month, later €80b, compared to BoE's £10b per month, i.e. £60b over 6 months). Not only in terms of absolute size, the ECB QE is also larger in comparison with the supply - for example at the ECB capital key, Germany amounts to approx €20b per month currently, compared to a gross supply of around €16b per month (as per <a href="https://www.bundesbank.de/Redaktion/EN/Downloads/Service/Bundeswertpapiere/annual_forecast.pdf?__blob=publicationFile" target="_blank">Bundesbank projection figures</a> for this years). For the UK, this compares to £10b per monthly to £11b of monthly supply (as per <a href="http://www.dmo.gov.uk/reportView.aspx?rptCode=D5B&rptName=46956827&reportpage=Gilts/Net_Issuance_Data/D5B" target="_blank">UK DMO projections</a>). This does not correct for the German securities trading at an yield lower than ECB depo rate (and hence not eligible for QE), and also the fact that ECB QE will extend beyond the BoE one, hence the actual difference in supply pressure is much more acute. The second interesting point to note is the maturity distribution (see chart below). UK has a squeeze in the middle segment (belly, i.e. 7 year to 15 year remaining maturities) of the curve, whereas the squeeze for ECB is mostly in the long end, putting a relative rally pressure in the belly UK Gilts curve. Add to this the facts that the market price of expected inflation spread between UK and Euro area (breakeven inflation swap) has actually widened following Brexit. This is presumably influenced by the sharp decline in GBP vs USD, but this inflation premium somehow has to be priced in the nominal rates which in general should exert a steepening pressure. This combination makes a steepening position for GBP 10s30s attractive. One of the possible reason for such a sharp flattening can be the expressed intention of the BoE governor to <a href="https://www.bloomberg.com/view/articles/2016-08-10/memo-to-carney-the-u-k-already-has-negative-rates" target="_blank">steer clear of negative rates</a> and that remains a risk (somewhat mitigated by a still 25bps to go). Other risk is a sudden strong recovery in UK economy, which will weaken the case for steepening.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-p2qoiR3DimA/V8b2-G5EvFI/AAAAAAAAFHw/74dvLBQmxc0f2h58fRoEHqtAIoipzGemACLcB/s1600/pic2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://2.bp.blogspot.com/-p2qoiR3DimA/V8b2-G5EvFI/AAAAAAAAFHw/74dvLBQmxc0f2h58fRoEHqtAIoipzGemACLcB/s400/pic2.png" width="400" /></a></div>
<br />
<div style="text-align: justify;">
<b><u>#3: Equity bearish protection</u></b>: For all those bears out there, shorting the all time highs have been as appealing as it has been money loosing since June. The equity markets around the world has been quite oblivious to shocks. FTSE 100 had one of the best runs in Europe. European equities have been less spectacular, but nonetheless not in correction territory. Nikkei 225 handled strengthening yen better than expected. Even EM had a decent run. The key has been the amazing resilience of S&P 500 - and appears everything is now pending on a breakdown in the US equity market. As a result, S&P is now trading at tad lower from all time high, and tad higher than all time low realized volatility. On top, last print from CFTC traders positioning shows the highest ever short positioning in VIX. But there are potential issues on the horizon to be cautious, FOMC in September is the obvious one, South African political situation may be a trigger, or sometimes things <a href="http://ftalphaville.ft.com/2014/07/17/1901352/because-low-vol-just-happens-some-times/" target="_blank">just happen</a>. Fortunately, we also have the S&P calendar vol spreads around the highs. This present a good cautious positioning of buying the near term puts vs long term (e.g. 3m/6m) - relatively less damning long gamma position. A large downside move in the US equity market will almost certainly have repercussion across the globe, and if triggered by FOMC, especially across the emerging markets.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b><u>#4: Pay Cross-currency basis widener in EUR</u></b>: One for the long-ish term - this is a reversal of <a href="http://prodiptag.blogspot.co.uk/2014/10/euro-glut-global-look.html" target="_blank">Euro savings</a> <a href="http://ftalphaville.ft.com/2014/10/06/1996952/behold-the-euroglut/" target="_blank">glut</a> trade. Since the start of the financial crisis, the cross currency basis widened as everyone panicked after dollar funding. Subsequently during the period of European sovereign crisis, this basis remained under stress, and only started normalizing after the <a href="https://www.ecb.europa.eu/press/key/date/2012/html/sp120726.en.html" target="_blank">whatever it takes</a> promise from ECB's Draghi. However, after peaking at around mid 2014, this basis (not only in Euro, but across major currencies like GBP and JPY), started widening again. My theory is: this time it has less to do with financial market panic and shortage of dollar funding from the liability side, and more with the savings glut on the asset side. In such a scenario, asset managers willing to invest in higher yielding assets (like US treasuries or equities) will swap their euro funding with a euro vs dollar cross currency swap (effectively a dollar loan against euro) and paying dollar interest vs receiving euro interest. As more and more money chase this trade, there will be a receiving pressure on the euro leg, pushing the basis down. The fact that this is asset driven and not liability driven is corroborated by a flattish slope in the basis for different maturities. During the panic days, it was a strictly inverted slope (e.g. 1y tenor wider than 5y), which is now reversed or almost flat. Given this, any recovery in the euro area (and indeed globally) consumer and investment spending will set the direction in a reverse trend. Currently the levels are near short term support. Also given the slope as mentioned above, this benefits from a positive roll-down. This is a relatively low risk and low cost of carry trade for global economic recovery. The alternative is of course that long-dated forward trade in euro. But I like this one better at the moment: the long dated forward can remain stuck even after normalization (i.e. end of savings glut), but the basis will surely feel the pressure. Plus the once juicy carry in those long-dated forwards are mostly gone. Reportedly, there is currently a dollar funding shortage, on account of the money market regulation change mentioned above. But also reportedly a large part of the switch from CP to treasury is done.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>#5: The ECB Trade</b></u>: ECB is not BoJ and Euro area is not yet Japan. The question is if you see them converging or diverging. The chart below shows market reactions in rates and FX for recent major central bank decisions in Euro area and Japan. Note how in recent time, ECB meetings followed a rally in Euro and a flattening in the curve. Also note how the similar the reaction was in BoJ. And finally, how the last one from BoJ in July end, which underwhelmed the market, reversed the flattening trend, with less pronounced effect and in fact a net steepening. The story of QE is perhaps <a href="http://prodiptag.blogspot.co.uk/2016/08/macro-end-of-qe-topia.html" target="_blank">running out of steam</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-S2JLSwORKzM/V8b3LGHXrFI/AAAAAAAAFH0/mo7ef-k9L4YkD4rZhoJkkOATjQeNGxDigCLcB/s1600/pic3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://2.bp.blogspot.com/-S2JLSwORKzM/V8b3LGHXrFI/AAAAAAAAFH0/mo7ef-k9L4YkD4rZhoJkkOATjQeNGxDigCLcB/s640/pic3.png" width="640" /></a></div>
<br />
<div style="text-align: justify;">
I expect similar reaction for ECB even if they announce a QE extension beyond September 2017. The standard trade will be fading the move, which is as of today expected to be a steepener. However, a rally in Euro may be more difficult in the short term as the focus shifts immediately to Fed. </div>
<hr />
All data from respective treasury offices, and Bloomberg.</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-18539555297342462772016-08-18T22:57:00.000+01:002016-08-19T05:05:04.302+01:00Systematic Trading: Getting Technical with Technical Indicators<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
There are few investors and traders who have never used a technical indicator. Some use them as part of their core trading strategies, others as confirmation or as a timing tool. I am reasonably certain even the most ardent value investors perhaps look at them in time of trials and tribulations. The set of these indicators are large (and ever increasing) as different ones developed over course of time, often from different markets and asset classes<sup>1</sup>. This is usually not a problem, as most practioner will settle down with one or two favorites.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, most indicators have a lot in common among them. They are usually a function of past and present market data. They can be usually expressed as a function of returns of the underlying, and they tend to move in a range (though not always statistically stationary<sup>2</sup>).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Taking the example of a simple one - the moving average cross-over indicator. This is expressed as a difference of two moving averages (a short and a long ones). Mathematically, this can be represented as $mom=\sum_{i=0}^{n_1} a_i.P_i - \sum_{i=0}^{n_2} b_i.P_i$, where $n_1$ and $n_2$ are the short and long moving average periods, $a_i$s and $b_i$s are the weights (for simple moving average $a_i=1/n_1$ etc.) and $P_i$s are the prices. It <a href="http://prodiptag.blogspot.co.uk/2015/11/time-series-momentum-strategies-spirits.html" target="_blank">can be shown</a> that this can be converted from this price space to returns space, as $mom=\sum_{i=0}^{n} w_i.r_i$. Here $r_i=P_i - P_{i-1}$ (returns assuming log prices) and $n=n_2$ from above.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Similar treatment can be applied to other common indicators to convert them as a function of returns $r_i$s. A few example <sup>3</sup> below:</div>
<div style="text-align: justify;">
</div>
<ul>
<li>Momentum cross-over = $\sum_{i=0}^{n} w_i.r_i$</li>
<li>MACD Histogram = MACD line - signal line = $\sum_{i=0}^{n1} w_i^1.r_i$ - $\sum_{i=0}^{n2} w_i^2.r_i$ $\Rightarrow$ $\sum_{i=0}^{n} w_i.\Delta{r_i}$, Here $\Delta{r_i}=r_i - r_{i-1}$. This follows from logic similar to the momentum crossover above, and noting the difference of sum is in returns terms instead of prices.</li>
<li>CCI = (Price - Average Price)/(0.15 x Mean Deviation) = $\frac{1}{\sigma}\sum (P_i - \bar P)$ $\Rightarrow$ $\frac{1}{n.\sigma}\sum (r^{n}+r^{n-1}+..+r)$ $\Rightarrow$ $\sum w_i.r_i$, where $r^k = r_i - r_{i-k}$</li>
<li>Know Sure Thing = (RCMA1 x 0.1) + (RCMA2 x 0.2) + (RCMA3 x 0.3) + (RCMA4 x 0.4) = $a1.\sum w_1.r^{n_1} + a2.\sum w_2.r^{n_2} + a3.\sum w_3.r^{n_3} + a4.\sum w_3.r^{n_3}$ $\Rightarrow$ $\sum w_i.r_i$</li>
</ul>
<br />
<div style="text-align: justify;">
Similarly most others can be expressed as a function of returns, although not all of them as linear (or even polynomial) as above. Broadly, we can divide all common technical indicators that can be expressed as function of returns in three different classes <sup>4</sup> - </div>
<div style="text-align: justify;">
</div>
<ul>
<li>Indicators that are linear (or polynomial) combination of past returns in returns space ($f(r)$). Examples - the ones above. Under certain condition (<a href="https://en.wikipedia.org/wiki/Stationary_process#Weak_or_wide-sense_stationarity" target="_blank">stationarity</a>) they can be modeled as Gaussian distribution</li>
<li>Indicators that are functions of sign of the returns in signed returns space ($f(r^+, r^-)$). Examples - like RSI or Chande Momentum Oscillator. They can be analyzed using <a href="https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=abs%20x%20distribution" target="_blank">folded normal distribution</a></li>
<li>Indicators that are function of returns in time space ($f(t(r))$). An examples is the <a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:aroon" target="_blank">Aroon</a> indicator</li>
</ul>
<br />
<div style="text-align: justify;">
One objective of analyzing commonality of technical indicators can be to choose the one that is best suited to a particular purpose (depending on the time series characteristics of the underlying and the trading strategy). Another, and perhaps more common, can be dimensionality reduction as part of inputs to advanced machine learning based trading systems.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Following figure shows the outcome of principal component analysis of different technical indicators run on different equity indices<sup>5</sup> - showing the first two principal components. Interestingly, for most cases (both in real market data and simulations<sup>6</sup>) the first two components will explain close to 85% or more variance in the indicators. As we can see all indicators load similarly on the first component. This is the underlying momentum component. This component typically explain around 70% variance, and will probably be the choice of inputs in a support vector machine or neural network system incorporating technical indicators. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-_zuKpM-1KnE/V7Ye8dHeuCI/AAAAAAAAFHA/-qiu8wj1ka4o4b9jid9n5yxQTNv4Z8nDACLcB/s1600/technical_indicators_pca.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="418" src="https://2.bp.blogspot.com/-_zuKpM-1KnE/V7Ye8dHeuCI/AAAAAAAAFHA/-qiu8wj1ka4o4b9jid9n5yxQTNv4Z8nDACLcB/s640/technical_indicators_pca.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The second component is where the indicators differ a lot. This component captures the signature of the filtering carried out by the indicator. This signature has two parts, one is the intrinsic method of the filter computation. For example from the above formulate, we see MACD is a function of difference of returns and hence will tend to behave more like <a href="https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average#Differencing" target="_blank">over-differenced</a> series (assuming the returns are stationary). In contrast, KST will have a large component which is simply sum of returns, and hence will behave more like a non-stationary series in the limit. Indeed, for common parameters for these indicators (representing a look back of 20 days), the time series characteristics of these signals can be captured in the following (inverse)<a href="http://davegiles.blogspot.co.uk/2013/06/when-is-autoregressive-model.html" target="_blank"> unit root circle</a> plot (here roughly speaking, closer the plotted points, i.e. roots, towards the center of the circle, more mean-reverting is the series)</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-EcHIXMIipOs/V7YhGJOKaaI/AAAAAAAAFHM/PQlcn54mPNcejicVkwgBDFa17HIZ90HLwCLcB/s1600/unit_root_circle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="556" src="https://1.bp.blogspot.com/-EcHIXMIipOs/V7YhGJOKaaI/AAAAAAAAFHM/PQlcn54mPNcejicVkwgBDFa17HIZ90HLwCLcB/s640/unit_root_circle.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
We can see from the PCA plot there are four major groups of indicators based on their time series characteristics - MACD, which is very much mean-reverting (i.e. suitable for short term trends), KST (which is quite the opposite) and then we have two groups - one consisting the first type of indicators noted above (function of returns) and the other group consists of the second and third types (function of signed returns and returns in time space). This is validated in the unit root plot as well, we see MACD has roots much closer to the center, KST almost on the circle perimeter, RSI quite close to it, and Bollinger bands closer to the center relatively.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Another way to appreciate how different indicators impact the momentum signal differently, is to look at how they filter the components of the underlying (returns in this case) at different frequencies - as seen in the<a href="https://en.wikipedia.org/wiki/Spectral_density_estimation#Parametric_estimation" target="_blank"> AR spectral analysis</a> chart below. Click on the indicators on the right hand side legend to turn them off or on.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
A spectrum that has higher values towards zero frequency (like KST) means they will tend to filter out higher frequency in the data,whereas the ones that has a peak away from zero, or drop off slowly from peak at zero will tend to pick up faster components (in the extreme resembling high negative correlation of a over-differenced signal). Of course as we increase look back period, an indicator will tend to move away from the second kind and towards the first kind.</div>
<div style="text-align: justify;">
<br /></div>
<iframe frameborder="0" height="800" scrolling="no" src="https://plot.ly/~prodiptag/158.embed" width="900"></iframe>
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Using this insight, one can design an appropriate set of indicators to extract an "average" momentum signal, to be used in other strategy or as inputs to a neural networks or similar system.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For this purpose, the first PCA component is the one we seek to use as input as momentum signal, straight and simple. The usefulness of the second component is that it allows us to fine-tune the momentum signal for our purpose. A momentum signal depends on our time frame - a short period momentum can look like mean-reversion in longer time frame. To extract a consistent signal we need to tune the choice of the indicators and parameters. If we are looking to extract momentum signals averaged over different filtering methods, but not over time, we need to ensure all factor loadings on the second component are within acceptable limits. Whereas if we want to span as much frequency spectrum as possible we want the loadings to span much larger space. Depending on out choice we extract the kind of signal we want from the first component<sup>7</sup>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Note, while I mention the first component as momentum signal, it is NOT same as what is known as the <a href="https://www.aqr.com/library/data-sets/time-series-momentum-factors-monthly" target="_blank">time series momentum factor</a>. However, it can easily computed by back-testing trading PnL based on this momentum signal. As we have seen in general these signals can be expressed as $\sum w.r$, the PnL will be (using a linear sizing function) $\sum (w_i.r_i).r_j$, or (using a sign function) $sign(\sum (w_i.r_i)).r_j$. Of course we can approximate the <a href="https://en.wikipedia.org/wiki/Sign_function" target="_blank">signum </a>function, and then in general, the PnL becomes a polynomial of auto-covariances of the underlying returns.</div>
<div style="text-align: justify;">
<br />
<hr />
<span style="font-size: 12px;">1. <a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators" target="_blank">This </a>is a useful place with good introductory materials on different indicators</span><br />
<span style="font-size: 12px;">2. In general an indicators will tend to become non-stationary at a given periodic frequency (e.g. daily) as we increase the look-back parameter</span><br />
<span style="font-size: 12px;">3. There is no guarantee the sum of weights adds up to one. Please feel free to notify me in comments if you spot any error.</span><br />
<span style="font-size: 12px;">4. Here we ignore the indicators that take volume as an input as well</span><br />
<span style="font-size: 12px;">5. All data from Yahoo Finance</span><br />
<span style="font-size: 12px;">6. Based on simulations assuming expected market behaviours, i.e. <a href="https://en.wikipedia.org/wiki/Autoregressive_model" target="_blank">AR </a>or <a href="https://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model" target="_blank">ARMA </a>type return characteristics.</span><br />
<span style="font-size: 12px;">7. One can design an algorithm for this purpose, that will maximize the explained variance by the first component of the PCA, by optimizing over the parameter space of the indicators within a pre-defined set.</span></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-64484910165412507732016-08-09T23:46:00.002+01:002016-08-09T23:48:02.555+01:00Off Topic: Olympic Gymnastics Medal Table Dynamics<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Being the month of summer Olympics, here are some stats from past games while we wait for the tally from Rio (since Barcelona 92). The major highlights are</div>
<ul style="text-align: left;">
<li style="text-align: justify;">The spectacular rise of China, especially after Athens 2004</li>
<li style="text-align: justify;">The emphatic decline of Eastern European countries in medal tally, especially after 2004</li>
<li style="text-align: justify;">The great decline of Russia (includes Ukraine tally, for ease of historical data handling only) and what appears to be a recent comeback</li>
</ul>
<div style="text-align: justify;">
Click the play button in below chart to see how the dynamics evolved. Select the little boxes on the right to track a particular bubble.</div>
<br />
<!-- MotionChart generated in R 3.2.4 by googleVis 0.5.10 package -->
<!-- Tue Aug 09 23:13:05 2016 -->
<!-- jsHeader -->
<script type="text/javascript">
// jsData
function gvisDataMotionChartID3dc41b4a6e64 () {
var data = new google.visualization.DataTable();
var datajson =
[
[
"China",
2012,
5,
4,
3,
12
],
[
"Russia",
2012,
3,
5,
5,
12
],
[
"United States",
2012,
3,
1,
2,
6
],
[
"Developed Asia",
2012,
2,
2,
0,
4
],
[
"Eastern Europe",
2012,
2,
2,
2,
6
],
[
"Lat Am",
2012,
1,
0,
0,
1
],
[
"rest of OECD",
2012,
1,
0,
0,
1
],
[
"Western Europe",
2012,
1,
4,
6,
11
],
[
"Others",
2012,
0,
0,
0,
0
],
[
"China",
2008,
11,
2,
5,
18
],
[
"Russia",
2008,
2,
0,
4,
4
],
[
"United States",
2008,
2,
6,
2,
10
],
[
"Developed Asia",
2008,
0,
3,
0,
3
],
[
"Eastern Europe",
2008,
2,
2,
4,
8
],
[
"Lat Am",
2008,
0,
0,
0,
0
],
[
"rest of OECD",
2008,
0,
2,
0,
2
],
[
"Western Europe",
2008,
0,
3,
3,
6
],
[
"Others",
2008,
1,
0,
0,
1
],
[
"China",
2004,
1,
0,
3,
4
],
[
"Russia",
2004,
4,
3,
3,
7
],
[
"United States",
2004,
2,
6,
1,
9
],
[
"Developed Asia",
2004,
1,
2,
3,
6
],
[
"Eastern Europe",
2004,
4,
5,
5,
14
],
[
"Lat Am",
2004,
0,
0,
0,
0
],
[
"rest of OECD",
2004,
1,
1,
0,
2
],
[
"Western Europe",
2004,
4,
1,
3,
8
],
[
"Others",
2004,
1,
0,
0,
1
],
[
"China",
2000,
3,
2,
2,
7
],
[
"Russia",
2000,
9,
7,
7,
20
],
[
"United States",
2000,
0,
0,
1,
1
],
[
"Developed Asia",
2000,
0,
1,
1,
2
],
[
"Eastern Europe",
2000,
5,
4,
4,
13
],
[
"Lat Am",
2000,
0,
0,
0,
0
],
[
"rest of OECD",
2000,
0,
1,
2,
3
],
[
"Western Europe",
2000,
1,
2,
0,
3
],
[
"Others",
2000,
0,
1,
1,
2
],
[
"China",
1996,
1,
4,
1,
6
],
[
"Russia",
1996,
7,
4,
6,
10
],
[
"United States",
1996,
2,
2,
1,
5
],
[
"Developed Asia",
1996,
0,
1,
0,
1
],
[
"Eastern Europe",
1996,
1,
7,
10,
18
],
[
"Lat Am",
1996,
0,
0,
0,
0
],
[
"rest of OECD",
1996,
0,
0,
0,
0
],
[
"Western Europe",
1996,
4,
0,
0,
4
],
[
"Others",
1996,
1,
0,
0,
1
],
[
"China",
1992,
2,
4,
2,
8
],
[
"Russia",
1992,
10,
5,
5,
20
],
[
"United States",
1992,
1,
2,
3,
6
],
[
"Developed Asia",
1992,
0,
1,
3,
4
],
[
"Eastern Europe",
1992,
3,
2,
2,
7
],
[
"Lat Am",
1992,
0,
0,
0,
0
],
[
"rest of OECD",
1992,
0,
0,
0,
0
],
[
"Western Europe",
1992,
0,
2,
2,
4
],
[
"Others",
1992,
1,
0,
0,
1
]
];
data.addColumn('string','group');
data.addColumn('number','year');
data.addColumn('number','gold');
data.addColumn('number','silver');
data.addColumn('number','bronze');
data.addColumn('number','total');
data.addRows(datajson);
return(data);
}
// jsDrawChart
function drawChartMotionChartID3dc41b4a6e64() {
var data = gvisDataMotionChartID3dc41b4a6e64();
var options = {};
options["width"] = 600;
options["height"] = 500;
options["state"] = "\n{\"xZoomedDataMin\":0,\"yAxisOption\":\"5\",\"orderedByX\":false,\n\"duration\":{\"timeUnit\":\"Y\",\"multiplier\":1},\"yZoomedIn\":false,\n\"xLambda\":1,\"colorOption\":\"_UNIQUE_COLOR\",\"nonSelectedAlpha\":0.4,\n\"sizeOption\":\"5\",\"showTrails\":false,\"time\":\"2012\",\"playDuration\":15000,\n\"xAxisOption\":\"2\",\"yZoomedDataMax\":20,\"iconType\":\"BUBBLE\",\"xZoomedDataMax\":11,\n\"dimensions\":{\"iconDimensions\":[\"dim0\"]},\"iconKeySettings\":[],\n\"yZoomedDataMin\":0,\"yLambda\":1,\"orderedByY\":false,\n\"uniColorForNonSelected\":false,\"xZoomedIn\":false}\n";
var chart = new google.visualization.MotionChart(
document.getElementById('MotionChartID3dc41b4a6e64')
);
chart.draw(data,options);
}
// jsDisplayChart
(function() {
var pkgs = window.__gvisPackages = window.__gvisPackages || [];
var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
var chartid = "motionchart";
// Manually see if chartid is in pkgs (not all browsers support Array.indexOf)
var i, newPackage = true;
for (i = 0; newPackage && i < pkgs.length; i++) {
if (pkgs[i] === chartid)
newPackage = false;
}
if (newPackage)
pkgs.push(chartid);
// Add the drawChart function to the global list of callbacks
callbacks.push(drawChartMotionChartID3dc41b4a6e64);
})();
function displayChartMotionChartID3dc41b4a6e64() {
var pkgs = window.__gvisPackages = window.__gvisPackages || [];
var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
window.clearTimeout(window.__gvisLoad);
// The timeout is set to 100 because otherwise the container div we are
// targeting might not be part of the document yet
window.__gvisLoad = setTimeout(function() {
var pkgCount = pkgs.length;
google.load("visualization", "1", { packages:pkgs, callback: function() {
if (pkgCount != pkgs.length) {
// Race condition where another setTimeout call snuck in after us; if
// that call added a package, we must not shift its callback
return;
}
while (callbacks.length > 0)
callbacks.shift()();
} });
}, 100);
}
// jsFooter
</script>
<!-- jsChart -->
<script src="https://www.google.com/jsapi?callback=displayChartMotionChartID3dc41b4a6e64" type="text/javascript"></script>
<!-- divChart -->
<br />
<div id="MotionChartID3dc41b4a6e64" style="height: 500; width: 600;">
</div>
<br />
<br />
<div style="text-align: justify;">
The change that happened was a <a href="https://en.wikipedia.org/wiki/Code_of_Points_(artistic_gymnastics)#The_current_Code" target="_blank">complete revisio</a>n of the point system following a judging controversy in Athens summer Olympics in 2004. This includes abolishing the "<a href="https://www.youtube.com/watch?v=Yi_5xbd5xdE" target="_blank">perfect 10</a>" and introduction of "difficulty level" in scoring. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This offers a positive skew to the participants. Choosing a high difficulty level enables one to achieve a much better chance to win a medal (and probably on the higher side - i.e. gold or silver). Although that means the execution will be difficult, and on an average they should balance out each other. However, if you aim for high difficulty levels and in rare cases manage to hit the execution, you will be sure to win a medal. This positive skew should theoretically motivate gymnasts to choose higher difficulty levels. This also means a higher variance in performance outcome.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This also should mean a higher rate of injuries for gymnasts. Unfortunately, data that I could get on this are too little to say anything statistically.</div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0tag:blogger.com,1999:blog-1540057389458334563.post-31037976472930311062016-08-03T21:31:00.002+01:002016-08-03T21:39:30.673+01:00Macro: The End of QE-topia<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Negative rate is much more than what it says on the label. One of the cornerstones of modern finance is what is called present value (PV). PV is used to evaluate real projects, value financial investments or price derivatives, you name it. Surprisingly, based on my personal experience, it appears many practitioners and investors are unaware of the fundamental assumption on which this all encompassing concept of PV is delicately balanced - an assumption of a properly functional lending and borrowing market. Without that, there is no mean to transfer values across time back and forth, and PV loses its real meaning. Negative rates makes one question the validity of this assumption.<br />
<br />
Central banks, it appears, are having a hard time. Last week's BoJ's underwhelming policy outcome was scorned off by the markets with an emphatic rally in Yen and sell-off in JGBs. This week BoE is widely expected to kick-in with some Brexit easing, and the markets so far has greeted the possibility with a renewed sell-off in FTSE 100. ECB is also expected to up the ante with another QE extension sometime later this year, and the European equities do not seem overjoyed about it. To contrast, S&P 500 seems pretty much nonchalant about a plausible Fed hike. The usual QE-led risk rally, it appears, are drawing to an end. In fact <a href="http://blogs.ft.com/gavyndavies/2016/07/24/regime-changes-in-the-financial-markets/" target="_blank">a few</a> are already calling out for a regime change - from QE to deflation dominance (or lack of demand).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In the wake of the Great Financial Crisis, most central bank carried out a massive amount of monetary stimulus. One way to track the global monetary stimulus beyond policy rates is to track the combined balance sheet of major central banks<sup>1</sup>, as we see below. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-Qbp_wT7DrFo/V6JClB-8fRI/AAAAAAAAFEo/Z9mJqB3NgGAPfoMyYmaY6PXBO-mJw1c6gCLcB/s1600/chart1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="182" src="https://3.bp.blogspot.com/-Qbp_wT7DrFo/V6JClB-8fRI/AAAAAAAAFEo/Z9mJqB3NgGAPfoMyYmaY6PXBO-mJw1c6gCLcB/s640/chart1.png" width="640" /></a></div>
<br /></div>
<div style="text-align: justify;">
Few would argue against the unprecedented monetary stimulus led mostly by the Fed which served a crucial purpose during and after the crisis to restore confidence, liquidity and growth conditions. However, the effectiveness of QEs from other central banks have <a href="http://ftalphaville.ft.com/2016/07/19/2170198/koo-why-us-quantitative-easing-worked-better-than-other-qes/" target="_blank">arguably been much weaker</a>. ECB QE is so far hardly "<a href="http://prodiptag.blogspot.co.uk/2015/03/ecb-qe-too-early-to-declare-victory.html" target="_blank">successful</a>".</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Also, over time, the impact to real economy has grown visibly less dramatic. Below chart (left one) shows the growth in global major central bank balance sheet vis-à-vis growth in M2 money supply as well as bank lending across major economies<sup>2</sup>. Since the abatement of the European Sovereign Crisis in Q3 2012, all the measures have started moving in lock-step. What is more, the magnitude of global M2 growth has been lower than central bank balance sheet growth, meaning less bang for the QE bucks. The bank lending growth has been even lower than that. It is hardly a surprise we started to have quite a bit of noise around the effectiveness of QE and monetary stimulus around that time and since. </div>
<div style="text-align: justify;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Ya3i5qP6jAg/V6JE1gpZZKI/AAAAAAAAFE0/YSPM2GXIJzwGkLgwxumyJAAgpyAJOkoLgCLcB/s1600/chart2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="https://1.bp.blogspot.com/-Ya3i5qP6jAg/V6JE1gpZZKI/AAAAAAAAFE0/YSPM2GXIJzwGkLgwxumyJAAgpyAJOkoLgCLcB/s640/chart2.png" width="640" /></a></div>
<br /></div>
<div style="text-align: justify;">
It is not hard to see why. As the right hand chart<sup>3</sup> shows, irrespective of what the central banks have been doing, the global private sector still continues with deleveraging (with some exception, like US corporates). The <a href="http://prodiptag.blogspot.co.uk/2014/10/euro-glut-global-look.html" target="_blank">excess savings</a> - especially for Euro area (and a <a href="http://www.federalreserve.gov/boardDocs/Speeches/2005/200503102/default.htm" target="_blank">large contraction in dis-savings</a> in the US as well) clearly underscores the problem. This arguably is an expected outcome of a balance sheet recession - wherein the private sector, afflicted with too much debt and in a process to repair their balance sheet, will try to increase savings and desist from borrowing no matter how low the lending rates are pushed down by QE. This is less a question about pricing and more about the capacity and willingness to borrow. On top, the increased regulatory burdens and negative interest rates certainly did not help the banking sector much to upsize their loan books. The combined effect - anemic global demand and as a result, stunted global investments (not helped by pre-crisis built-up over-capacity in certain sectors) - was given a new moniker, <a href="http://larrysummers.com/2016/02/17/the-age-of-secular-stagnation/" target="_blank">secular stagnation</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Economies can be stimulated using many forms and jargon. But in any case, to boost demand it must work to enable the demand side to afford it. And this increase demand must be paid for by either increased debt (i.e. borrowing) or equity (like increased transfer or wage). Monetary policy, in practice, mostly tend to fund this increased demand through debt in its standard transmission channel through banks. In a scenario where many are focused on reducing leverage, it is no surprise that this will have a less-than-expected impact. Monetary policy can enhanced equity based spending as well, like through <a href="https://en.wikipedia.org/wiki/Wealth_effect" target="_blank">wealth effect</a> or inducing an increase in wage through increased inflation expectation. While this has worked in the US, for the rest of the world, especially in Euro Area and in Japan, this has hardly been the case. The dis-inflation remains very much alive.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
There are some recent trends, however, that is slowly becoming a theme - and it involves the other side of the stimulus coin. 2015 has been the first year after the extra-ordinary time during the crisis, that major global economies have experienced a reversal of a combined fiscal tightening (see below<sup>4 </sup>on the left). We are past the fiascoes like sales tax hike in Japan and the excessive focus on balanced budget in Europe. And a few countries like Canada and Japan have already stated fiscal stimulus as their explicit policy tools. US may see similar moves after the election. Of course the downside of the government playing the role of "consumer of the last resort" is that this comes at a cost of debt concentration at government sector. </div>
<div style="text-align: justify;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-_ZNzIZQ1a0g/V6JKLMFMGPI/AAAAAAAAFFE/xTo2HbEKOEsxfbgANnw5bjo5prSBmKopQCLcB/s1600/chart3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://3.bp.blogspot.com/-_ZNzIZQ1a0g/V6JKLMFMGPI/AAAAAAAAFFE/xTo2HbEKOEsxfbgANnw5bjo5prSBmKopQCLcB/s640/chart3.png" width="640" /></a></div>
<br /></div>
<div style="text-align: justify;">
We are on a cusp right now. Global consumption, despite all the allegation, has shown considerable resilience (although much away from their pre-crisis period, see chart<sup>5</sup> above on the right). What we want now, more than ever, is avoiding any policy mistake. Given the fragile nature and very low margin of error on the policy side, it will be hard to recover from one. We are past the days of equity rallies with every new round of monetary easing. Markets will focus more and more on the underlying growth. This growth will of course have some costs - the key policy issue will be how to allocate that in a balanced manner between the fiscal and monetary side of this. One-sided efforts from central banks - increasingly larger asset purchase from a rather finite pool in a world characterized by negative interest rates and safe asset shortage - is perhaps past its used-by date.<br />
<br /></div>
<hr />
<div>
<span style="font-size: 12px;"><span style="font-family: inherit;">
1. <span style="text-align: left;">source: national central banks</span><br />
<span style="text-align: left;">2. </span><span style="text-align: left;">source: national central banks, IMF, Bloomberg</span></span></span><br />
<span style="font-size: 12px;"><span style="font-family: inherit;">
<span style="text-align: left;">3. source: national statistics offices, IMF</span><br />
<span style="text-align: left;">4. source: national statistics offices, national central banks</span></span></span><br />
<span style="font-size: 12px;">5. source: national statistics offices, Bloomberg<br />
<span style="text-align: left;"><br /></span></span></div>
</div>
nemohttp://www.blogger.com/profile/09061859156431677511noreply@blogger.com0