Tqsdk Trading And Data 标志

Tqsdk Trading And Data

组织热门
shinnytech
tqsdk-trading-and-data

讲解、实现或调试 TqSdk Python 工作流,涵盖 wait_update 或 is_changing 更新循环、行情数据获取、历史数据下载、账户类型选择、资金、持仓、委托或成交查询、字段含义、下单或撤单、目标持仓工具、TqScenario 保证金试算、实盘账户保证金率查询、保证金或风险度假设分析、模拟、回测、多策略以及常见 TqSdk 错误。适用于请求中提到 TqSdk、TqApi、TqAuth、TqAccount、TqKq、TqKqStock、TqSim、TqSimStock、TqMultiAccount、TqTradingUnit、TqBacktest、TqScenario、TargetPosTask、TargetPosScheduler、Twap、DataDownloader、保证金率、保证金计算、风险度、场景试算、行情数据、K 线、tick、历史数据、持仓、成交、委托、账户数据、下单、撤单、调仓、字段含义、wait_update、调试、行情、K线、历史数据、保证金率、保证金、风险度、场景试算、持仓、成交、委托、账户、下单、撤单、调仓、多策略、字段含义或报错的情况。

概览

发布者shinnytech
代码仓库tqsdk-python
技能名称tqsdk-trading-and-data
星标数
5K
复刻数
781
附带文件
11
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 11 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 shinnytech 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Tqsdk Trading And Data AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/shinnytech/tqsdk-python/tree/master/doc/ai_editor/skills/tqsdk-trading-and-data
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

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
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Tqsdk Trading And Data,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Tqsdk Trading And Data。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Tqsdk Trading And Data 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

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.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Tqsdk Trading And Data AI 技能有什么作用?

讲解、实现或调试 TqSdk Python 工作流,涵盖 wait_update 或 is_changing 更新循环、行情数据获取、历史数据下载、账户类型选择、资金、持仓、委托或成交查询、字段含义、下单或撤单、目标持仓工具、TqScenario 保证金试算、实盘账户保证金率查询、保证金或风险度假设分析、模拟、回测、多策略以及常见 TqSdk 错误。适用于请求中提到 TqSdk、TqApi、TqAuth、TqAccount、TqKq、TqKqStock、TqSim、TqSimStock、TqMultiAccount、TqTradingUnit、TqBacktest、TqScenario、TargetPosTask、TargetPosScheduler、Twap、DataDownloader、保证金率、保证金计算、风险度、场景试算、行情数据、K 线、tick、历史数据、持仓、成交、委托、账户数据、下单、撤单、调仓、字段含义、wait_update、调试、行情、K线、历史数据、保证金率、保证金、风险度、场景试算、持仓、成交、委托、账户、下单、撤单、调仓、多策略、字段含义或报错的情况。

为什么在 TypingMind 中使用 Tqsdk Trading And Data?

因为您只需安装一次,就能搭配任何模型使用。Tqsdk Trading And Data 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Tqsdk Trading And Data?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/shinnytech/tqsdk-python/tree/master/doc/ai_editor/skills/tqsdk-trading-and-data。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Tqsdk Trading And Data?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Tqsdk Trading And Data 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Tqsdk Trading And Data 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Tqsdk Trading And Data AI 技能免费吗?

是的。shinnytech 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