Tqsdk Trading And Data logo

Tqsdk Trading And Data

OrganizationPopular
shinnytech
tqsdk-trading-and-data

Explain, implement, or debug TqSdk Python workflows for wait_update or is_changing update loops, market data retrieval, historical download, account type selection, funds or positions or orders or trades, field meanings, order placement or cancellation, target-position tools, TqScenario margin trials, real-account margin-rate lookup, margin or risk-ratio what-if analysis, simulation, backtest, multi-strategy, and common TqSdk errors. Use when a request mentions TqSdk, TqApi, TqAuth, TqAccount, TqKq, TqKqStock, TqSim, TqSimStock, TqMultiAccount, TqTradingUnit, TqBacktest, TqScenario, TargetPosTask, TargetPosScheduler, Twap, DataDownloader, margin rate, margin calculation, risk ratio, scenario trial, market data, K-line, tick, historical data, positions, trades, orders, account data, order placement, cancellation, position adjustment, field meanings, wait_update, debugging, 行情, K线, 历史数据, 保证金率, 保证金, 风险度, 场景试算, 持仓, 成交, 委托, 账户, 下单, 撤单, 调仓, 多策略, 字段含义, or 报错.

Overview

Publishershinnytech
Repositorytqsdk-python
Skill nametqsdk-trading-and-data
Stars
5K
Forks
781
Bundled files
11
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 11 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by shinnytech on GitHub. Read the source before you install it.

Installation

Install the Tqsdk Trading And Data AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/shinnytech/tqsdk-python.git /tmp/tqsdk-python
mkdir -p .claude/skills
cp -r /tmp/tqsdk-python/doc/ai_editor/skills/tqsdk-trading-and-data .claude/skills/tqsdk-trading-and-data
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Tqsdk Trading And Data in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Tqsdk Trading And Data on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Tqsdk Trading And Data is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Before Writing Code

  1. Identify the task mode first: market data only, local sim, Quick sim, real account, stock trading, futures trading, backtest, or margin trial.
  2. If an example needs a current futures or option contract, verify it with query_quotes(..., expired=False), query_options(..., expired=False), or a main-contract symbol before using it.
  3. Prefer main-contract symbols such as KQ.m@SHFE.rb for market-data and historical-download examples when the user does not need a tradable delivery month.
  4. Use a concrete non-expired delivery-month contract for order, position, TargetPosTask, and margin examples.
  5. Do not expose real account names, passwords, tokens, or customer credentials. Use placeholders or environment variables.
  6. When writing or changing code, run the smallest practical verification, such as import checks, syntax checks, a short quote subscription, or a narrow backtest.

Core Rules

  1. Treat get_* results as live references, not snapshots. Explain that they refresh during wait_update().
  2. Explain wait_update() whenever the user is confused by missing data, stale fields, orders not leaving the client, or TargetPosTask not acting.
  3. Distinguish futures and stock workflows:
    • Futures accounts and objects use Account, Position, Order, Trade.
    • Stock accounts and objects use SecurityAccount, SecurityPosition, SecurityOrder, SecurityTrade.
    • Stock trading does not use offset, and TargetPosTask is not for stock trading.
  4. Choose account type before writing code. Do not default to TqKq or TqAccount unless the user really needs that account mode.
  5. In multi-account mode, pass account= for getters and trading calls, or use the account object's own get_account, get_position, get_order, and get_trade.
  6. For current market examples, avoid expired contracts. Prefer contract discovery APIs or main-contract symbols.
  7. When the user asks for field meanings, explain the smallest relevant field set first and say whether the object is futures or stock.
  8. When the user asks for long historical ranges, prefer DataDownloader over pretending get_kline_serial is an unlimited history API.
  9. When the user asks for advanced execution, prefer public helpers first:
    • TargetPosTask for target net position.
    • TargetPosTask(..., support_open_min_volume=True) only for contracts with exchange minimum opening size rules when approximate completion is acceptable.
    • TargetPosScheduler plus twap_table or vwap_table from tqsdk.algorithm for scheduled execution.
    • TargetPosScheduler(..., support_open_min_volume=True) when the scheduled execution targets a contract with exchange minimum opening size rules.
    • Direct tqsdk.algorithm.Twap(..., support_open_min_volume=True) only when the user asks for the older/direct TWAP helper; note that it is not for backtest.
    • Mention InsertOrderTask and InsertOrderUntilAllTradedTask as internal or advanced helpers, not the default answer.
  10. Use TqScenario for synchronous what-if margin and risk trials, not for live order placement. It is futures-only, single-account, and updates the trial snapshot immediately after each call.
  11. Explain the margin-rate source in every TqScenario answer:
  • account=None or TqSim() uses Quote margin data.
  • TqAccount(...) or TqKq() queries account-specific rates synchronously and may fall back to Quote margin if lookup fails.
  1. Treat margin discounts conservatively. Reuse one TqScenario object for step-by-step trial actions, and do not promise broker-specific preferential rules beyond the limited built-in rules modeled by TqSdk.
  2. Preserve exchange-specific close semantics in TqScenario. For SHFE or INE futures, keep CLOSE versus CLOSETODAY consistent with the imported position snapshot.

Answering Style

  • Prefer imports from tqsdk.__init__ for top-level APIs. When an API is documented under a submodule, use that official submodule path such as tqsdk.tools or tqsdk.algorithm.
  • Prefer short, correct code blocks over broad pseudo-code.
  • Name the exact API the user should call next.
  • If behavior differs in live trading, Quick sim, local sim, stock sim, or backtest, say so explicitly.
  • If the answer depends on a common pitfall, state the pitfall directly instead of burying it in examples.
  • If the answer uses TqScenario, say what snapshot goes into positions, what balance goes into init_balance, and whether the result comes from quote margin or account-specific margin rates.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Tqsdk Trading And Data AI skill do?

Explain, implement, or debug TqSdk Python workflows for wait_update or is_changing update loops, market data retrieval, historical download, account type selection, funds or positions or orders or trades, field meanings, order placement or cancellation, target-position tools, TqScenario margin trials, real-account margin-rate lookup, margin or risk-ratio what-if analysis, simulation, backtest, multi-strategy, and common TqSdk errors. Use when a request mentions TqSdk, TqApi, TqAuth, TqAccount, TqKq, TqKqStock, TqSim, TqSimStock, TqMultiAccount, TqTradingUnit, TqBacktest, TqScenario, TargetP...

Why use Tqsdk Trading And Data on TypingMind?

Because you install it once and use it with any model. Tqsdk Trading And Data is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Tqsdk Trading And Data in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/shinnytech/tqsdk-python/tree/master/doc/ai_editor/skills/tqsdk-trading-and-data. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Tqsdk Trading And Data?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Tqsdk Trading And Data?

As many as you like. As long as a model supports skills, you can use Tqsdk Trading And Data with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Tqsdk Trading And Data AI skill free?

Yes. It is published on GitHub by shinnytech under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