tag:blogger.com,1999:blog-261139923818144971.post7236944378380404226..comments2024-03-29T07:20:07.753+00:00Comments on This Blog is Systematic: Typo in definition of carry rule for futures in "Systematic Trading" bookRob Carverhttp://www.blogger.com/profile/10175885372013572770noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-261139923818144971.post-78408615466799206272022-10-17T07:12:59.713+01:002022-10-17T07:12:59.713+01:00Thanks for the reply! Must have overlooked that so...Thanks for the reply! Must have overlooked that somehowwazewwwhttps://www.blogger.com/profile/08963304023727906040noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-21586614205066840132022-10-15T16:20:18.763+01:002022-10-15T16:20:18.763+01:00There is quite a detailed explanation in Leveraged...There is quite a detailed explanation in Leveraged Trading for calculating carry in spot fx.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-78825875108872022462022-10-15T16:11:53.325+01:002022-10-15T16:11:53.325+01:00Another follow up question if I may. In your syste...Another follow up question if I may. In your system, for FX do you run both carry strategies using spot and futures? Thanks!wazewwwhttps://www.blogger.com/profile/08963304023727906040noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-20797115732214460172022-10-15T15:56:42.205+01:002022-10-15T15:56:42.205+01:00Hi Rob,
Been reading and re-reading all your book...Hi Rob,<br /><br />Been reading and re-reading all your books for the last few months. I am trying to implement carry in FX spot. In your book it says that I would need to calculate Interest and Funding Cost. What rates do you exactly use for those two figures? Thanks!wazewwwhttps://www.blogger.com/profile/08963304023727906040noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-62342821331532755182019-07-04T16:45:03.907+01:002019-07-04T16:45:03.907+01:00Exactly, you swap beta risk for correlation risk, ...Exactly, you swap beta risk for correlation risk, and this results in less gaussian type riskRob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-47782705386009738782019-07-04T15:51:51.810+01:002019-07-04T15:51:51.810+01:00Hi rob, what is your thinking of the higher tail r...Hi rob, what is your thinking of the higher tail risk, something like when the relationship breaks down you really have two positions on that are not converging so your losses would be much bigger than just with one position even though when things are behaving you would be market neutral.<br />douggiehttps://www.blogger.com/profile/13670295647801338012noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-43616447772661181812019-07-04T15:26:44.843+01:002019-07-04T15:26:44.843+01:00You could do that, but it would be a very differen...You could do that, but it would be a very different strategy, and in fact would be likely to have higher tail risk than trading an outright future.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-112017952138166322019-07-04T13:13:10.699+01:002019-07-04T13:13:10.699+01:00Hi Rob, was just re-reading your book (looking for...Hi Rob, was just re-reading your book (looking forward to the next one I believe is in the works!) and was a bit confused, but saw this correction and things made sense, but it did lead me to think is there any theoretical reason (apart from practical aspects of doubling your trading costs!!!) for the carry trading trading rule you would not trade the near and far contracts as a pair to partially hedge your exposure and reduce the tail risk of a negatively skewed strategy.douggiehttps://www.blogger.com/profile/13670295647801338012noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-54965902435187371502017-03-14T06:12:24.209+00:002017-03-14T06:12:24.209+00:00Both are correct. Its preferable to have carry as ...Both are correct. Its preferable to have carry as a nearer contract than the priced contract. Where this isn't possible (because only the first contract is liquid) they are reversed.<br /><br />See Appendix B.<br />Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-37208293346151393732017-03-13T18:38:42.305+00:002017-03-13T18:38:42.305+00:00some of the carrydata.csv's in the "legac...some of the carrydata.csv's in the "legacycsv" module are backwards? Wheat, Gas, Crude etc have the "carry contract" as the front month and "price contract" as back month. this is contrary to all other files in the legacycsv module. Most other have "carry" as the back month. Which is correct?Dolphhttps://www.blogger.com/profile/15588741885676289695noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-13898719573937193022017-01-20T13:41:41.203+00:002017-01-20T13:41:41.203+00:00That's correct. I don't use the spot price...That's correct. I don't use the spot price myself, for all these reasons plus it's hard to get spot for most contracts, stock indices and STIR being the exception. Instead I use the second contract, which isn't ideal eithier of course.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-54562058313997724032017-01-20T13:27:58.087+00:002017-01-20T13:27:58.087+00:00You have written that, for contracts for which you...You have written that, for contracts for which you must trade the front month, ideally you should use the spot price to represent the price of the nearer contract. So, the spot price of ESTX50 would be the the ESTX50 Index on IB? In using this spot price, I suppose that the quantity of days between the near and far contracts would change every day, since you would assume the date of the spot price to always be current date, versus the fixed delivery date of the front month contract. Thanks, as always.NewbieTraderhttps://www.blogger.com/profile/04354202871104323102noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-63040758185734551982016-12-05T10:08:15.159+00:002016-12-05T10:08:15.159+00:00No you need to multiply by -1 because the spreadsh...No you need to multiply by -1 because the spreadsheet has nearer - current and if you replace nearer with a further out contract price (so column F is the back contract not the front relative to the traded contract) the forecast will be the wrong way round.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-29756583361175847502016-12-04T13:28:53.746+00:002016-12-04T13:28:53.746+00:00Hi, Rob. If I use your EWMAC spreadsheet for contr...Hi, Rob. If I use your EWMAC spreadsheet for contracts for which you can only trade the front month, I assume no modification to the spreadsheet is necessary. The only difference is that I would be trading the nearer contract. The forecast is calculated the same way, whether I am trading the nearer or the farther. Is this correct? Thanks.NewbieTraderhttps://www.blogger.com/profile/04354202871104323102noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-62448560756041478442016-06-21T09:28:34.417+01:002016-06-21T09:28:34.417+01:00fixed thanksfixed thanksRob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-284817085140994512016-06-20T18:20:05.285+01:002016-06-20T18:20:05.285+01:00Hi Rob, just adding some detail to Max's comme...Hi Rob, just adding some detail to Max's comment. On the carry spreadsheet, it looks like you corrected the formulas in cells G20:G21. But the incorrect formulas remain in G22 and below.B.H.https://www.blogger.com/profile/15542016585553496416noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-72738195436299804682016-03-25T21:55:29.864+00:002016-03-25T21:55:29.864+00:00Hi Rob,
Just wanted to mention that the calculatio...Hi Rob,<br />Just wanted to mention that the calculation of the carry rule in the excel is still wrong. <br />MaxMaxhttps://www.blogger.com/profile/15656248374449015916noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-28777142927355707282015-12-03T12:47:58.893+00:002015-12-03T12:47:58.893+00:00Pavel,
Two points
a) if you connect with me on l...Pavel,<br /><br />Two points<br /><br />a) if you connect with me on linked in, then you can email the spreadsheet so I can check your calculations - that does sound low<br /><br />b) yes it does make sense to floor vol. <br /><br />For example in python<br /><br />def robust_vol_calc(x, days=35, min_periods=10, <br /> floor_min_quant=0.05, floor_min_periods=100, <br /> floor_days=500):<br /> """<br /> Robust exponential volatility calculation, assuming daily series of prices<br /> We apply a volfloor based on lowest vol over recent history<br /> <br /> :param days: Number of days in lookback (*default* 35)<br /> :type days: int<br /> :param min_periods: The minimum number of observations (*default* 10) <br /> :type min_periods: int<br /> <br /> :param floor_min_quant: The quantile to use for volatility floor (eg 0.05 means we use 5% vol) (*default 0.05)<br /> :type floor_min_quant: float<br /><br /> :param floor_days: The lookback for calculating volatility floor, in days (*default* 500)<br /> :type floor_days: int<br /><br /> :param floor_min_periods: Minimum observations for floor - until reached floor is zero (*default* 100)<br /> :type floor_min_periods: int<br /> <br /> :returns: pd.DataFrame -- volatility measure<br /> <br /> <br /> """<br /><br /> ## Standard deviation will be nan for first 10 non nan values<br /> vol=pd.ewmstd(x, span=days,min_periods=min_periods)<br /> <br /> ## Find the rolling 5% quantile point to set as a minimum<br /> vol_min=pd.rolling_quantile(vol, floor_days, floor_min_quant, floor_min_periods)<br /> ## set this to zero for the first value then propogate forward, ensures we always have a value<br /> vol_min.set_value(vol_min.index[0],vol_min.columns[0],0.0) <br /> vol_min=vol_min.ffill()<br /><br /> ## apply the vol floor<br /> vol_with_min=pd.concat([vol, vol_min], axis=1)<br /> vol_floored=vol_with_min.max(axis=1, skipna=False).to_frame()<br /> <br /> vol_floored.columns=["vol"]<br /> return vol_floored<br /><br /><br />Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-29140875219319379822015-12-03T11:15:12.865+00:002015-12-03T11:15:12.865+00:00Hi Rob,
I am facing another interesting moment w...Hi Rob, <br /><br />I am facing another interesting moment with portfolio from Ch. 15. Trying to model its past behavior in 2005 and noticed one thing. When price vol is too low I get too large corn positions for my account. <br /><br />To be specific, for instance for 3rd Jan 2005 I am getting from your corn data the price = 326.5, block value = $163.25, Price Volatility, % (G) = 0.48%, Volatility Scalar = 39.9, and Rounded Target Position in blocks is short 35 contracts which appears too much for $250000 account. I have these calculations in excel spreadsheet, but unfortunately cannot attach it here. <br /><br />so I would like to ask you if it makes sense to floor the price volatility somehow in the automated way so that it is possible to model any new strats in the past with your framework? or maybe I am not getting/missing something.. <br /><br />PS Checked max possible position for this date. Getting 2 * 39.9 * 23.33% * 1.89 = 35 blocks. <br /><br />Thank you,<br />Pavel.Anonymoushttps://www.blogger.com/profile/09232092911315899862noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-87688559922927616902015-11-14T09:54:06.162+00:002015-11-14T09:54:06.162+00:00Yes, it is clear now. Thank you. Yes, it is clear now. Thank you. Anonymoushttps://www.blogger.com/profile/09232092911315899862noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-31056730862648644842015-11-13T11:19:57.295+00:002015-11-13T11:19:57.295+00:00Hi Pavel
I use two different kinds of volatility:...Hi Pavel<br /><br />I use two different kinds of volatility:<br /><br />% price volatility (i.e. standard deviation of [price_t - price_t_1] / price). I use this to calculate volatility for the purposes of scaling positions.<br /><br />price difference volatility (i.e. standard deviatoin of [price_t - price _t-t]). I use this to adjust the EWMAC forecast and the carry forecast (and most other trading rules).<br /><br />Note that in eithier case you can calculate volatility using eithier the ewma function in python (also shown in the chapter 7 spreadsheet) or simple moving average (this is identical to using STDEV in excel with a fixed window).Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-8765230932674714722015-11-13T09:24:05.296+00:002015-11-13T09:24:05.296+00:00Hello Rob,
I would like to bring your attention ...Hello Rob, <br /><br />I would like to bring your attention to another moment in your calculations on this website and your book (really great book, thanks!). <br /><br />Defining volatility: <br />1. In appendix D, page 298, you define volatility with STDEV function as well as using EWMA calculations. You define Return as B2 = (A2-A1)/A1. <br />2. In "Spreadsheet: EWMAC calculation example" for Ch.7 available on your website you define Return as difference between prices D21=C21-C2 and then calculate std deviation with EWMA rule.<br />3. In code EWMAC.py from GitHub you define Return again using difference and calculate everything using Python func: <br /> stdev_returns=pd.ewmstd(price - price.shift(1), span=vol_lookback) <br /><br />So I would like to ask you if it is by design. Seems like all three methods give different numbers when applied to the same data. <br /><br />Thank you,<br />Pavel <br />Anonymoushttps://www.blogger.com/profile/09232092911315899862noreply@blogger.com