tqsdk-trading-and-data

tqsdk-trading-and-data is a skill for Codex from shinnytech/tqsdk-python. It costs 286 tokens per session (1,968 once invoked), scanned A, original, Apache-2.0.

Guidance for using TqSdk, a Python toolkit for market data, trading accounts, orders, positions, and backtesting futures or stocks.

In plain words
What is it for?
Use it to explain or implement market-data retrieval, historical downloads, account and position access, order placement or cancellation, target positions, and margin what-if analysis.
Why use it?
It helps avoid mistakes with TqSdk's update loop, account types, data fields, and differences between futures and stock workflows.

Skill for Codex

Written for Codex: agents/openai.yaml present.

About the project

shinnytech/tqsdk-python is an open-source Python library for developing quantitative trading strategies with futures, options, and stocks. It provides market data, backtesting, simulated trading, live trading, monitoring, and risk-management functions for quantitative developers and traders. The catalogue skill teaches AI agents how to use TqSdk for trading and data tasks.

shinnytech/tqsdk-python · 4,998 stars · on GitHub · doc.shinnytech.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/shinnytech/tqsdk-python/tqsdk-trading-and-data
Any agent
npx skills add shinnytech/tqsdk-python --skill tqsdk-trading-and-data
Clone the repo
git clone --depth 1 https://github.com/shinnytech/tqsdk-python

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tqsdk-trading-and-data

README.md
[![agentmods](https://agentmods.dev/badge/skills/shinnytech/tqsdk-python/tqsdk-trading-and-data.svg)](https://agentmods.dev/skills/shinnytech/tqsdk-python/tqsdk-trading-and-data)
Your own site
<a href="https://agentmods.dev/skills/shinnytech/tqsdk-python/tqsdk-trading-and-data"><img src="https://agentmods.dev/badge/skills/shinnytech/tqsdk-python/tqsdk-trading-and-data.svg" alt="Measured on agentmods" height="20"></a>
Per session 286 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,968 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00286 $0.01968
Opus 5 $0.00143 $0.00984
Sonnet 5 $0.00057 $0.00394
Haiku 4.5 $0.00029 $0.00197

Measured 7d ago against content hash 5c579b9c4ce0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

tqsdk-trading-and-data scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

doc/ai_editor/skills/tqsdk-trading-and-data/SKILL.md · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TqSdk Trading and Data

Use this skill to answer TqSdk questions with the repository's real APIs, docs, and examples. Prefer minimal runnable snippets, keep futures and stock behavior separate, and explain the update loop explicitly whenever the user's issue depends on wait_update().

Route The Request First

Read only the references needed for the user's question.

  1. Read references/wait-update-and-update-loop.md for wait_update, is_changing, deadline, async update notifications, Jupyter caveats, or backtest progression questions.
  2. Read references/market-data.md for get_quote, get_kline_serial, get_tick_serial, contract discovery, symbol metadata, and DataDownloader.
  3. Read references/account-type-matrix.md for TqAccount, TqKq, TqKqStock, TqSim, TqSimStock, TqTradingUnit, OTG account classes, and TqMultiAccount.
  4. Read references/accounts-and-trading.md for account, position, order, and trade getters plus multi-account getter patterns.
  5. Read references/scenario-and-margin.md for TqScenario, real-account margin-rate lookup, margin occupancy calculation, risk-ratio what-if analysis, and limited built-in margin discount rules.
  6. Read references/order-functions-and-position-tools.md for insert_order, cancel_order, TargetPosTask, support_open_min_volume, TargetPosScheduler, Twap, and advanced execution helpers.
  7. Read references/object-fields.md when the user asks what fields mean on Quote, K-line or tick rows, Account, Position, Order, Trade, or their stock variants.
  8. Read references/simulation-and-backtest.md for local sim, Quick sim, stock sim, backtest, and cross-account backtest limits.
  9. Read references/error-faq.md when the user asks about common TqSdk failures, confusing behavior, or exception messages.
  10. Read references/example-map.md when you want a repository-backed example or doc page to imitate.

Read the full file on GitHub · 69 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 69 lines · 286 tokens per session scan A 5c579b9c4ce0

Subscribe to this mod's changes

tqsdk-trading-and-data is a skill published in the GitHub repository shinnytech/tqsdk-python (4,998 stars, last pushed 19d ago), licensed Apache-2.0. It adds 286 tokens to every session and 1,968 once invoked, about $0.0014 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

vnpy-export

Export a Vibe-Trading backtest strategy to a runnable vnpy CtaTemplate Python class — supports A-share equities, futures, and crypto via BarGenerator + ArrayManager.

HKUDS/Vibe-Trading · 40 tokens

yfinance

Skill "yfinance" from HKUDS/Vibe-Trading, covering yfinance, deep yahoo interfaces (references/), quick start, ticker format conversion and supported data types.

HKUDS/Vibe-Trading · 41 tokens

miniqmt-to-bigqmt

将基于 miniQMT 的外部 xtquant 库(xttrader/xtdata)的 Python 量化策略,转换为大QMT内置Python(ContextInfo/passorder 体系)可实盘运行的策略。当用户要求转换 miniQMT 策略、迁移 xtquant 代码到大QMT、或提到"内置Python/XTData/passorder 改写"时使用。包含可行性评估、API 映射、py3.6+GBK 约束校验、部署与实盘验证全流程;不可转换场景给出文件桥等替代方案。.

litaolemo/xtquant_big_convert · 144 tokens

python-workspace

Python workspace for MQL5 integration. TRIGGERS - MetaTrader 5 Python, mt5 package, MQL5-Python setup.

terrylica/cc-skills · 34 tokens

tushare

Skill "tushare" from skloxo/TideTrading, covering tushare, 概述, 快速上手, 读取环境变量中的token, 或者读取本地记录的token and 初始化pro接口实例.

skloxo/TideTrading · 79 tokens

yfinance

Skill "yfinance" from skloxo/TideTrading, covering yfinance, deep yahoo interfaces (references/), quick start, ticker format conversion and supported data types.

skloxo/TideTrading · 46 tokens