if api.is_changing(quote_nearby) or api.is_changing(quote_deferred): spread_quote_last = quote_nearby.last_price - quote_deferred.last_price # quote价差,返回float spread_kline_close = kline_nearby.close.iloc[-1] - kline_deferred.close.iloc[-1] # K线价差,返回numpy.float64 # DEA = tafunc.ma(spread_kline_close,5) # MA返回pandas.DataFrame格式,ma返回pandas.Series print(quote_nearby.datetime, "盘口价差:", spread_quote_last,type(spread_quote_last), "K线价差:",spread_kline_close,type(spread_kline_close))
quote盘口两个合约的价差返回的是float类型,K线价差返回的是numpy.float类型
tqsdk.ta.
MA
()参数要求是pandas.DataFrame类型,tqsdk.tafunc.
ma()参数要求是pandas.Series类型
请问,怎么使用MA或ma函数求quote价差或K线价差五周期的移动平均线,谢谢!