Hikyuu
|
指标类,具体由IndicatorImp实现,实现新指标时应继承IndicatorImp 更多...
#include <Indicator.h>
Public 成员函数 | |
Indicator () | |
Indicator (const IndicatorImpPtr &imp) | |
Indicator (const Indicator &) | |
virtual | ~Indicator () |
Indicator & | operator= (const Indicator &) |
Indicator | operator() (const Indicator &ind) |
使用已有参数计算新值,返回全新的Indicator 更多... | |
string | name () const |
指标名称 更多... | |
void | name (const string &name) |
string | long_name () const |
返回形如:Name(param1_val,param2_val,...) 更多... | |
size_t | discard () const |
结果中需抛弃的个数 更多... | |
void | setDiscard (size_t discard) |
设置抛弃的个数,如果小于原有的discard则无效 更多... | |
size_t | getResultNumber () const |
返回有几个结果集输出 更多... | |
bool | empty () const |
判断是否为空 更多... | |
size_t | size () const |
获取大小 更多... | |
price_t | operator[] (size_t pos) const |
只获取第一个结果集中相应位置输出,等同于get(pos, 0) 更多... | |
price_t | get (size_t pos, size_t num=0) const |
获取第num个结果集中指定位置的数据 更多... | |
Indicator | getResult (size_t num) const |
PriceList | getResultAsPriceList (size_t num) const |
template<typename ValueType > | |
void | setParam (const string &name, const ValueType &value) |
template<typename ValueType > | |
ValueType | getParam (const string &name) const |
IndicatorImpPtr | getImp () const |
Protected 属性 | |
IndicatorImpPtr | m_imp |
友元 | |
class | boost::serialization::access |
HKU_API friend std::ostream & | operator<< (std::ostream &, const Indicator &) |
指标类,具体由IndicatorImp实现,实现新指标时应继承IndicatorImp
实现新指标时,应继承IndicatorImp类,并定义相关的指标生成函数,如:
class Ma: public IndicatorImp { public: MA(size_t); MA(const Indicator&, size_t);
virtual string name() { return "MA"; } virtual string toString() { retun "Indicator(MA)"; } };
Indicator HKU_API MA(size_t n = 30) { return Indicator(IndicatorImpPtr(new MA(n))); }
Indicator HKU_API MA(const Indicator& indicator, size_t n = 30);
|
inline |
hku::Indicator::Indicator | ( | const IndicatorImpPtr & | imp | ) |
hku::Indicator::Indicator | ( | const Indicator & | indicator | ) |
|
virtual |
size_t hku::Indicator::discard | ( | ) | const |
结果中需抛弃的个数
bool hku::Indicator::empty | ( | ) | const |
判断是否为空
|
inline |
获取第num个结果集中指定位置的数据
pos | 结果集中的位置 |
num | 第几个结果集 |
|
inline |
|
inline |
|
inline |
|
inline |
size_t hku::Indicator::getResultNumber | ( | ) | const |
返回有几个结果集输出
string hku::Indicator::long_name | ( | ) | const |
返回形如:Name(param1_val,param2_val,...)
string hku::Indicator::name | ( | ) | const |
指标名称
void hku::Indicator::name | ( | const string & | name | ) |
|
inline |
只获取第一个结果集中相应位置输出,等同于get(pos, 0)
void hku::Indicator::setDiscard | ( | size_t | discard | ) |
设置抛弃的个数,如果小于原有的discard则无效
|
inline |
size_t hku::Indicator::size | ( | ) | const |
获取大小
|
friend |
|
protected |