Brand LogoBrand Logo (Dark)
HomeAI AgentsToolkitsGitHub PicksSubmit AgentBlog

Categories

  • Art Generators
  • Audio Generators
  • Automation Tools
  • Chatbots & AI Agents
  • Code Tools
  • Financial Tools

Categories

  • Large Language Models
  • Marketing Tools
  • No-Code & Low-Code
  • Research & Search
  • Video & Animation
  • Video Editing

GitHub Picks

  • DeerFlow — ByteDance Open-Source SuperAgent Harness

Latest Blogs

  • OpenClaw vs Composer 2 Which AI Assistant Delivers More Value
  • Google AI Studio vs Anthropic Console
  • Stitch 2.0 vs Lovable Which AI Design Tool Wins in 2026
  • Monetizing AI for Solopreneurs and Small Teams in 2026
  • OpenClaw vs MiniMax Which AI Assistant Wins in 2026

Latest Blogs

  • OpenClaw vs KiloClaw Is Self-Hosting Still Better
  • OpenClaw vs Kimi Claw
  • GPT-5.4 vs Gemini 3.1 Pro
  • Farewell to Bloomberg Terminal as Perplexity Computer AI Redefines Finance
  • Best Practices for OpenClaw
LinkStartAI© 2026 LinkstartAI. All rights reserved.
Contact UsAbout
  1. Home
  2. GitHub Picks
  3. vn.py (VeighNa)
vn.py (VeighNa) logo

vn.py (VeighNa)

An open-source Python event-driven quant trading framework with multi-venue gateways, strategy apps, backtesting, execution algos, risk controls, and DB-backed GUI/script runs.
33.1kPythonMIT License
#python#event-driven#quant-trading#broker-gateway#strategy-engine
#backtesting
#algo-execution
#risk-manager
#multi-account
#alternative-to-backtrader
#alternative-to-zipline
#alternative-to-quantconnect

What is it?

vn.py (VeighNa) structures quant trading as an event-driven core plus plug-in modules. Ticks, order updates, fills, and account/position changes are normalized into an event stream, so strategies subscribe and emit intents while concurrency stays contained in the engine. Gateways unify venue specifics—connectivity, auth, an order state machine, and reconnect handling—behind stable interfaces, and apps reuse the same event bus to compose backtesting, execution algos, portfolio workflows, spreads/options, and pre-trade risk rules. Persistence adapters store bars, ticks, and trading logs in SQLite, MySQL, or PostgreSQL, making replay, regression, and incident reproduction practical for live operations.

Pain Points vs Innovation

✕Traditional Pain Points✓Innovative Solutions
With ad-hoc scripts, reconnects, rate limits, thread safety, and the order state machine leak into strategy code, turning execution into a brittle blob that is hard to replay and debug.vn.py draws a hard boundary with an event bus: gateways translate the outside world into events and handle execution details, while strategies map events to intents, reducing coupling and concurrency pain.
When research and live trading live in separate stacks, data conventions, assumptions, and risk rules drift, so backtests look stable while production behavior diverges.Unified domain objects and a plug-in app ecosystem put backtesting, execution, risk, and data management into one pipeline; recorded events make regression and incident reproduction operationally routine.

Architecture Deep Dive

Event-driven core and replayable determinism
vn.py uses an event-driven design because trading state changes are naturally discrete: ticks, order updates, fills, and account/position changes can be serialized into a single input stream. The event bus converts coupling from direct calls to publish/subscribe, so strategies don’t need to manage reconnect logic, rate limits, or an order state machine. Concurrency and I/O complexity stay in the engine and gateways, keeping strategy code focused, testable, and auditable. Most importantly, recorded event streams can be replayed to drive backtests, reproduce incidents, and run regression comparisons consistently.
Gateway encapsulation, app ecosystem, and persistence
Gateways hide venue-specific APIs behind stable interfaces and implement execution essentials internally: order state transitions, retries, and disconnect recovery. The app layer modularizes backtesting, execution algos, portfolio workflows, spreads/options tooling, pre-trade risk rules, and data management around unified domain objects. Persistence adapters store market data and trading logs in relational databases, enabling centralized querying, permissions, and long-lived replay inputs. With both GUI and script runs, teams can version configs and deployments to reduce operational drift and contain change impact.

