```Show HN: Algo-Trading-Skills - 交易基础设施的 501 项智能体技能```
Show HN: Algo-Trading-Skills - 501 agent skills for trading infrastructure

原始链接: https://github.com/HimanshuJ16/Algo-Trading-Skills

**Algo-Trading-Skills** 是一个开源库,包含 501 个标准化的工程“技能”,旨在赋予 AI 编码智能体资深量化工程师的操作直觉。它弥合了功能性代码与生产级交易基础设施之间的鸿沟。 与通用库不同,该项目为复杂任务提供了结构化的操作指南,例如 WebSocket 稳定性、订单幂等性和风险管理——这些往往是在真实市场中导致灾难性故障的关键因素。每项技能均遵循 `agentskills.io` 标准,具有以下特点: * **16 个工程领域:** 涵盖从经纪商集成、执行算法到市场微观结构和税务核算的所有内容。 * **监管合规:** 直接映射至包括 SEC Rule 15c3-5、MiFID II、FCA 和 ISDA 在内的全球监管框架。 * **验证可靠性:** 拥有 20,291 个单元测试和 501 个参考实现,均通过持续集成 (CI) 验证。 * **AI 智能体优化:** 专为 Claude Code、Cursor 和 GitHub Copilot 等 AI 工具设计。该库采用渐进式披露原则,允许智能体仅加载所需的特定领域或技能,以节省上下文空间。 **警告:** 本内容仅供工程指导参考,不构成任何财务或法律建议。旨在部署于严格受控的环境中,以防止资本损失。 探索该存储库,为您的智能体配备生产级的量化基础设施。

抱歉。
相关文章

原文

Algo-Trading-Skills banner

An open-source algorithmic trading skills library for AI agents

License Validate & Test Skills Skills Tests Domains Python agentskills.io PRs Welcome

501 algorithmic trading skills · 16 engineering domains · 5 regulatory & exchange frameworks · 501 working reference implementations backed by 20,291 unit tests · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI and any tool that reads SKILL.md · Apache 2.0

Get Started · What's Inside · How It's Verified · Frameworks & Standards · Platforms · Contributing


⚠️ Community Project — This is an independent, community-created project. Not affiliated with Anthropic PBC or any broker, exchange, or vendor referenced in this repository.

📈 Engineering Guidance, Not Financial, Legal, or Compliance Advice — Authorized & lawful use only. These skills encode production engineering practices for trading infrastructure. They do not constitute financial, legal, tax, or regulatory compliance advice, do not guarantee strategy profitability, and do not eliminate the risk of capital loss in live trading. Only deploy against paper accounts or live environments where risk limits are strictly enforced. Consult qualified legal, tax, and compliance professionals in your jurisdiction before deploying live trading systems. See SECURITY.md and CODE_OF_CONDUCT.md.


Give any AI agent the trading-infrastructure instincts of a senior quant engineer

An AI coding agent can write a WebSocket client, a backtest loop, or an order-placement function that looks completely correct — right library calls, clean structure, plausible logic — and still fail catastrophically in production for reasons that have nothing to do with code syntax: a broker invalidates a token overnight in a way its docs don't mention, a backtest silently uses a bar's own close to predict its own direction, a risk limit lives inside the same function it's supposed to constrain, or a WebSocket callback blocks the read loop during exactly the volatility spike a strategy exists to catch.

Your AI agent doesn't know these failure modes — unless you give it these skills.

This repo contains 501 structured skills spanning 16 engineering domains, each following the agentskills.io open standard. The library maps across key financial regulatory & exchange frameworks — SEC Rule 15c3-5, Reg NMS / Reg SHO, FINRA, EU MiFID II / RTS 6 / MAR, UK FCA, ASIC, SEBI, and ISDA OTC derivative standards. Clone it, point your agent at it, and your next trading system deployment gets expert-level quant infrastructure guidance in seconds.

Every skill also states where it stops. A ## When NOT to Use section on all 501 skills names the cases the skill does not cover and hands each one to the skill that does — because an agent applying a correct playbook to the wrong problem is its own failure mode, and it is the one a keyword match is most likely to cause.


Five regulatory & exchange frameworks, one skill library

Each skill maps to the industry standards, exchange protocols, and regulatory mandates that fit its subject:

