Skip to main content

A-share low-frequency quantitative trading framework covering research, backtesting, and execution (formerly prism_quant)

Project description

PrismQuant

ไธญๆ–‡ | English

Version Platform Python Build License

Python Open-source Quantitative Framework: Covering the full "Research, Backtest, Trade" lifecycle, building an industrial-grade closed-loop quantitative workflow from scratch to production.

Strategy Signals Backtest Overview

๐ŸŽ“ Official Tutorials

iMOOC - AI Quantitative System Course

Official Course: Deeply deconstructing the framework's architecture from 0 to 1, covering live trading logic and industrial-grade quantitative development. An essential course for mastering PrismQuant.

๐Ÿ“ฆ Installation

pip install prism_quant

For previous version source code, visit: https://pypi.org/project/prism_quant/#history

โœจ Key Features

  • ๐Ÿ“ฅ Multi-source Data - Global multi-market historical/real-time data, ready to use
  • ๐Ÿง  Rapid Development - Signal-driven architecture, fast implementation with strategy templates
  • ๐Ÿ“‰ Professional Backtesting - High-performance matching engine, deep performance metrics and analysis
  • โšก Event-driven - Second-level market data distribution, millisecond-level Tick signal processing
  • ๐Ÿค– Live Gateway - Pluggable adapters, seamless switching between simulation and live trading

โšก Quick Start

import prism_quant as prq

# 1. Define strategy logic
class MyStrategy( prq.strategy.BaseStrategy):
    def generate_signals(self, data):
        bands = prq.indicators.TechnicalIndicators().boll(data["Close"])
        return prq.strategy.SignalGenerator().boll_signals(data["Close"], bands)

# 2. Minimal backtest & results
engine = prq.backtest.BacktestEngine()
engine.set_parameters("GOOGL", "2025-07-26", "2026-01-26")
engine.load_data()
engine.add_strategy(MyStrategy(name="BOLL"))
engine.run_backtest()
engine.show_report()
engine.show_chart(use_plotly=False)

๐Ÿš€ Application Example

PrismQuant is an open-source quantitative trading cloud platform based on prism_quant, integrating data services, strategy management, and trading access with paper and live support. Project: https://github.com/Delta-F/prism_quant/

PrismQuant Architecture PrismQuant Backtest Engine

๐Ÿ”Œ Interface Integration

  • [Data] yfinance โœ… - US, A-shares, HK, Crypto, Indices
  • [Data] eastmoney โœ… - OTC Funds (Index, QDII, Stock, Bond, Mixed)
  • [Data] miniQMT โœ… - A-share market data integration (see live trading section in the course)
  • [Trade] PaperTrade โœ… - Local simulation, tick-driven order matching, position and order management
  • [Trade] miniQMT Trade โœ… - A-share live trading (see live trading section in the course)

Minimal miniQMT live trade setup

from prism_quant.live import LiveEngine

engine = LiveEngine(symbol="000001.SZ", signal_interval="1m")
engine.set_data_gateway("miniqmt", interval=3.0, mode="poll")
engine.set_trade_gateway(
    "miniqmt",
    userdata_mini_path=r"D:\BrokerQMT\userdata_mini",
    account_id="1234567890",
)

See details:

  • documents/LiveEngine.md
  • documents/MiniQmtTrade.md
  • documents/MiniQmtLiveEngine.md

๐Ÿ—๏ธ Project Architecture