Deployment Guide

1. Clone the repo and create a Python 3.10+ venv

bash
1git clone https://github.com/vnpy/vnpy.git && cd vnpy && python -m venv .venv && . .venv/bin/activate

2. Run the OS install script to set up dependencies

bash
1Windows: install.bat | Ubuntu: bash install.sh | macOS: bash install_osx.sh

3. (Optional) Install core and common apps via pip

bash
1pip install -U pip && pip install vnpy vnpy_ctastrategy vnpy_ctabacktester vnpy_algotrading vnpy_riskmanager

4. (Optional) Configure a DB adapter for centralized data/log storage

bash
1export VNPY_DATABASE_DRIVER=postgresql && export VNPY_DATABASE_HOST=127.0.0.1 && export VNPY_DATABASE_PORT=5432 && export VNPY_DATABASE_DATABASE=vnpy

5. Start via script and load gateways/apps

bash
1python run.py

Use Cases

Core SceneTarget AudienceSolutionOutcome
Live multi-venue execution looptrading teamsconnect multiple venues via unified gateways with execution algos and risk rulesfewer integration incidents and scalable live ops
Replay-driven backtests and regressionsquant researchersrecord event streams and replay them in the same engine for regression comparisonsreproducible results and faster incident triage
Multi-account ops and governanceops & riskcentralize logs and market data with consistent policiesbetter auditability, less manual drift, and safer rollouts

Limitations & Gotchas

Limitations & Gotchas
  • Real venue connectivity often requires extra gateway packages plus account/network setup, and some venues rely on vendor SDKs or OS constraints.
  • Backtest/live consistency depends on data quality, contract rules, and fee/slippage modeling; without pinned conventions, regressions drift and become hard to interpret.
  • Multi-process and multi-client setups improve throughput but increase config and monitoring complexity, so secrets, isolation, and alerting must be treated as first-class.

Frequently Asked Questions

How does vn.py compare to Backtrader/Zipline/QuantConnect?▾
vn.py is closer to a live-trading engineering skeleton: gateways handle connectivity, an order state machine, and reconnects, while apps provide backtesting, execution algos, pre-trade risk, and data management with DB persistence. In contrast, Backtrader and Zipline are commonly used as research/backtesting libraries and often need extra execution/ops work to go live; QuantConnect follows a hosted platform model, trading local control for cloud integration. A practical choice uses three hard constraints: do you need self-hosted gateways, do you need event replay to reproduce incidents, and do you need logs/data persisted in your own storage and permission model.
How do I wire gateways for stability across venues?▾
Start with an end-to-end validation on one venue: connectivity, auth, order updates, fills, and disconnect recovery. Then layer in risk rules and execution algos, version your configs, and persist logs so replay-driven regression can catch behavior drift before it hits production.
SQLite or PostgreSQL—which should I use?▾
For quick single-machine validation, SQLite is low-friction. When you need shared access, centralized market/trading logs, and stronger query/permission controls, PostgreSQL is the safer default. In both cases, plan write rates, indexes, and retention so high-frequency ingestion doesn’t interfere with replay and live runs.
View on GitHub

Project Metrics

Stars33.1 k
LanguagePython
LicenseMIT License
Deploy DifficultyMedium

Table of Contents

  1. 01What is it?
  2. 02Pain Points vs Innovation
  3. 03Architecture Deep Dive
  4. 04Deployment Guide
  5. 05Use Cases
  6. 06Limitations & Gotchas
  7. 07Frequently Asked Questions

Related Projects

nanobot
nanobot
22.5 k·Python
DeerFlow — ByteDance Open-Source SuperAgent Harness
DeerFlow — ByteDance Open-Source SuperAgent Harness
26.1 k·Python
gstack
gstack
0·TypeScript
Marketing for Founders
Marketing for Founders
2.2 k·Markdown