A client for the QtFactor API
Project description
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已在服务端内置顺序)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qtfactor-0.1.3.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qtfactor-0.1.3.tar.gz.
File metadata
- Download URL: qtfactor-0.1.3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91a71067cd28be986fff315740c69d0ddeda1604d2485f28b3c7e2cb732ec5df
|
|
| MD5 |
a0cbdccb95578f9a1de4c2d241327eb4
|
|
| BLAKE2b-256 |
310840f586d13dfc7c9d720467543272615a869ed3e1a0216766ed8e52b2bc1a
|
File details
Details for the file qtfactor-0.1.3-py3-none-any.whl.
File metadata
- Download URL: qtfactor-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a59a0359c7476690155b1d17db3865be35fc5808cb558874c37818794551ef4
|
|
| MD5 |
c719bcbb7cd5a1cdf1df1c10c99d0d10
|
|
| BLAKE2b-256 |
2995a0c8531196c3521a6cb907ee7bcfe123fac72f4e075e1776abfb7ffd2dff
|