quanta
Summary
A local-first quantitative research framework designed for:
-- providing specialized financial analysis modules and functions.
-- abstracting database connectivity to streamline data access for researchers.
-- deep integration with JoinQuant (JQData) for professional-grade data support.
-- supporting industry-standard factor models (e.g., Barra - Completed Style Factors).
How Install
pip install python-quanta -i https://pypi.org/simple
How Initial Local Settings
I new docoument like:
your project
|-- .env <-- build by user
|-- account.yaml <-- build by user if you have
|-- libs.yaml <-- must build
|-- trade.yaml <-- build by user if you trade
II if having join quant account, create file <account.yaml>:
account.yaml
----
joinquant:
username: 'your_user_name'
password: 'your_password'
III set up your database env, create file <libs.yaml>:
libs.yaml
----
db:
recommand_settings: DuckDB # recommand database type
DuckDB:
recommand_settings:
path: 'E:/ProgramData/DuckDB' # path of database file
database: Locals # name of database file
schema: jq_data # schema name
parquet: minute_freq # sub-directory for minute-freq parquet files
IV if using the trading workflow, create file <trade.yaml>:
trade.yaml
----
system:
path: 'd:/strategys' # root path of strategy files
order: order
settle: settle
strategy_001:
YOUR_ID:
pipeline: tonghua # broker pipeline name
broker: guotai # broker name (e.g., guotai, pingan)
id: 'your_account_id'
password: 'your_account_password'
init_assets: 1_000_000
strategy: strategy_001
portfolio_count: 40
portfolio_range: 250
status: running
For technical details on the underlying database abstraction and supported engines, see:
[Database Abstraction Layer](src/quanta/libs/db/README.md)
For a detailed explanation of all configuration fields, see:
[Configuration Definitions](src/quanta/config/README.md)
Why python-quanta
I provide local database construct automatically
all you need is just running:
-- quanta.data.daily() # daily-frequency data
-- quanta.data.minute() # minute-frequency data
including:
-- trading data: stock, index, etf
-- finance data: stock statements, fund shares & targets
For details on data provider integration and table logic, see:
[Data Management](src/quanta/data/README.md)
II specialized financial analytical extensions (based on pandas.DataFrame)
-- DataFrame.gen
.group() # quick-grouping based on multi-factor theory
.portfolio() # get returns of each group generated by function above
-- DataFrame.rollings
.sth() # specialized rolling, e.g., "get 3 max volume in 21 days"
-- DataFrame.stats
.neutral() # OLS or factor neutralization (e.g., .stats.neutral)
For a full reference of available accessors and metrics, see:
[Analytical Extensions](src/quanta/libs/_pandas/README.md)
III more powerful functions with database
if user have join quant account, python-quanta will be more powerful:
-- DataFrame.f.listing # filter portfolio by listed date
not_st # filter portfolio by ST status
tradestatus # filter portfolio by trade status
index_members # get index constituents (e.g., '300', '500')
label # get industry classifications (e.g., "swl1_code")
ic # Information Coefficient (IC)
ir # Information Ratio (IR, annual)
port / test # rapid group return calculation and backtesting
For a deep dive into research interfaces and Pandas extensions, see:
[Research Flow Layer](src/quanta/libs/_flow/README.md) --> _extra_pandas
IV high-efficiency research workflow (quanta.flow)
The `flow` module provides a high-level abstraction for factor/strategy research:
-- quanta.flow.astock("key") # unified interface for price and financial data
-- quanta.flow.astock._help # metadata lookup for tables, columns, and comments
-- quanta.flow.astock.help("keyword") # fuzzy search within metadata (e.g., "oper" for operating data)
For a deep dive into research interfaces and Pandas extensions, see:
[Research Flow Layer](src/quanta/libs/_flow/README.md) --> _main
V standard factor library (faclib)
Benchmark factors for risk modeling and strategy comparison:
-- Barra USA4 Style Factors (Completed):
Size, Beta, Momentum, Residual Volatility, Liquidity, Earnings Yield, Growth, Leverage, etc.
-- Barra CN6 Style Factors (Completed):
Size, Beta, Volatility, Liquidity, Momentum, Quality, Value, Growth, Dividend, etc.
-- Alpha 101 (Roadmap)
VI strategy development & trading workflow
The strategy meta-framework and trading account provide a complete
factor-driven research-to-execution pipeline:
-- quanta.strategies.meta.main # base strategy class with factor, pool, ranker,
rebalance, signal, and order-writing hooks
-- quanta.account # trading account managing order/settlement paths
and broker pipelines (e.g., tonghua)
Notices
welcome for advise! ^_^
if you want data for testing python-quanta, please mail: porcorossobaojie@gmail.com
quanta (中文版)
Summary
本地优先的量化研究框架, 旨在:
-- 提供针对金融场景优化的专业分析模块与函数.
-- 抽象化数据库连接细节, 使研究员能够高效获取所需数据.
-- 深度集成聚宽 (JQData) API, 提供强大的专业数据支持.
-- 支持行业标准因子模型 (如 Barra 风险模型 - 已完成风格因子).
How Install
pip install python-quanta -i https://pypi.org/simple
How Initial Local Settings
I 新建配置文件:
你的项目目录/
|-- .env <-- 环境变量配置文件
|-- account.yaml <-- 聚宽账户凭据 (可选)
|-- libs.yaml <-- 数据库配置 (必填)
|-- trade.yaml <-- 交易账户配置 (如需交易)
II 若有聚宽账户, 创建 <account.yaml>:
account.yaml
----
joinquant:
username: 'your_user_name'
password: 'your_password'
III 配置数据库环境 <libs.yaml>:
libs.yaml
----
db:
recommand_settings: DuckDB # 推荐使用的存储引擎
DuckDB:
recommand_settings:
path: 'E:/ProgramData/DuckDB' # 本地数据库存放路径
database: Locals # 数据库文件名
schema: jq_data # Schema 名称
parquet: minute_freq # 分钟频 parquet 文件存放子目录
IV 若使用交易工作流, 创建 <trade.yaml>:
trade.yaml
----
system:
path: 'd:/strategys' # 策略文件根目录
order: order
settle: settle
strategy_001:
YOUR_ID:
pipeline: tonghua # 经纪商流水线名称
broker: guotai # 经纪商名称 (如 guotai, pingan)
id: 'your_account_id'
password: 'your_account_password'
init_assets: 1_000_000
strategy: strategy_001
portfolio_count: 40
portfolio_range: 250
status: running
有关底层数据库抽象及支持引擎的技术详情, 请参阅:
[数据库抽象层详解](src/quanta/libs/db/README.md)
有关所有配置字段的详细定义说明, 请参阅:
[配置定义详解](src/quanta/config/README.md)
Why python-quanta
I 提供自动化本地数据库构建
仅需运行以下指令即可全自动同步 ETL:
-- quanta.data.daily() # 日频数据
-- quanta.data.minute() # 分钟频数据
包含数据:
-- 交易数据: 股票, 指数, ETF.
-- 财务数据: 股票财务报表, 基金份额及目标.
有关数据供应商集成及表逻辑的详细说明, 请参阅:
[数据管理详解](src/quanta/data/README.md)
II 专业金融分析扩展 (基于 pandas.DataFrame)
-- DataFrame.gen
.group() # 基于多因子理论的高效分组函数
.portfolio() # 计算基于分组结果的投资组合收益
-- DataFrame.rollings
.sth() # 专用滚动窗口函数(如: "获取21日内成交量最大的3个交易日")
-- DataFrame.stats
.neutral() # 因子中性化处理及截面 OLS 回归
有关可用访问器及指标的完整参考, 请参阅:
[专业分析扩展详解](src/quanta/libs/_pandas/README.md)
III 数据库增强型高级功能
需配合聚宽账户以实现更强大的分析能力:
-- DataFrame.f.listing # 根据上市日期过滤
not_st # 剔除 ST/退市风险警示股票
tradestatus # 根据交易状态过滤
index_members # 获取指数成分股(如 '300', '500')
label # 获取行业分类信息(如申万一级)
ic # 因子 IC (Information Coefficient) 计算
ir # 因子 IR (Information Ratio, 年化) 计算
port / test # 快速计算分组收益及策略回测
有关研究接口及 Pandas 扩展功能的深入说明, 请参阅:
[研究流层详解](src/quanta/libs/_flow/README.md) --> _extra_pandas
IV 高效研究流工具 (quanta.flow)
`flow` 模块为因子与策略研发提供高层抽象:
-- quanta.flow.astock("key") # 获取价格或财务数据的统一接口
-- quanta.flow.astock._help # 快速查询数据库表, 字段及注释信息
-- quanta.flow.astock.help("key") # 模糊搜索元数据(如搜索 "oper" 获取营业相关字段)
有关研究接口及 Pandas 扩展功能的深入说明, 请参阅:
[研究流层详解](src/quanta/libs/_flow/README.md) --> _main
V 标准因子库 (faclib)
持续集成行业标准因子以供对比与测试:
-- Barra USA4 风格因子 (已完成):
包含市值, 贝塔, 动量, 残差波动率, 流动性, 盈利, 成长, 杠杆等 10 大风格因子.
-- Barra CN6 风格因子 (已完成):
包含市值, 贝塔, 波动率, 流动性, 动量, 质量, 价值, 成长, 红利等风格因子.
-- Alpha 101 系列因子 (发展路线).
VI 策略研发与交易工作流
策略元框架与交易账户提供完整的因子驱动研究到执行流水线:
-- quanta.strategies.meta.main # 基础策略类, 提供因子, 股票池, 排序, 再平衡,
信号及下单写入等钩子方法
-- quanta.account # 交易账户, 管理订单/结算路径及经纪商流水线
(如 tonghua)
Notices
欢迎任何建议与反馈! ^_^
如需测试数据或技术咨询, 请联系: porcorossobaojie@gmail.com
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_quanta-0.9.0.tar.gz
(111.1 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
python_quanta-0.9.0-py3-none-any.whl
(149.9 kB
view details)
File details
Details for the file python_quanta-0.9.0.tar.gz.
File metadata
- Download URL: python_quanta-0.9.0.tar.gz
- Upload date:
- Size: 111.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a17c94d00d58126ae7b399f373de52a4fb5bfe492058e8a7ef8acd4bbab50a7
|
|
| MD5 |
73066bc465cc7842760a81f12e932e31
|
|
| BLAKE2b-256 |
5cd5151ca8cf8602b65050defa218a56aa29b75c1af5f37fed0c82000354785c
|
File details
Details for the file python_quanta-0.9.0-py3-none-any.whl.
File metadata
- Download URL: python_quanta-0.9.0-py3-none-any.whl
- Upload date:
- Size: 149.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc3e2bd77c4c0ca296f8b42a2f337a1798698fd1333a08006c8e6e721073956
|
|
| MD5 |
dceaef0260a8c231e114a7493d217c33
|
|
| BLAKE2b-256 |
01376799a9ad469ea35ef39413a45f0a3770fefe6efa173f3e9ede44e74f0029
|