QMT Python API
因子获取
获取因子值
1
2
#encoding:gbk3
4
"""5
下载因子,需在行情源,选择因子数据 进行补充6
"""7
8
# 查询的因子板块9
10
name = "${sector_name}"11
# 查询的因子12
factor_name = "${factor_name}"13
# 开始时间14
start_time = "${start_time}"15
# 结束时间16
end_time = "${end_time}"17
18
19
def init(C):20
pass21
22
def after_init(C):23
# 获取查询的板块合约24
sector_code_list = C.get_stock_list_in_sector(name)25
# 获取板块因子26
return_fac_table = get_factor_values(stock_list=sector_code_list,factor_list=[factor_name],start_time=start_time,end_time=end_time)27
print(return_fac_table)28
29
def handlebar(C):30
pass31