インデックスのパフォーマンスを評価する

Pythonでの時系列データ操作

Stefan Jansen

Founder & Lead Data Scientist at Applied Artificial Intelligence

時価総額加重インデックスを評価する

  • インデックスのリターン:

    • インデックスの総リターン

    • 構成銘柄別の寄与度

  • ベンチマーク比較

    • 期間トータルのリターン

    • サブ期間のローリングリターン

Pythonでの時系列データ操作

価値ベースのインデックス:おさらい

agg_market_cap = market_cap_series.sum(axis=1)

index = agg_market_cap.div(agg_market_cap.iloc[0]).mul(100)
index.plot(title='Market-Cap Weighted Index')

インデックス

Pythonでの時系列データ操作

銘柄別の価値寄与度

agg_market_cap.iloc[-1] - agg_market_cap.iloc[0]
315,037.71
Pythonでの時系列データ操作

銘柄別の価値寄与度

change = market_cap_series.first('D').append(market_cap_series.last('D'))

change.diff().iloc[-1].sort_values() # or: .loc['2016-12-30']
TM     -6,365.07
KO     -4,034.49
ABB     7,592.41
ORCL   11,109.65
PG     14,597.48
UPS    17,212.08
WMT    23,232.85
BABA   27,800.00
JNJ    39,931.44
T      50,229.33
XOM    53,075.38
JPM    80,656.65
Name: 2016-12-30 00:00:00, dtype: float64
Pythonでの時系列データ操作

時価総額に基づくウエイト

market_cap = components['Market Capitalization']

weights = market_cap.div(market_cap.sum())
weights.sort_values().mul(100)
Stock Symbol
ABB     1.85
UPS     3.45
TM      5.96
ORCL    6.93
KO      7.03
WMT     8.50
PG      8.81
T       9.47
BABA   10.55
JPM    11.50
XOM    12.97
JNJ    12.97
Name: Market Capitalization, dtype: float64
Pythonでの時系列データ操作

時価総額加重の構成銘柄リターン

index_return = (index.iloc[-1] / index.iloc[0] - 1) * 100
14.06
weighted_returns = weights.mul(index_return)

weighted_returns.sort_values().plot(kind='barh')

加重リターン

Pythonでの時系列データ操作

ベンチマークとの比較

data = index.to_frame('Index') # Convert pd.Series to pd.DataFrame

data['SP500'] = pd.read_csv('sp500.csv', parse_dates=['Date'], index_col='Date')
data.SP500 = data.SP500.div(data.SP500.iloc[0], axis=0).mul(100)

インデックスとS&P500の比較

Pythonでの時系列データ操作

ベンチマーク比較:30日ローリングリターン

def multi_period_return(r):
    return (np.prod(r + 1) - 1) * 100

data.pct_change().rolling('30D').apply(multi_period_return).plot()

インデックス対S&P500の30日ローリング

Pythonでの時系列データ操作

Passons à la pratique !

Pythonでの時系列データ操作

Preparing Video For Download...