November 2019
Beginner
394 pages
10h 31m
English
for i in range(0, num_days): close_prices = {} # Build ClosePrice series, compute SMA for each symbol and price-deviation from SMA for each symbol for symbol in SYMBOLS: close_prices[symbol] = symbols_data[symbol]['Close'].iloc[i] if not symbol in price_history.keys(): price_history[symbol] = [] price_deviation_from_sma[symbol] = [] price_history[symbol].append(close_prices[symbol]) if len(price_history[symbol]) > SMA_NUM_PERIODS: # we track at most SMA_NUM_PERIODS number of prices del (price_history[symbol][0]) ...Read now
Unlock full access