QtFactor
QtFactor 是面向量化研究的数据访问库,统一封装了 Tushare 与 QMT 的接口,支持以同一种调用方式获取多源数据,覆盖基础资料、行情、资金、财务与高频逐笔等核心数据场景。
能获取哪些数据
- Tushare 系列(完整兼容原始 39 个接口)
- 基础资料:股票列表、行业/地域、上市/退市、交易日历等
- 行情与指标:日线/周线/月线、复权、技术指标、资金面等
- 财务相关:利润表、资产负债表、现金流量、财务指标等
- 指数/期货/基金等常用板块数据
- QMT 系列(实时/高频)
get_market_data_ex:按周期获取 K 线、复权因子等,原始字典返回,其中包含DataFrameget_full_tick:获取全量逐笔 tick 原始数据(字典格式,不做转换)
- 特殊处理
pro_bar:遵循官方约定,走ts.pro_bar特殊通道,保持与 Tushare 标准一致
返回格式说明
- Tushare 接口:统一返回
pandas.DataFrame - QMT
get_market_data_ex:返回字典,字典中某些键对应DataFrame - QMT
get_full_tick:返回原始字典,不做任何格式转换
安装
pip install QtFactor
导入与快速上手
from QtFactor import QtFactor
# 使用授权码初始化(无授权码联系管理员:微信 QUANT0808)
q = QtFactor("YOUR_LICENSE_CODE")
# 示例1:获取股票基础信息(Tushare)
df_basic = q.stock_basic(fields='ts_code,name,area,industry')
print(df_basic.head())
# 示例2:获取 K 线行情(QMT)
data_kline = q.get_market_data_ex(stock_code='600519.SH', period='1d', count=5)
print(type(data_kline), list(data_kline.keys()))
# 示例3:获取全量逐笔(QMT)
tick = q.get_full_tick(stock_list=['000001.SZ'])
print(type(tick))
使用前提
- 该包为客户端组件,需要有可访问的服务端实例;服务端地址通过包内
SERVER_URL配置 - QMT 数据获取需本机启动 MiniQMT,并按要求先订阅后拉取(
get_market_data_ex已在服务端内置顺序)
Metadata
Release files for QtFactor 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| qtfactor-0.1.3.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qtfactor-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / qtfactor-0.1.3.tar.gz
| Download URL | qtfactor-0.1.3.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91a71067cd28be986fff315740c69d0ddeda1604d2485f28b3c7e2cb732ec5df
|
|
BLAKE2b-256 checksum How to use checksums |
310840f586d13dfc7c9d720467543272615a869ed3e1a0216766ed8e52b2bc1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / qtfactor-0.1.3-py3-none-any.whl
| Download URL | qtfactor-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a59a0359c7476690155b1d17db3865be35fc5808cb558874c37818794551ef4
|
|
BLAKE2b-256 checksum How to use checksums |
2995a0c8531196c3521a6cb907ee7bcfe123fac72f4e075e1776abfb7ffd2dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for QtFactor 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.