Indicator

class hikyuu.indicator.Indicator(name)

Indicator 指标定义

name 名称
long_name 名称
discard 需抛弃的点数
have_param(self, name)

是否存在指定参数

参数:

name (str) – 参数名称

get_param(self, name)

获取指定的参数

参数:

name (str) – 参数名称

返回:

参数值

抛出:

out_of_range – 无此参数

set_param(self, name, value)

设置参数

参数:
  • name (str) – 参数名称

  • value (int | bool | float | string) – 参数值

抛出:

logic_error – Unsupported type! 不支持的参数类型

support_ind_param(self)

是否支持动态指标参数

have_ind_param(self, name)

是否存在指定参数

参数:

name (str) – 参数名称

get_ind_param(self, name)

获取指定的动态指标参数

参数:

name (str) – 参数名称

返回类型:

IndParam

clone(self)

克隆操作

empty(self)

是否为空

返回类型:

bool

formula(self)

打印指标公式

返回类型:

str

get_result_num(self)

获取结果集数量

返回类型:

int

get(self, result_index[, num=0])

获取指定位置的值

参数:
  • pos (int) – 指定的位置索引

  • num (int) – 指定的结果集

get_datetime(self, pos)

获取指定位置的日期

参数:

pos (int) – 指定的位置索引

get_by_datetime(self, datetime[, result_index=0])

获取指定日期数值。如果对应日期无结果,返回 constant.null_price

参数:
  • datetime (Datetime) – 指定日期

  • num (int) – 指定的结果集

返回类型:

float

get_result(self, result_index)

获取指定结果集

参数:

result_index (int) – 指定的结果集

返回类型:

Indicator

get_result_as_price_list(self, result_index)

获取指定结果集

参数:

result_index (int) – 指定的结果集

返回类型:

list

get_datetime_list(self)

返回对应的日期列表

返回类型:

DatetimeList

get_context(self)

获取上下文

返回类型:

KData

set_context(self, kdata)

设置上下文

参数:

kdata (KData) – 关联的上下文K线

set_context(self, stock, query)

设置上下文

参数:
  • stock (Stock) – 指定的 Stock

  • query (Query) – 指定的查询条件