資料視覺化
FinLab 提供一系列圖表工具,讓你更方便洞察市場數據!
In [1]:
Copied!
%%capture
!pip install finlab > log.txt
!pip install talib-binary > log.txt
%%capture
!pip install finlab > log.txt
!pip install talib-binary > log.txt
技術指標圖組¶
In [5]:
Copied!
from finlab.plot import plot_tw_stock_candles
from talib import abstract
from finlab.data import indicator
stock_id = '2330' # @param {type:"string"}
recent_days = 1000 # @param {type:"slider", min:200, max:6000, step:1}
adjust_price=False #@param ["False", "True"] {type:"raw"}
resample="D"#@param ["D", "W","M"] {allow-input: true}
overlay_func={
'ema_5':indicator('EMA',timeperiod=5),
'ema_10':indicator('EMA',timeperiod=10),
'ema_20':indicator('EMA',timeperiod=20),
'ema_60':indicator('EMA',timeperiod=60),
}
k,d = indicator('STOCH')
rsi = indicator('RSI')
technical_func = [{'K':k,'D':d},{'RSI':rsi}]
plot_tw_stock_candles(stock_id,recent_days,adjust_price,resample,overlay_func=overlay_func,technical_func=technical_func)
from finlab.plot import plot_tw_stock_candles
from talib import abstract
from finlab.data import indicator
stock_id = '2330' # @param {type:"string"}
recent_days = 1000 # @param {type:"slider", min:200, max:6000, step:1}
adjust_price=False #@param ["False", "True"] {type:"raw"}
resample="D"#@param ["D", "W","M"] {allow-input: true}
overlay_func={
'ema_5':indicator('EMA',timeperiod=5),
'ema_10':indicator('EMA',timeperiod=10),
'ema_20':indicator('EMA',timeperiod=20),
'ema_60':indicator('EMA',timeperiod=60),
}
k,d = indicator('STOCH')
rsi = indicator('RSI')
technical_func = [{'K':k,'D':d},{'RSI':rsi}]
plot_tw_stock_candles(stock_id,recent_days,adjust_price,resample,overlay_func=overlay_func,technical_func=technical_func)
漲跌幅與成交金額板塊圖¶
巢狀樹狀圖可以顯示多維度資料,並與圖表做互動,將依照產業分類的台股資料絢麗顯示。
In [ ]:
Copied!
from finlab.plot import plot_tw_stock_treemap
start= '2021-07-01' #@param {type:"date"}
end = '2021-07-02' #@param {type:"date"}
area_ind="turnover" #@param ["market_value","turnover"] {allow-input: true}
item="return_ratio" #@param ["return_ratio", "turnover_ratio"] {allow-input: true}
plot_tw_stock_treemap(start,end,area_ind,item)
from finlab.plot import plot_tw_stock_treemap
start= '2021-07-01' #@param {type:"date"}
end = '2021-07-02' #@param {type:"date"}
area_ind="turnover" #@param ["market_value","turnover"] {allow-input: true}
item="return_ratio" #@param ["return_ratio", "turnover_ratio"] {allow-input: true}
plot_tw_stock_treemap(start,end,area_ind,item)
輸入成功!
WARNING:finlab.data:price:收盤價 -- Daily data usage: 113.8 / 5000 MB WARNING:finlab.data:company_basic_info -- Daily data usage: 114.7 / 5000 MB WARNING:finlab.data:price:成交金額 -- Daily data usage: 149.3 / 5000 MB