prism_quant/
โ”œโ”€โ”€ core/                          # Base classes, config, logging
โ”‚   โ”œโ”€โ”€ base.py
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ””โ”€โ”€ logger.py
โ”œโ”€โ”€ data/                          # Fetch, clean, store, source mapping
โ”‚   โ”œโ”€โ”€ fetcher.py
โ”‚   โ”œโ”€โ”€ cleaner.py
โ”‚   โ”œโ”€โ”€ storage.py
โ”‚   โ”œโ”€โ”€ source_map.py
โ”‚   โ””โ”€โ”€ miniqmt_xtdata.py          # miniQMT / xtquant historical bars
โ”œโ”€โ”€ indicators/                    # Technical & fundamental factors
โ”‚   โ”œโ”€โ”€ technical.py
โ”‚   โ”œโ”€โ”€ fundamental.py
โ”‚   โ””โ”€โ”€ talib_indicators.py
โ”œโ”€โ”€ strategy/                      # Strategy base & signal generation
โ”‚   โ”œโ”€โ”€ base.py
โ”‚   โ””โ”€โ”€ signals.py
โ”œโ”€โ”€ backtest/                      # Backtest engine, metrics, reporting
โ”‚   โ”œโ”€โ”€ engine.py
โ”‚   โ”œโ”€โ”€ metrics.py
โ”‚   โ””โ”€โ”€ performance.py
โ”œโ”€โ”€ live/                          # Event engine, gateways, LiveEngine
โ”‚   โ”œโ”€โ”€ event_engine.py
โ”‚   โ”œโ”€โ”€ gateways.py                # DataGateway / TradeGateway abstractions
โ”‚   โ”œโ”€โ”€ gateway_registry.py        # Gateway factory & registry
โ”‚   โ”œโ”€โ”€ engine.py                  # LiveEngine orchestration
โ”‚   โ””โ”€โ”€ models.py                  # TickData, OrderRequest, โ€ฆ
โ”œโ”€โ”€ adapters/                      # Pluggable data / trade adapters
โ”‚   โ”œโ”€โ”€ data/                      # Data gateways (yfinance, miniQMT, โ€ฆ)
โ”‚   โ”‚   โ”œโ”€โ”€ yfinance_gateway.py
โ”‚   โ”‚   โ””โ”€โ”€ miniqmt_gateway.py
โ”‚   โ””โ”€โ”€ trade/                     # Trade gateways (Paper, miniQMT, โ€ฆ)
โ”‚       โ”œโ”€โ”€ paper_gateway.py
โ”‚       โ”œโ”€โ”€ miniqmt_client.py      # xttrader client wrapper
โ”‚       โ””โ”€โ”€ miniqmt_gateway.py     # Limit orders / cancel for LiveEngine
โ”œโ”€โ”€ trader/                        # Matching, orders, positions
โ”‚   โ”œโ”€โ”€ engine.py
โ”‚   โ”œโ”€โ”€ order_manager.py
โ”‚   โ””โ”€โ”€ position_manager.py
โ””โ”€โ”€ charts/                        # Signal, price & performance charts
    โ”œโ”€โ”€ signals.py
    โ”œโ”€โ”€ price.py
    โ””โ”€โ”€ performance.py
Project Architecture Workflow

๐Ÿค Contributing

  • Feedback: Bug reports and contributions are welcome via Issue or Pull Requests.
  • WeChat Official Account: Follow PrismQuantๅผ€ๆบ้‡ๅŒ– for updates, strategies, and quantitative resources.

WeChat Official Account

๐Ÿ“„ License

MIT License. See LICENSE for details.

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

prism_quant-1.0.3.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

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

prism_quant-1.0.3-py3-none-any.whl (67.2 kB view details)

Uploaded Python 3

File details

Details for the file prism_quant-1.0.3.tar.gz.

File metadata

  • Download URL: prism_quant-1.0.3.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for prism_quant-1.0.3.tar.gz
Algorithm Hash digest
SHA256 3f0dec01e31f92eac1094de1a58f66f0894dae9c3b878b1684b7efe64bb39c6f
MD5 9f543f52fff31dc22d5ff5c3203c44ba
BLAKE2b-256 afecf9ee34a3f5b652a5f6b4b1b1bdb3aa4a7cb77ca189a4c64c9f3c1b646158

See more details on using hashes here.

File details

Details for the file prism_quant-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: prism_quant-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 67.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for prism_quant-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ed5a89f5008609492592ff089d602b1cb2739b041d4576a0bbdb201b3070ed12
MD5 5b0af14e9578de8df8f4d7082bdf6cd2
BLAKE2b-256 d9405e817c6bbeb21da9a282a17125169eb36d817dae398be9ffea23730c0d87

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