Pure-local Python quant trading framework covering stock, futures and options data, backtesting, simulated and live trading, and multi-account management.
shinnytech/tqsdk-python
A Python library for building futures, options and stock quant trading strategies, with live market data, historical data, backtesting and live or simulated trading.
- Stars
- 5,128
- Forks
- 791
- Open issues
- 5
- Last commit
- 12 days ago
Repolode describes open-source projects and does not give investment advice. Trading and investing can lose money: assess the risk yourself and follow the laws where you live before using this project.
What is it?
TqSdk is a Python library from Shinnytech for writing quantitative trading strategies with relatively little code. It covers the full workflow in one package: real-time and historical market data, development and debugging, backtesting at tick and bar level, simulated trading, live trading, and runtime monitoring.
The library works with futures, options and stocks. It connects to many futures brokers through CTP direct connections and several asset-management and high-speed trading counters. Market and trading data are kept in an in-memory database, so users do not need to set up or maintain a database themselves. Data can be handled with pandas and numpy, and the library includes a set of technical indicator functions with source code.
Strategies are not forced into a fixed framework. A single program can subscribe to several instruments' bars or quotes and trade multiple contracts at once.
Key features
- 01Real-time quotes and full historical tick and bar data for futures, options and stocks.
- 02Tick-level and bar-level backtesting.
- 03Simulated and live trading, including CTP direct connection and many brokers.
- 04In-memory market and trading data, with no database setup required.
- 05Works with pandas and numpy, and includes nearly a hundred technical indicator functions.
- 06Flexible strategy structure that can trade several instruments in one program.
Use cases
- Building and backtesting futures spread or arbitrage strategies in Python.
- Running automated live or simulated trading across multiple futures brokers.
- Analyzing historical tick and bar data with pandas for research.
Topics
FAQ
- What is tqsdk-python?
- A Python library for building futures, options and stock quant trading strategies, with live market data, historical data, backtesting and live or simulated trading. TqSdk is a Python library from Shinnytech for writing quantitative trading strategies with relatively little code. It covers the full workflow in one package: real-time and historical market data, development and debugging, backtesting at tick and bar level, simulated trading, live trading, and runtime monitoring.
- Is tqsdk-python free to use? What license does it have?
- tqsdk-python is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is tqsdk-python still maintained?
- Actively maintained. The last commit to tqsdk-python was on Oct 26, 2026.
- What can I use tqsdk-python for?
- Building and backtesting futures spread or arbitrage strategies in Python. Running automated live or simulated trading across multiple futures brokers. Analyzing historical tick and bar data with pandas for research.
- Where can I get tqsdk-python?
- The source code and installation instructions are on GitHub: https://github.com/shinnytech/tqsdk-python
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
MCP server giving AI assistants 39 tools for market data, technical analysis, screeners, backtesting and sentiment across crypto, stocks, forex and futures.
A local quant data engine for China A-share daily/minute K-line, ETF and tick data, with incremental sync, adjustment, batch queries, indicators and backtesting.
A lightweight Python framework for building and running CTP-based futures trading strategies, with live trading and backtesting.
A unified trading API library that lets code connect to 100+ crypto exchanges and prediction markets through one interface.
Native C++20 desktop terminal for financial research, with Qt6 UI, embedded Python analytics, AI agents and 100+ market data connectors.