Pyti RSS产生负数

时间:2019-04-18 21:12:48

标签: python

Pyti相对强度指数在0到100之间时会产生负数。

session

1 个答案:

答案 0 :(得分:0)

pyti内有一个错误:

gains =  [0 if filtered_gain[idx] is True else changes[idx] for idx in range(0, len(filtered_gain))]
                                      ^
                     Here -------------
                                      V
losses = [0 if filtered_loss[idx] is True else abs(changes[idx]) for idx in range(0, len(filtered_loss))]
导致gainslosses忽略实际收益/损失的

。另外,如果您考虑到该库中的最后一次提交是一年前的,您将了解此错误被修复的可能性很小。

我建议您将this代码复制粘贴到您的项目中并更改以下行:

gains =  [0 if filtered_gain[idx] is True else changes[idx] for idx in range(0, len(filtered_gain))]

losses = [0 if filtered_loss[idx] is True else abs(changes[idx]) for idx in range(0, len(filtered_loss))]

这些:

gains =  [0 if filtered_gain[idx] else changes[idx] for idx in range(0, len(filtered_gain))]

losses = [0 if filtered_loss[idx] else abs(changes[idx]) for idx in range(0, len(filtered_loss))]