我收到一个关于return_type
的错误,因此非常感谢您的帮助:)
代码:
def daily_returns(data, days, iterations):
ft = drift_calc(data, return_type='n')
try:
stv = log_returns(data).std().values
except:
stv = log_returns(data).std()
dr = np.exp(ft + stv * norm.ppf(np.random.rand(days, iterations)))
return dr
daily_returns(data, 50, 1000)
错误:
drift_calc() got an unexpected keyword argument 'return_type'
问题恰恰是错误消息告诉您的是什么。根据您的注释,
drift_calc
函数的签名如下:这里没有定义名为
return_type
的参数。所以这一行:导致出现错误,因为它正在将命名参数
return_type
传递给drift_calc
函数,该函数未定义为接受此类参数相关问题 更多 >
编程相关推荐