【发布时间】:2019-10-24 18:55:37
【问题描述】:
我正在尝试获取一些技术信息。使用此链接中的一些命令:https://github.com/enigmampc/catalyst/blob/master/catalyst/pipeline/factors/equity/technical.py, 但在 quant.notebook 中我无法获得“从 numexpr 导入评估”,因此未定义评估。 我该如何解决这个问题?
从 numexpr 导入评估
class FastochasticOscillator(CustomFactor):
inputs=(USEquityPricing.close,USEquityPricing.high,USEquityPricing.low)
window_safe=True
window_length=14
def compute(self, today, assets, out, closes, highs, lows):
highest_high= nanmax(highs, axis=0)
lowest_low= nanmin(lows, axis=0)
latest_close= closes[-1]
evaluate(
'((tc - ll) / (hh - ll)) * 100',
local_dict={
'tc':latest_close,
'll':lowest_low,
'hh':highest_high,
},
global_dict={},
out=out,
)
K= FastochasticOscillator(window_length=14)
返回管道(列={
'K':K,
},screen=base)
我正在使用 Quantopian 笔记本,当我尝试导入时,它给了我这个:InputRejected:从 numexpr 导入评估引发了 ImportError。你的意思是从 numpy 导入 errstate 吗?
【问题讨论】:
-
由于python对间距很敏感,请正确缩进源代码。
-
间距有什么问题?它给我的错误是关于未识别的评估函数
-
当您尝试导入
from numexpr import evaluate时会发生什么?貌似贴出来的代码本身没有问题,但是无法导入才是问题。 -
@NicholasM,我正在使用 Quantopian 笔记本,当我尝试导入它时,它给了我这个:InputRejected:从 numexpr 导入评估引发了 ImportError。您的意思是从 numpy 导入 errstate 吗?
-
您应该编辑您的问题以包含该输出。您发布的代码不包含问题(它只是调用
evaluate函数)。真正的问题是尝试导入该函数时失败。
标签: pipeline quantopian