get_RSI - 相對強弱指標
get_RSI(close, n=6)
使用場景
該函數僅在回測、交易模塊可用
接口說明
獲取相對強弱指標RSI指標的計算結果
PTrade是恒生公司開發的一款專業量化軟件,部分合作券商可提供,↑↑↑!
參數
close:價格的時間序列數據, numpy.ndarray類型;
n: 周期, int類型;
返回
RSI指標rsi值的時間序列, numpy.ndarray類型
示例
def initialize(context):g.security = "600570.XSHG"set_universe(g.security)def handle_data(context, data):h = get_history(100, '1d', ['close','high','low'], security_list=g.security)close_data = h['close'].valuesrsi_data = get_RSI(close_data, 6)rsi = rsi_data[-1]