0
我無法弄清楚爲什麼我只能在控制檯中獲取分鐘數據而不是日常數據,不管我在代碼中聲明的內容是否寫入frequency = '1d'
或frequency = '1m'
,結果總是在幾分鐘內僅顯示分鐘價格的Quantopian數據歷史記錄
def initialize(context):
# AAPL, MSFT, and SPY
context.securities = [sid(24), sid(5061), sid(8554)]
def handle_data(context, data):
prices = data.history(context.securities, "price", bar_count = 10, frequency = "1d")
pct_change = (prices.ix[-1] - prices.ix[0])/prices.ix[0]
log.info(pct_change)