TqSdk is a Python library for building quantitative trading strategies that provides a complete solution from historical data through live trading across futures, options, and stocks.
The tool addresses the complexity of developing trading systems by offering a unified interface to market data and trading execution. It connects to market gateways and trading relays through a Diff protocol, providing real-time quotes, historical tick and candlestick data, backtesting capabilities, paper trading, and live execution. Users can write strategies with minimal code while accessing full tick-level and candlestick-level backtesting, technical indicators, and support for multiple accounts simultaneously. The in-memory data architecture eliminates database maintenance and access latency.
The project suits traders and developers building strategies for Chinese futures markets, where it supports connections to approximately ninety percent of futures brokers through CTP direct connections and various settlement platforms. It also handles stocks and options. The tool works well for strategies of any complexity level without enforcing a particular framework structure, allowing flexible use of multiple instruments and timeframes within a single program. Integration with pandas and numpy makes it suitable for teams doing quantitative analysis and data-driven development.
Development activity shows consistent engagement with the codebase through regular updates and maintenance. The project maintains active documentation and provides educational resources including a quick-start guide. Community support is supplemented by integration with AI assistants that can help with function explanations, strategy guidance, and error analysis. The tool is distributed as a Python package and runs on Windows, Linux, and macOS with Python 3.9 and later.