Framework / Standard Scope What It Maps Key Mapped Skills
US SEC / FINRA SEC Rule 15c3-5, Reg NMS Rule 611, Reg SHO, PDT Rule 4210, Form 1099-B Pre-trade risk controls, order protection, short sale locates, pattern day trading, tax lot reconciliation us-reg-nms-order-protection-rule-compliance, us-reg-sho-short-sale-locate-requirements, sec-rule-15c3-5-risk-controls-us, wash-sale-rule-tracking-us
EU MiFID II / RTS 6 / MAR MiFID II Article 48, RTS 6 organizational requirements, MAR market abuse surveillance System resilience, kill switches, OTR limits, wash trade & spoofing self-detection, double volume caps mifid-ii-algo-trading-compliance-eu, wash-trade-and-spoofing-self-detection, eu-market-abuse-regulation-mar-surveillance
UK FCA & Senior Managers Regime FCA SYSC 25, MIFIDPRU, Senior Managers & Certification Regime (SM&CR) Algorithmic trading system controls, algorithmic accountability, key person governance uk-fca-algorithmic-trading-systems-controls, uk-senior-managers-regime-algo-accountability
Global Regulatory (ASIC, SEBI, MAS, IIROC) ASIC MIR, SEBI Algo Circulars, MAS Cyber Hygiene, IIROC Electronic Trading Regional exchange order tagging, circuit breakers, risk-gate dependencies, kill switches asic-market-integrity-rules-automated-trading, india-sebi-algo-trading-tagging-requirements, mas-singapore-algo-trading-guidelines
ISDA & OTC Derivatives ISDA Master Agreement, SPAN Margin, Options Greeks, Variance Swaps Collateral management, cross-margining, delta hedging, synthetic TRS exposure, volatility derivatives options-margin-span-calculation-global, total-return-swap-synthetic-exposure, variance-swap-and-volatility-derivative-pricing

Example — Each skill maps directly to regulatory mandates, broker APIs, and institutional standards:


# Option 1: Claude Code — install one domain, not the whole library
/plugin marketplace add HimanshuJ16/Algo-Trading-Skills
/plugin install algo-trading-risk-management
/plugin install algo-trading-broker-integration

# Option 2: skills CLI — pick the skills you want interactively
npx skills add HimanshuJ16/Algo-Trading-Skills

# Option 3: git clone, then run the gates yourself
git clone https://github.com/HimanshuJ16/Algo-Trading-Skills.git
cd Algo-Trading-Skills
pip install -r requirements-dev.txt

python tools/validate_skills.py    # structure, frontmatter, cross-references & packaging
python tools/run_all_tests.py      # every skill's unit test suite, isolated per subprocess

Install one domain, not all of them. Claude Code loads the name and description of every skill in an installed plugin into the model's context at the start of every session. The marketplace therefore ships one plugin per engineering domain (algo-trading-risk-management, algo-trading-execution-algorithms, …), each a few thousand tokens. An algo-trading-skills-all plugin exists for completeness, but it costs tens of thousands of tokens per session — reach for it only if you know you want that. One caveat on disk rather than context: every plugin entry points at the repository root, so installing a single domain checks out the whole tree (about 100 MB); only that domain's skills are loaded into the session.

Run one skill's suite on its own — the same command every skill quotes in its own Verification section:

python -m unittest discover -s skills/order-placement-idempotency/scripts

Works immediately with Claude Code, GitHub Copilot, OpenAI Codex CLI, Cursor, Gemini CLI, and any agentskills.io-compatible platform.


The quantitative trading and financial software engineering domain requires deep practitioner knowledge across market microstructure, exchange protocols, and risk engineering. AI agents can help build and scale trading infrastructure — but only if they have structured practitioner playbooks to work from. Today's generic LLMs can write Python code and API wrappers, but they lack the operational context that separates code which works in a notebook from code that survives a live market.

Existing trading libraries give you broker SDKs, indicator formulas, or naive strategy backtests. None of them give an AI agent the structured decision-making workflow a senior quant infrastructure engineer follows: when to use each technique, when not to, what prerequisites to check, how to execute step-by-step, and how to verify results in production. That is the gap this project fills.

Algo-Trading-Skills is not a collection of toy scripts. It is an AI-native knowledge base built from the ground up for the agentskills.io standard — YAML frontmatter for sub-second discovery, structured Markdown for step-by-step execution, and reference files for deep technical context. Every skill encodes real practitioner workflows, not generic LLM summaries.


