CTP Direct Data Connector
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md and install @user_a459bc71/ctp-connector.
About this skill
CTP Direct Data is useful when a futures workflow needs to pull market data, order flow, and account state from a broker's CTP interface into a local engineering pipeline. Many quant setups do not just need a script that can connect to CTP; they also need to handle market subscription, order reports, position and funds queries, data persistence, and real-time distribution, especially across the configuration differences between SimNow testing and live penetration environments.
What It Solves
The skill wraps CTP as a reusable data and trading connector. On the market side, it supports Tick, depth, and K-line data. On the trading side, it covers placing orders, canceling orders, querying orders, fills, positions, and funds. For output, it supports CSV/JSON files, database storage, and real-time streaming through ZeroMQ or WebSocket. In a strategy project, it behaves more like a local data pipeline than a one-off API call.
How It Works
The core capabilities are split into modules: CTPMarketData handles market data, CTPTrader handles trading, and data models normalize returned structures. Configuration is managed through config/ctp_config.yaml plus environment variables, with sensitive fields recommended to be injected as ${ENV_VAR} to avoid plaintext passwords or auth_code. The typical run path is: log in to market and trading front ends, subscribe to contracts, receive reports, then write data to storage or push it to downstream services. For backtesting, persisted market data can be used directly as historical input. For live or near-realtime use, ZeroMQ/WebSocket can distribute data to strategy, monitoring, or visualization components.
Scope and Caveats
It is suitable for SimNow and the user's own live accounts, not for bypassing broker permissions or engaging in unauthorized trading. Before live use, verify app_id, auth_code, broker_id, front-end addresses, and complete penetration authentication. Connection failures usually require checking network reachability, credentials, trading hours, contract code casing, and login state. In production, pay attention to log masking, .env version control, pinned dependencies, and storage permissions.
Use Cases
- Subscribe to Tick and K-line data for selected contracts in SimNow, then save CSV files for strategy backtesting.
- Write CTP order, fill, position, and funds query results into a local database to create account-state snapshots.
- Push market data and trading reports to downstream strategy, monitoring, or visualization services via ZeroMQ or WebSocket.
- Load broker-provided AppID, AuthCode, and front-end addresses in a live penetration environment to log in and query positions.
Best For
- Quant strategy engineers who need to persist futures market data into CSV or database history.
- CTP API developers who need to switch and debug between SimNow and live front ends.
- Quant platform engineers who need to connect quotes, orders, positions, and funds to internal monitoring dashboards.
- Trading system designers who need a unified CTP data path for backtesting and realtime services.
Related Skills
Systematically scans national strategy, technology trends, capital flows, and regional capacity to identify future industries, priority tracks, and actionable deployment pathways.
Recognizes plant growth stages from images or videos and outputs structured agronomic analysis, risk notes, suggestions, and cloud report history.
Analyzes child images or videos for ASD-related social, behavioral, and stereotyped traits, then produces a structured report with early intervention suggestions.
Prepare, submit, and verify enterprise tax filings through Qixiangyun MCP, including roster checks, initialization, PDF download, and missing-declaration checks.