New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator需要做些测试啊 #429

Closed
musicx opened this Issue Apr 20, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@musicx
Copy link

musicx commented Apr 20, 2018

问题反馈

当您安装/使用QUANTAXIS的时候如果遇到任何问题, 您可以在这里提出,我们会在24小时内给您答复

您使用的QUANTAXIS版本号是什么?

1.0.22

您的系统信息(包括系统版本,系统架构(32/64),内存大小等等)

masOS

您的系统环境是什么?

- monodb
- nodejs v8
- python3.6
- docker (无)

您需要反馈的问题

QAIndicator.QAIndicator_Series.AVEDEV 是错的啊。。。用了tail(N)的话,就变成固定值了。。。
同理,QAIndicator.QAIndicator_DataFrame.CCI,tail(1)是单个值,即便去掉,AVEDEV是固定值的话,整个数列是错误的。。。

感谢您的反馈 如有意见和建议,请在此说明:

建议对数据处理的部分,建一些测试样例。
修正后的指标和新的指标,可以提pull request的吗?

您的联系方式(QQ/EMAIL)

musicxing

THANKS
by yutiansut
2017.12

@yutiansut

This comment has been minimized.

Copy link
Member

yutiansut commented Apr 20, 2018

提供下你的代码 @musicx

@yutiansut yutiansut closed this Apr 23, 2018

@musicx

This comment has been minimized.

Copy link

musicx commented May 23, 2018

不好意思一阵时间没来。看到CCI等指标已经更正了,感谢!
再提交一个bug: COUNT(COND, N) 是 错误的。
我的代码:

def count(cond, days):
signal = cond * 1 # cond 是 true/false的话,换成1/0
return reduce(lambda x, y: x + y, [signal.shift(x).fillna(0) for x in (range(days) if days >= 0 else range(-1, days-1, -1))])

没用rolling主要是要支持我用未来是否发生事件来做训练标签。

@yutiansut

This comment has been minimized.

Copy link
Member

yutiansut commented May 23, 2018

我测试一下

@yutiansut

This comment has been minimized.

Copy link
Member

yutiansut commented May 23, 2018

你的这个写法有点问题 @musicx 你会导致前N个的结果是错误的

@yutiansut yutiansut reopened this May 23, 2018

@yutiansut

This comment has been minimized.

Copy link
Member

yutiansut commented May 23, 2018

import numpy as np
import pandas as pd

def count(cond,N):
   return pd.Series(np.where(cond,1,0),index=cond.index).rolling(N).sum()
@musicx

This comment has been minimized.

Copy link

musicx commented May 24, 2018

CCI 还是不对,找了一下,是基础的AVEDEV函数还有问题

def AVEDEV(Series, N):
return Series.rolling(N).apply(lambda x: (np.abs(x - x.mean())).sum()/x.size, raw=True)

@yutiansut

This comment has been minimized.

Copy link
Member

yutiansut commented May 24, 2018

def AVEDEV(Series, N):
return Series.rolling(N).apply(lambda x: (np.abs(x - x.mean())).mean(), raw=True)
@QUANTAXISER

This comment has been minimized.

Copy link
Member

QUANTAXISER commented May 24, 2018

def AVEDEV(Series, N):
return Series.rolling(N).apply(lambda x: (np.abs(x - x.mean())).mean(), raw=True)
@QUANTAXISER

This comment has been minimized.

Copy link
Member

QUANTAXISER commented May 24, 2018

用这个 @musicx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment