Skip to main content

A quantitative analysis project for financial data.

Project description

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 - Work in Progress).

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

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

Why python-quanta

I provide local database construct automatically
    all you need is just running:
        -- quanta.data.daily()
    including:
        -- trading data: stock, index(not in CSI), etf
        -- finance data: stock

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)

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

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)

V standard factor library (Roadmap)
    Ongoing implementation of benchmark factors for strategy comparison:
        -- Barra Risk Model factors, Alpha 101, etc.

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                       <-- 数据库配置 (必填)

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 名称

Why python-quanta

I 提供自动化本地数据库构建
    仅需运行以下指令即可全自动同步 ETL:
        -- quanta.data.daily()
    包含数据:
        -- 交易数据: 股票, 指数(非中证系列), ETF.
        -- 财务数据: 全量股票财务报表.

II 专业金融分析扩展 (基于 pandas.DataFrame)
    -- DataFrame.gen
                    .group()                 # 基于多因子理论的高效分组函数
                    .portfolio()             # 计算基于分组结果的投资组合收益
    -- DataFrame.rollings
                    .sth()                   # 专用滚动窗口函数(如: "获取21日内成交量最大的3个交易日")
    -- DataFrame.stats
                    .neutral()               # 因子中性化处理及截面 OLS 回归

III 数据库增强型高级功能
    需配合聚宽账户以实现更强大的分析能力:
    -- DataFrame.f.listing                   # 根据上市日期过滤
                   not_st                    # 剔除 ST/退市风险警示股票
                   tradestatus               # 根据交易状态过滤
                   index_members             # 获取指数成分股(如 '300', '500')
                   label                     # 获取行业分类信息(如申万一级)
                   ic                        # 因子 IC (Information Coefficient) 计算
                   ir                        # 因子 IR (Information Ratio, 年化) 计算
                   port / test               # 快速计算分组收益及策略回测

IV 高效研究流工具 (quanta.flow)
    `flow` 模块为因子与策略研发提供高层抽象:
    -- quanta.flow.astock("key")             # 获取价格或财务数据的统一接口
    -- quanta.flow.astock._help              # 快速查询数据库表, 字段及注释信息
    -- quanta.flow.astock.help("key")        # 模糊搜索元数据(如搜索 "oper" 获取营业相关字段)

V 标准因子库 (发展路线)
    持续集成行业标准因子以供对比与测试:
        -- Barra 风险因子, Alpha 101 系列因子等.

Notices

欢迎任何建议与反馈! ^_^
如需测试数据或技术咨询, 请联系: porcorossobaojie@gmail.com

Project details


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.5.0.tar.gz (53.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_quanta-0.5.0-py3-none-any.whl (73.8 kB view details)

Uploaded Python 3

File details

Details for the file python_quanta-0.5.0.tar.gz.

File metadata

  • Download URL: python_quanta-0.5.0.tar.gz
  • Upload date:
  • Size: 53.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for python_quanta-0.5.0.tar.gz
Algorithm Hash digest
SHA256 24e986421538604b8b282953eb02316b1f334d70e53da3b01323709b4cbe416a
MD5 114d5d9cb525be3f2006df3b3bd79c1d
BLAKE2b-256 f65bbefcd0baffd23faf592f292729e8cf7d1247e6bc570729d36ad007246870

See more details on using hashes here.

File details

Details for the file python_quanta-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: python_quanta-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 73.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for python_quanta-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 631cdbb74c9fd725f8915e493ca6fb503e0509128800dd4b7599512ec4651307
MD5 d7b507a61f10f96cf53da57ad3b1e6bc
BLAKE2b-256 1450baec298c4a58ac21690060f34194bb05d36fb866105fcb8b2c27f9f81471

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page