QMT Python API

因子获取

获取因子值

qmt://docs/python
Python
1 
2#encoding:gbk
3 
4"""
5下载因子,需在行情源,选择因子数据 进行补充
6"""
7 
8# 查询的因子板块
9 
10name = "${sector_name}"
11# 查询的因子
12factor_name = "${factor_name}"
13# 开始时间
14start_time = "${start_time}"
15# 结束时间
16end_time = "${end_time}"
17 
18 
19def init(C):
20 pass
21 
22def 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 
29def handlebar(C):
30 pass
31 

智能助手

咨询式 AI · 带入当前文档

智能助手加载中...