```
绘制展期收益率的代码如下:
# 以螺纹钢1901 1905合约为例
PriceList1901 = attribute_history('RB1901.XSGE',120,'1d',['close'])
PriceList1905 = attribute_history('RB1905.XSGE',120,'1d',['close'])
df = pd.concat([PriceList1901, PriceList1905], axis=1)
df.columns= ['RB1901.XSGE','RB1905.XSGE']
# 计算展期收益率
df['RY:RB'] = df.apply(lambda x: (x[0] / x[1]-1)*3, axis=1)
plt.figure(figsize=(15, 7))
plt.plot(df['RY:RB'])
plt.legend(['RY:RB'])
plt.show()
```
代码有误,没有计算 Nt,d 和 Nt, n
2022-12-27