AI For Trading: Advanced time series models (23)

Seasonal Adjustments using ARIMA (SARIMA)

Time series data tends to have seasonal patterns. For instance, natural gas prices may increase during winter months, when it’s used for heating homes.
时间序列数据往往具有季节性模式。例如,天然气价格在冬季可能会增加,当时它用于家庭取暖。

Similarly, it may also increase during peak summer months, when natural gas generators are used to produce the extra electricity that is used for air conditioning.
同样,它也可能在夏季高峰期增加,当时天然气发电机用于产生用于空调的额外电力。

Retail sales also has expected increases during the holiday shopping season, such as Black Friday in the US (November), and Singles’ Day in China (also in November).
零售销售也预计在假日购物季节期间会增加,例如美国的黑色星期五(11月)和中国的单身日(也是11月)。

Stocks may potentially have seasonal patterns as well. One has to do with writing off losses in order to minimize taxes. Funds and individual investors have unrealized capital gains or losses when the stock price increases or decreases from the price at which they bought the stock.
股票也可能具有季节性模式。一个与减少损失有关,以减少税收。当股票价格从他们购买股票的价格上涨或下跌时,资金和个人投资者有未实现的资本收益或损失。

Those capital gains or losses become “realized capital gains” or “realized capital losses” when they sell the stock. At the end of the tax year (which may be December, but not necessarily), an investor may decide to sell their underperforming stocks in order to realize capital losses, which may potentially reduce their taxes. Then, at the start of the next tax year, they may buy back the same stocks in order to maintain their original portfolio. This is sometimes referred to as the “January effect.”
这些资本收益或损失在出售股票时变为“已实现资本收益”或“已实现资本损失”。在纳税年度结束时(可能是12月,但不一定),投资者可能决定出售表现不佳的股票,以实现资本损失,这可能会减少他们的税收。然后,在下一个纳税年度开始时,他们可能会回购相同的股票以维持其原始投资组合。这有时被称为“一月效应”。

Removing seasonal effects can help to make the resulting time series stationary, and therefore more useful when feeding into an autoregressive moving average model.
消除季节性影响有助于使得到的时间序列保持不变,因此在进入自回归移动平均模型时更有用。

To remove seasonality, we can take the difference between each data point and another data point one year prior. We’ll refer to this as the “seasonal difference”. For instance, if you have monthly data, take the difference between August 2018 and August 2017, and do the same for the rest of your data. It’s common to take the “first difference” either before or after taking the seasonal difference.
为了消除季节性,我们可以在一年前获取每个数据点与另一个数据点之间的差异。我们将此称为“季节性差异”。例如,如果您有月度数据,请记录2018年8月到2017年8月之间的差异,并对其余数据执行相同操作。在采取季节性差异之前或之后采取“第一个差异”是很常见的。

If we took the “first difference” from the original time series, this would be taking August 2018 and subtracting July 2018. Next, to take the seasonal difference of the first difference, this would mean taking the difference between (August 2018 - July 2018) and (August 2017 - July 2017).
如果我们从原始时间序列中获得“第一个差异”,那将是2018年8月和2018年7月减去。接下来,考虑第一个差异的季节性差异,这将意味着取得(2018年8月至2018年7月)和(2017年8月至2017年7月)之间的差异。

You can check if the resulting time series is stationary, and if so, run this stationary series through an autoregressive moving average model.
您可以检查生成的时间序列是否静止,如果是,则通过自回归移动平均模型运行此固定序列。

Side Note

Kendall Lo, one of the subject matter experts of our course, recommends this book: “Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders”. The book is about how a successful investor trained his students (his “turtles”) to follow his trend-following trading strategy. The book illustrates the concepts of using trading signals, back-testing, position sizing, and risk management. The story is also summarized in this article Turtle Trading: A Market Legend

这本书是关于一位成功的投资者如何训练他的学生(他的“乌龟”)遵循他的趋势跟踪交易策略。本书阐述了使用交易信号,回溯测试,头寸调整和风险管理的概念。本文还总结了这篇文章“海龟贸易:市场传奇”。

为者常成,行者常至