Synthetic demo data
Event-Driven · China A-Share · Open Source

A-share backtesting
where every cent counts.

EasyQuant is an event-driven backtesting framework for China's A-share market. Exchange calendar, price-limit enforcement, T+1, fees and slippage — production-grade market semantics in a single pip install.

$pip install easyquant-eqlib
Scroll
SSE Composite 3,247.86 +0.87% SZSE Component 10,562.13 +1.24% ChiNext 2,183.45 −0.62% CSI 300 3,912.60 +0.45% CSI 500 5,834.02 −0.18% STAR 50 986.71 +2.03% Northbound+5.82B inflow Limit up/down62 / 7 Turnover984.2B Demo data · not live
0+
unit tests
driven by adversarial audits
0
battle-tested examples
from first backtest to portfolios
0
data APIs with PIT guards
no future data in-session
0d
annualization basis
true A-share trading days
Capabilities

One framework, from research to live trading

01
⚙

Event-Driven Engine

initialize → run_daily → handle_data, compatible with the JoinQuant / Zipline mental model. Signals on day T fill at day T+1 open — no look-ahead, by construction.

Execution model →
02
▤

Full A-Share Data

Daily / minute / tick bars, fundamentals, money flow, northbound capital, limit-up/down stats. Local cache with resumable downloads for reproducible offline research.

Data APIs →
03
∑

Risk & Attribution

Sharpe / Sortino / Max Drawdown / Alpha·Beta, and a true single-period BHB Brinson attribution — allocation + selection + interaction, mathematically closed.

Analysis APIs →
04
⛨

Portfolio Risk

VaR, strategy correlation, concentration, and a kill switch.

Risk guides →
05
◉

Paper Trading + Alerts

Live-data paper trading with session gating, DingTalk / Feishu push.

Paper trading →
06
⇄

PTrade · QMT Export

One-click export to broker platforms — research to trading, seamless.

Export guide →
Rigor

Four lines of defense,
so results survive review

The hard rules of the A-share market — exchange calendar, price limits, T+1, fees — are default behaviors in EasyQuant, not options.

Ⅰ

Price limits enforced by default

check_price_limit=True on by default; board- and date-aware limit table (ChiNext 20% since 2020-08-24), 5% ST channel. One-way limit boards can't be bought or sold into.

Ⅱ

PIT data contract

26 data APIs truncate to T-1 or warn inside backtest sessions; avoid_future_data strict mode raises.

Ⅲ

Exchange-authoritative calendar

Suspension-day orders cancelled same-day with recorded reasons; delisted positions force-liquidated after prolonged absence of bars. Backtest windows are never silently truncated.

Ⅳ

Cost-honest metrics

Win rate and profit/loss ratio include two-sided commission and stamp duty; missing benchmarks render N/A instead of silent numbers.

strategy.py — eqlib
from eqlib import * def initialize(context): g.security = '601390' # China Railway Group set_benchmark('000300.XSHG') # CSI 300 run_daily(market_open, time='every_bar') def market_open(context): hist = attribute_history(g.security, 20, '1d', ['close']) ma20 = hist['close'].mean() price = hist['close'].iloc[-1] if price > ma20 * 1.02: # breakout: full position order_value(g.security, context.portfolio.available_cash) elif price < ma20 * 0.98: # breakdown: exit order_target(g.security, 0) result = run_strategy(initialize, start_date='2024-01-01', end_date='2024-12-31', starting_cash=100000, securities=['601390']) # ✓ Fills respect price limits / T+1 / fees, no look-ahead # Sample output (synthetic data, not a promise of returns): # Total return +21.88% · Sharpe 0.33 · Max drawdown -9.4%
Reports

Every backtest ships a review-ready report

Equity curve, drawdown, monthly returns, per-trade ledger, attribution — in HTML / Markdown / JSON / PNG, ready for your research review.

Results vary with market conditions. Samples shown for illustration only.

From install to your first backtest report
in about 15 minutes.

From install to your first trustworthy backtest report — tutorials, examples and API references are all ready.

For research and education only. Not investment advice. · 仅供学习研究,不构成投资建议