release 1.1.1

This commit is contained in:
fasiondog 2019-04-08 01:37:24 +08:00
parent df6ae00d23
commit 3f94f9b5e0
7 changed files with 139 additions and 2 deletions

View File

@ -205,6 +205,24 @@
* result(2): DEA: 慢线即快线的n3周期EMA平滑
.. py:function:: MAX(ind1, ind2)
求最大值, MAX(A,B)返回A和B中的较大值。
:param Indicator ind1: A
:param Indicator ind2: B
:rtype: Indicator
.. py:function:: MIN(ind1, ind2)
求最小值, MIN(A,B)返回A和B中的较小值。
:param Indicator ind1: A
:param Indicator ind2: B
:rtype: Indicator
.. py:function:: NOT([data])
求逻辑非。NOT(X)返回非X,即当X=0时返回1否则返回0。

View File

@ -6,7 +6,7 @@
1. HikyuuTDX 新增当前财务信息及历史财务信息下载
2. Stock 新增 getFinanceInfo、getHistoryFinanceInfo 支持当前及历史财务信息
3. 新增 LIUTONGPAN流通盘、HSL换手率、COUNT、IF、SUM、NOT、EXP、SGN、ABS指标
3. 新增 LIUTONGPAN流通盘、HSL换手率、COUNT、IF、SUM、NOT、EXP、SGN、ABS、MAX、MIN指标
4. Kdata添加便捷方法获取OPEN/CLOSE等基本行情数据如::
k = sm['sh000001'].getKData(Query(-100))
@ -33,7 +33,7 @@
C = CLOSE()
H = HIGH()
L = LOW()
MTR =SUM(H-L > ABS(H - REF(C,1) > ABS(REF(C,1) - L)),N);
MTR = SUM(MAX(MAX(H-L,ABS(H-REF(C,1))),ABS(REF(C,1)-L)),N);
HD = H-REF(H,1)
LD = REF(L,1)-L
DMP = SUM(IF(HD>0 & HD>LD, HD, 0), N)

View File

@ -261,6 +261,28 @@ MACD([data, n1=12, n2=26, n3=9])
"""
MAX.__doc__ = """
MAX(ind1, ind2)
, MAX(A,B)A和B中的较大值
:param Indicator ind1: A
:param Indicator ind2: B
:rtype: Indicator
"""
MIN.__doc__ = """
MIN(ind1, ind2)
, MIN(A,B)A和B中的较小值
:param Indicator ind1: A
:param Indicator ind2: B
:rtype: Indicator
"""
NOT.__doc__ = """
NOT([data])

View File

@ -24,6 +24,8 @@
#include "crt/LIUTONGPAN.h"
#include "crt/MA.h"
#include "crt/MACD.h"
#include "crt/MAX.h"
#include "crt/MIN.h"
#include "crt/NOT.h"
#include "crt/POS.h"
#include "crt/PRICELIST.h"

View File

@ -0,0 +1,40 @@
/*
* MAX.h
*
* Created on: 201948
* Author: fasiondog
*/
#ifndef INDICATOR_CRT_MAX_H_
#define INDICATOR_CRT_MAX_H_
#include "CVAL.h"
namespace hku {
Indicator MAX(const Indicator&, const Indicator&);
Indicator MAX(const Indicator&, price_t val);
Indicator MAX(price_t val, const Indicator& ind);
inline Indicator MAX(const Indicator& ind1, const Indicator& ind2) {
Indicator result = IF(ind1 > ind2, ind1, ind2);
result.name("MAX");
return result;
}
inline Indicator MAX(const Indicator& ind, price_t val) {
Indicator result = IF(ind > val, ind, val);
result.name("MAX");
return result;
}
inline Indicator MAX(price_t val, const Indicator& ind) {
Indicator result = IF(val > ind, val, ind);
result.name("MAX");
return result;
}
}
#endif /* INDICATOR_CRT_MAX_H_ */

View File

@ -0,0 +1,40 @@
/*
* MIN.h
*
* Created on: 201948
* Author: fasiondog
*/
#ifndef INDICATOR_CRT_MIN_H_
#define INDICATOR_CRT_MIN_H_
#include "CVAL.h"
namespace hku {
Indicator MIN(const Indicator&, const Indicator&);
Indicator MIN(const Indicator&, price_t val);
Indicator MIN(price_t val, const Indicator& ind);
inline Indicator MIN(const Indicator& ind1, const Indicator& ind2) {
Indicator result = IF(ind1 < ind2, ind1, ind2);
result.name("MIN");
return result;
}
inline Indicator MIN(const Indicator& ind, price_t val) {
Indicator result = IF(ind < val, ind, val);
result.name("MIN");
return result;
}
inline Indicator MIN(price_t val, const Indicator& ind) {
Indicator result = IF(val < ind, val, ind);
result.name("MIN");
return result;
}
}
#endif /* INDICATOR_CRT_MIN_H_ */

View File

@ -117,6 +117,13 @@ Indicator (*SGN_2)(const Indicator&) = SGN;
Indicator (*EXP_1)() = EXP;
Indicator (*EXP_2)(const Indicator&) = EXP;
Indicator (*MAX_1)(const Indicator&, const Indicator&) = MAX;
Indicator (*MAX_2)(const Indicator&, price_t) = MAX;
Indicator (*MAX_3)(price_t, const Indicator&) = MAX;
Indicator (*MIN_1)(const Indicator&, const Indicator&) = MIN;
Indicator (*MIN_2)(const Indicator&, price_t) = MIN;
Indicator (*MIN_3)(price_t, const Indicator&) = MIN;
void export_Indicator_build_in() {
def("KDATA", KDATA1);
@ -217,6 +224,14 @@ void export_Indicator_build_in() {
def("EXP", EXP_1);
def("EXP", EXP_2);
def("MAX", MAX_1);
def("MAX", MAX_2);
def("MAX", MAX_3);
def("MIN", MIN_1);
def("MIN", MIN_2);
def("MIN", MIN_3);
}