What "verified" means here

Skill libraries are easy to generate and hard to trust. Everything in this table is re-checked by CI on every push and pull request, on Python 3.10, 3.12 and 3.13, so the claims stay true or the build goes red.

501 working reference implementations ~292,000 lines of Python under skills/*/scripts/. Not pseudocode — importable modules that validate their inputs and raise on bad data; about half define their own exception classes, the rest raise the builtins. 466 of the 501 import nothing outside the Python standard library; the 35 that do reach mostly for numpy or pandas, so the whole suite still runs on requirements-dev.txt alone.
501 unit test suites · 20,291 tests ~228,000 lines of tests. Each suite runs in its own subprocess with a timeout, so no skill can leak module state into another or hang the build. A skill whose own reference implementation fails its own tests fails the build.
A machine-enforced contract tools/validate_skills.py checks the frontmatter contract, the seven required body sections, scripts/ layout, every skill cross-reference in both skills and repo docs, that every documented test command runs from the repository root, and that the plugin manifests cover every skill exactly once.
The specification, not our reading of it CI also runs skills-ref, the official agentskills.io reference validator, against every skill. It needs Python 3.11+, so that job runs on the newer interpreters while the library itself stays 3.10-compatible.
Descriptions that say when to trigger Every description starts with "Use when …" and fits in 280 characters — enforced, because it is the only thing an agent reads before choosing a skill, and it costs context on every session.
Generated files can't drift index.json and the plugin marketplace are generated and carry no timestamp; --check modes fail CI if either is stale.
Verification you can paste Every skill quotes a runnable command in its ## Verification section, alongside the concrete assertions to check by hand.
Sourced, or explicitly unsourced 458 of 501 references/standards.md cite at least one primary source — the rule text, the exchange notice, the vendor spec. Where no external standard exists, the file says so and labels its numbers as configurable defaults rather than inventing an authority for them.
Stated scope boundaries ## When NOT to Use on every skill, naming the excluded cases and handing each to the skill that owns it.
Examples that use the real code The three walkthroughs in examples/ import the actual skill helpers rather than re-implementing them, and CI runs all three.

The CI workflow is .github/workflows/validate-skills.yml.


What's inside — 16 categories

The library covers 16 core engineering domains spanning domestic and global markets — crypto exchanges, forex brokers, multi-currency and multi-timezone data handling, regulatory compliance, multi-asset derivatives, execution algorithms, custody/security, cross-strategy portfolio management, market microstructure, alternative-data research, and tax/accounting.

Domain Skills Key capabilities
broker-integration 36 Headless auth (REST + Selenium), token lifecycle via live probing, order idempotency, per-broker rate limiting, borrow cost modeling, cost budgeting
real-time-architecture 31 Producer-consumer tick pipelines, burst-safe buffering, explicit backpressure policy, WebSocket subscription reconciliation after a reconnect
backtesting-methodology 31 Lookahead bias elimination, walk-forward validation, realistic slippage/fee/latency simulation, synthetic data generation, standardized tearsheets
financial-ml 38 Leakage-free feature engineering, offline-train/online-infer deployment, triple barrier labeler, sample weighting, model staleness detection
risk-management 39 Kill switches and drawdown circuit breakers, correlation-aware exposure limits, Kupiec test VaR backtesting, tail risk hedging, risk escalation matrices
deployment-ops 30 systemd process supervision, paper-to-live promotion checklist, IaC for trading hosts, canary releases, chaos engineering, secrets vault
global-market-integration 44 Crypto exchange APIs (Binance/Coinbase/Kraken/Deribit/Bybit/OKX), FX (OANDA/MT5), CME Globex, Eurex, HKEX, SGX, ASX, JPX, CBOE, LSE, Xetra
regulatory-compliance-global 38 US SEC Rule 15c3-5, PDT, FINRA, EU MiFID II/RTS 6/MAR, UK FCA, ASIC, MAS, India SEBI, Canada IIROC, Hong Kong SFC, Japan FSA
multi-asset-derivatives 28 SPAN margin calculation, futures contract roll automation, real-time Greeks aggregation, perpetual futures funding rates, variance swaps, CDS, quanto options
execution-algorithms 32 TWAP/VWAP order slicing, POV execution, implementation shortfall minimization, iceberg detection, smart order routing (SOR), dark pool routing, auctions
data-management-global 37 Global exchange holiday calendars, DST transition handling, multi-timezone session scheduling, multi-currency P&L, ISIN/CUSIP/SEDOL cross-referencing
crypto-custody-security 29 Wallet key custody, hot-cold split, withdrawal whitelisting, multi-sig approval, HSM integration, Shamir secret sharing, MPC custody
portfolio-multi-strategy 28 Cross-strategy correlation monitoring, performance-based capital reallocation, strategy retirement criteria, risk parity allocation, meta-strategy signal arbitration
market-microstructure-latency 24 Colocation latency budgets, PTP clock sync, tick-to-trade measurement, order book signals, adverse selection measurement, FPGA/microwave evaluation
quant-research-alt-data 20 Satellite imagery signals, credit card transaction data, web-scraped sentiment, supply chain networks, Google Trends, social media bot filtering, transcript NLP
tax-accounting-reporting-global 16 US wash sale tracking, FIFO vs specific-lot accounting, Section 475 MTM election, crypto tax lot tracking, 1099-B reconciliation, Section 1256 futures tax

Full searchable index: index.json. Every skill listed by domain with its trigger description: docs/ROADMAP_500.md.


How AI agents use these skills

The full library is roughly 3.5 million tokens of Markdown — far past any context window. Progressive disclosure is what makes it usable: an agent searches short descriptions to find the right skill, then loads only that one.

Stage What the agent reads Cost
Discover index.json — name, description, domain and tags for every skill, queryable without touching a single skill file ~250 tokens per skill as shipped (~80 for a name+description projection)
Load The one matching SKILL.md — workflow, scope boundaries, pitfalls, verification ~2,000-3,700 tokens (median ~2,700)
Go deeper references/ and scripts/ for that skill only, once it is actually implementing on demand

index.json is a single JSON object with a skills array and a subdomains count map, so an agent can filter by domain or grep descriptions and narrow the whole library to a handful of candidates before loading anything.

User prompt: "My Fyers bot's live orders keep getting placed twice after a timeout"

Agent's internal process:

  1. Queries index.json descriptions for all 501 skills
     → identifies order-placement-idempotency and token-lifecycle-live-probing as top matches.

  2. Loads top match: skills/order-placement-idempotency/SKILL.md
     → checks When NOT to Use first — this is order placement, not a cancel-request race,
       so the skill applies.
     → follows the structured Workflow section: classify timeout as ambiguous (not failed),
       reconcile against broker order book before any retry.

  3. Loads references/workflows.md for full sequence diagrams and
     scripts/order_ledger.py for working helper logic.

  4. Validates results using the Verification section
     → runs `python -m unittest discover -s skills/order-placement-idempotency/scripts`
     → confirms a simulated network timeout no longer produces duplicate executions.

Without these skills, the agent guesses at retry logic and doubles order risk. With them, it follows the exact playbook a senior trading engineer would use.


Every skill follows a consistent directory structure:

skills/order-placement-idempotency/
├── SKILL.md                  ← Skill definition (YAML frontmatter + Markdown body)
├── references/
│   ├── standards.md          ← Broker/framework coverage + regulatory touchpoints
│   └── workflows.md          ← Deep technical procedure reference
├── scripts/
│   ├── order_ledger.py       ← Working reference implementation
│   └── test_order_ledger.py  ← Its unittest suite
└── assets/
    └── checklist.md          ← Printable sign-off checklist

Each helper is a standalone module — no imports from other skills, no shared package — so you can lift one file out of the repo and into your own codebase without dragging the library along.

YAML frontmatter (real example)

---
name: order-placement-idempotency
description: >-
  Use whenever a bot places, modifies, or cancels live orders and must guarantee it
  never double-executes an order due to retries, timeouts, or reconnects
license: Apache-2.0
metadata:
  domain: algorithmic-trading
  subdomain: broker-integration
  tags: broker-integration, idempotency, client-order-id, order-ledger, retry-safety
  brokers_frameworks: Fyers API v3; Zerodha Kite Connect; Upstox API v2; IBKR API
  version: "2.0.0"
  author: algo-trading-skills-contributors
---

The agentskills.io specification allows six top-level fields, so everything this repository adds lives under metadata: as string values. Two rules on description do the heavy lifting for discovery: it starts with "Use when …" (the situation an agent is in, not a description of the subject), and it fits in 280 characters, because every installed skill's description is loaded into context on every session. Both are enforced by tools/validate_skills.py, alongside the official agentskills validate.

## When to Use          Trigger conditions — when should an AI agent activate this skill?
## When NOT to Use      Scope boundaries — each excluded case handed to the skill that owns it.
## Prerequisites        Required tools, access, and environment setup.
## Workflow             Step-by-step execution guide with specific decision points.
## Common Pitfalls      Named, specific failure modes this skill prevents.
## Verification         How to confirm the skill was executed successfully, with a runnable command.
## Related Skills       Cross-links to other skills in this repo.

All seven sections are required. tools/validate_skills.py enforces them in CI, along with the scripts/ layout and the runnability of every documented test command — see docs/skill-anatomy.md for the contract in prose and .github/workflows/validate-skills.yml for the pipeline.


Compatible platforms & Zero-Config Auto-Discovery

This repository includes native auto-discovery instructions for all major AI coding platforms:

The table above lists the tools this repository ships a rule file for. Beyond those, the skills are plain SKILL.md directories in the agentskills.io format, so any agent or framework that reads that format can load them — point it at skills/ and it has everything it needs.


🏃 Runnable Examples & Cookbook

To see how skills chain together in complete pipelines, explore the runnable walkthroughs in examples/:

Cross-cutting maps live in mappings/broker-api-coverage.md and mappings/regulatory-coverage.md; the system architecture the skills were extracted from is in docs/architecture.md.


🤖 LLM-Crawler Discoverability (llms.txt)

This repository supports machine-discoverable documentation standards for LLMs and AI crawlers:

  • llms.txt — Concise index of core documentation, skill categories, and developer entrypoints.
  • llms-full.txt — Full architecture breakdown and domain mapping for large context windows.

Releases & Build Verification

Version Highlights
v3.0.0 Frontmatter migrated to the agentskills.io specification (repo fields under metadata:), one Claude Code plugin per domain instead of one monolith, descriptions rewritten as "Use when …" triggers capped at 280 characters, duplicate skills merged, and CI extended with skills-ref, a Python version matrix, generated-file drift checks and the cookbook examples. See CHANGELOG.md.
v2.0.0 Reference implementations upgraded across the core broker, risk and real-time skills.
v1.0.0 Initial library across 16 engineering domains, with tools/validate_skills.py and tools/run_all_tests.py enforced in CI.

This project grows through community contributions. Here is how to get involved:

  • Add a new skill — Follow the template and frontmatter structure enforced by tools/validate_skills.py and submit a PR.
  • Improve existing skills — Update workflows, refine code engines, add unit tests, or extend regulatory mappings.
  • Report issues — Found an edge case or missing failure mode? Open an issue.

Before opening a PR, run the gates locally. CI runs these plus the agentskills.io reference validator and the cookbook examples — see CONTRIBUTING.md for the full pipeline:

python tools/validate_skills.py
python tools/run_all_tests.py
python tools/build_index.py --check      # regenerate and commit if this fails
python tools/build_marketplace.py --check
python -m unittest discover -s tests

The quality bar is in CONTRIBUTING.md, and it is a high one: would following this skill have prevented a real production bug, and is its Verification section actually checkable? A regulatory or broker-behaviour claim must be verifiable against an authoritative source — a missing claim is better than a wrong or fabricated one.

Every PR is reviewed for technical accuracy and agentskills.io standard compliance.


If you use this project in research or publications:

@software{algo_trading_skills,
  author       = {Jangir, Himanshu},
  title        = {Algo-Trading-Skills},
  year         = {2026},
  url          = {https://github.com/HimanshuJ16/Algo-Trading-Skills},
  license      = {Apache-2.0},
  note         = {501 structured algorithmic trading skills for AI agents,
                  mapped to SEC Rule 15c3-5, Reg NMS, MiFID II, FCA, SEBI, and ISDA standards}
}

This project is licensed under the Apache License 2.0. You are free to use, modify, and distribute these skills in both personal and commercial projects.


Star history chart for Algo-Trading-Skills

If this project helps your quantitative trading work, consider giving it a ⭐

Star · 🍴 Fork · 💬 Discuss · 📝 Contribute

Community project by @HimanshuJ16. Not affiliated with Anthropic PBC or any broker referenced in this repository.

联系我们 contact @ memedata.com