EasyQuant¶
Event-driven quantitative backtesting framework for the China A-share market.
Getting Started
From installation to running your first backtest — up and running in 15 minutes.
Start →How-to Guides
Find what you need by scenario: writing strategies, running backtests, reading reports.
Browse →Tutorials
An 11-part series from zero to live trading, with real strategy examples.
Learn →API Reference
Parameters, return values, and examples for every public API in eqlib.
Web Studio
Write strategies, run backtests, and view reports — all in your browser.
Try it →Core Capabilities¶
- Event-driven backtesting —
initialize→run_daily→handle_data, consistent with JoinQuant / Zipline - Comprehensive A-share data — Daily / minute / tick bars, financial summaries, money flow, northbound capital, limit up/down statistics
- Risk analysis — Sharpe / Sortino / Max Drawdown / Alpha & Beta / Brinson attribution
- Portfolio risk control — VaR, strategy correlation, concentration risk, Kill Switch circuit breaker
- Paper trading + PTrade/QMT adapter — Pre-live verification + one-click export to broker platforms
Minimal Example¶
from eqlib import *
def initialize(context):
g.security = '601390'
set_benchmark('000300.XSHG')
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:
order_value(g.security, context.portfolio.available_cash)
elif price < ma20 * 0.98 and context.portfolio.positions.get(g.security):
order_target(g.security, 0)
result = run_strategy(
initialize,
start_date='2024-01-01',
end_date='2024-12-31',
starting_cash=100000,
securities=['601390'],
)
Order execution model:
order*APIs only place orders within the current callback; they are actually filled at the next trading day's opening price to avoid look-ahead bias. See Backtest Execution Model for details.
Report Preview¶
| MACD Trend + Volume | Bollinger Band Mean Reversion | Support/Resistance |
|---|---|---|
| Results vary with market conditions | Results vary with market conditions | Results vary with market conditions |
![]() |
![]() |
![]() |
Info
This documentation is for learning and research purposes only and does not constitute investment advice.


