Hikyuu
Public 成员函数 | Protected 属性 | 友元 | 所有成员列表
hku::Indicator类 参考

指标类,具体由IndicatorImp实现,实现新指标时应继承IndicatorImp 更多...

#include <Indicator.h>

Public 成员函数

 Indicator ()
 
 Indicator (const IndicatorImpPtr &imp)
 
 Indicator (const Indicator &)
 
virtual ~Indicator ()
 
Indicatoroperator= (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);

构造及析构函数说明

hku::Indicator::Indicator ( )
inline
hku::Indicator::Indicator ( const IndicatorImpPtr imp)
hku::Indicator::Indicator ( const Indicator indicator)
hku::Indicator::~Indicator ( )
virtual

成员函数说明

size_t hku::Indicator::discard ( ) const

结果中需抛弃的个数

bool hku::Indicator::empty ( ) const

判断是否为空

price_t hku::Indicator::get ( size_t  pos,
size_t  num = 0 
) const
inline

获取第num个结果集中指定位置的数据

参数
pos结果集中的位置
num第几个结果集
注解
不做下标越界检查,不会抛出异常
IndicatorImpPtr hku::Indicator::getImp ( ) const
inline
template<typename ValueType >
ValueType hku::Indicator::getParam ( const string name) const
inline
Indicator hku::Indicator::getResult ( size_t  num) const
inline
PriceList hku::Indicator::getResultAsPriceList ( size_t  num) const
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)
Indicator hku::Indicator::operator() ( const Indicator ind)

使用已有参数计算新值,返回全新的Indicator

Indicator & hku::Indicator::operator= ( const Indicator indicator)
price_t hku::Indicator::operator[] ( size_t  pos) const
inline

只获取第一个结果集中相应位置输出,等同于get(pos, 0)

注解
不做下标越界检查,也不抛出异常
void hku::Indicator::setDiscard ( size_t  discard)

设置抛弃的个数,如果小于原有的discard则无效

template<typename ValueType >
void hku::Indicator::setParam ( const string name,
const ValueType &  value 
)
inline
size_t hku::Indicator::size ( ) const

获取大小

友元及相关函数文档

friend class boost::serialization::access
friend
HKU_API friend std::ostream& operator<< ( std::ostream &  os,
const Indicator indicator 
)
friend

类成员变量说明

IndicatorImpPtr hku::Indicator::m_imp
protected

该类的文档由以下文件生成: