3.18K 浏览
0

例如:

def dual_thrust(quote, klines):
current_open = klines.iloc[-1][“open”]
HH = max(klines.high.iloc[-NDAY – 1:-1])
HC = max(klines.close.iloc[-NDAY – 1:-1])
LC = min(klines.close.iloc[-NDAY – 1:-1])
LL = min(klines.low.iloc[-NDAY – 1:-1])
range = max(HH – LC, HC – LL)
buy_line = current_open + range * K1 # 上轨
sell_line = current_open – range * K2 # 下轨
return buy_line, sell_line

buy_line, sell_line = dual_thrust(quote, klines) # 当日上下轨

想获取昨日上轨的数据,用 buy_line.iloc[-2]  ,但提示出错。

怎样才能获取中上轨的昨日数据?

west 已回答的问题 2020年6月15日