AI For Trading:Factors (49)

What is a factor?

Factor: A list of numerical values, one for each stock, potentially predictive of an aspect of the performance
of these stocks in the fututer.

Factors can be based on:

  • Momentum
  • Fundamental information
  • Signals from social media

Zipline: an open-source Python algorithmic trading library.

Example of a factor

Hypothesis:one-year return indicates momentum for next few days.
Factor: one-year return of each stock in stock universe.

file

Quiz: factor values and weights

练习题
The factor value of stock A is higher than the factor value of stock B, and we use the factor value to determine portfolio weights for the stocks. Assume these are the only stocks in the portfolio, and that this is a long-only portfolio that invests all its cash in stocks, so the weights add up to 1. What are possible values for the weights of stock A and stock B?
股票A的要素价值高于股票B的要素值,我们使用要素值来确定股票的投资组合权重。假设这些是投资组合中唯一的股票,这是一个长期投资组合,将所有现金投资于股票,因此权重加起来1.股票A和股票B的权重有哪些可能的值?

file

Do we want to put more money on stock A or more on stock B? What do the weights sum up to?
yes, weight_A should be greater than weight_B, and weights sum to 1.

Standardizing a factor(标准化因子)

Now, let's see how to convert this raw calculation into a standardized factor

file

De-mean(去均值)

You just learned how to demean a factor so that the values add up to zero. But why do we do this.

Notional(概念)

A portfolio's notional is the number we can multiply the stock weights by in order to get a dollar value for each stock's position. For a long-only portfolio, we can think of this as the amount of cash that a fund has available to invest in the portfolio. Whether the positions are long or short, we can multiply the stock weight to the notional to turn this into a dollar amount for that stock's position.
投资组合的名义是我们可以将股票权重乘以以获得每个股票头寸的美元价值的数字。对于长期投资组合,我们可以将其视为基金可用于投资组合的现金数量。无论头寸是多头还是空头头寸,我们都可以将股票权重乘以名义,将其转换为该股票头寸的美元金额。

Rescale

Leverage(杠杆作用)

Leverage is the act of borrowing in order to invest. Borrowing cash in order to go long on more positions may magnify gains but also losses.
杠杆是为了投资而借贷的行为。为了在更多头寸上做多而借入现金可能会放大收益但也会损失。

file

Leverage Ratio(杠杆率)

The leverage ratio is the sum of the magnitudes of all positions, divided by the notional. The leverage ratio gives a sense of how much risk a portfolio is taking, because taking more positions magnifies both gains and losses.
杠杆比率是所有头寸的大小之和除以名义。杠杆比率可以让您了解投资组合的风险程度,因为获取更多头寸可以放大收益和损失。

To standardize a factor, we divide by the sum of the magnitudes (sum of the absolute value of the positions), so that this rescaled vector's sum of magnitudes is equal to one. This makes different factors more comparable, because it's as if you're comparing different portfolios but each with the same amount of money placed on their positions.
为了标准化一个因子,我们除以幅度之和(位置的绝对值之和),这样重新调整的矢量的幅度之和等于1。这使得不同的因素更具可比性,因为它就好像你在比较不同的投资组合,但每个投资组合都有相同数量的资金。

Standardizing a Factor

To make a factor dollar neutral, subtract its mean from each position. To make the factor have a leverage ratio of one, divide by the sum of the absolute value of the positions.
要使美元系数保持中立,请从每个位置减去其均值。要使因子的杠杆比率为1,除以位置的绝对值之和。

Quiz:dollar neutral and leverage ratio

练习题
Choose factor values (any numbers) for three stocks. De-mean these stocks and make a note of their sum. Then rescale the demeaned values so that the sum of their absolute values equals one. Make a note of their sum. Change the starting factor values a few times. What do you notice?
选择三种股票的因子值(任何数字)。取消这些股票并记下他们的金额。然后重新调整demeaned值,使其绝对值之和等于1。记下他们的总和。将起始因子值更改几次。你注意到什么?

file

The sum of the demeaned weights is always zero, the sum of the rescaled weights is always zero, the sum of the absolute value of the rescaled weights is always one, the sum of the rescaled short positions is always -0.5

为者常成,行者常至