#!/usr/bin/env python # coding: utf-8 # # 神經網路實做 # ## 拿取加權指數資料 # In[1]: from finlab.data import Data data = Data() twii = data.get("發行量加權股價指數") twii = twii['台股指數'].resample("15T").first().dropna() twii.head() # ## 製作features # In[2]: import talib import numpy as np import pandas as pd sma = talib.SMA(twii, timeperiod=120) wma = talib.WMA(twii, timeperiod=120) mom = talib.MOM(twii, timeperiod=120) k, d = talib.STOCH(twii, twii, twii,
import numpy as np import pandas as pd from finlab.data import Data import datetime if __name__ == '__main__': data = Data() ClosePrice = data.get('¦¬½L»ù', -2) print(ClosePrice)
def get_price(name="發行量加權股價指數", freq="15T"): data = Data() twii = data.get(name) twii = twii['台股指數'] twii = twii.resample(freq).first().dropna() return twii