以下のコードはQuandlからデータを受信していて、正常に動作しています。私の問題は、Quandlではなくyahooからデータを取得する方法がわかりません。 Yahooのデータフィードでどのように同じコードを使うことができるか教えてくれる人がいますか?どの楽器でもよい。最高はSPY etfです。Python Yahooデータフィード
import numpy as np
import pandas as pd
import quandl
import matplotlib.pyplot as plt
sp500_daily = quandl.get("CHRIS/CME_ES1",
start_date="2000-1-1",
end_date="2017-4-15")
sp500_daily.columns=['Open', 'High', 'Low', 'Close',
'Change', 'Settle', 'Volume',
'Open Interest']
multiplier = 50
# close[0] <= close[9] &&
# low[0] <= low[1] &&
# low[3] <= high[6] &&
# volume[0] <= volume[1]
signal = ((sp500_daily.Close <= sp500_daily.shift(9).Close) &
(sp500_daily.Low <= sp500_daily.shift(1).Low) &
(sp500_daily.shift(3).Low <= sp500_daily.shift(6).High) &
(sp500_daily.Volume <= sp500_daily.shift(1).Volume))
# hold time 1 day
profits = (signal * multiplier * (sp500_daily.shift(-1).Close -
sp500_daily.Close))
returns = (signal * (-1 + sp500_daily.shift(-1).Close/sp500_daily.Close))
profits.cumsum().plot()
plt.show()