HimanshuJ16 3901419499 feat: add transfer pricing engine for multi-entity trading operations
- Implemented a new Python module for calculating intercompany pricing and profit splits based on OECD guidelines.
- Introduced classes for legal entities, intercompany transactions, DEMPE contributions, and transfer pricing settlements.
- Added methods for various transfer pricing methodologies including Cost Plus, CUP, TNMM, and Profit Split.
- Enhanced error handling for transfer pricing calculations and validations.
- Updated related documentation to reflect the new skill name for transfer pricing considerations.
2026-09-03 14:57:12 +05:30

Algo-Trading-Skills banner

Algo-Trading-Skills

The largest open-source algorithmic trading skills library for AI agents

License Validate & Test Skills Skills Built Tests Roadmap Domains Platforms agentskills.io PRs Welcome

504 production-grade algorithmic trading skills · 16 engineering domains · 5 regulatory & exchange frameworks · 504 working reference implementations backed by 20,302 unit tests · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI & 26+ platforms · 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 504 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 504 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:

Skill Primary Regulatory / Exchange Standard Broker / Platform Touchpoints Operational Safety Target
order-placement-idempotency SEC Rule 15c3-5 / MiFID II RTS 6 Fyers, Zerodha, Breeze, Upstox, Alpaca, IBKR Zero duplicate executions on reconnection
kill-switch-and-drawdown-circuit-breakers SEC Rule 15c3-5 (Pre-Trade Controls) Universal / Broker-Agnostic Instant capital protection on drawdown breach
wash-trade-and-spoofing-self-detection EU MAR / FINRA Rule 5210 Exchange Order Feeds Pre-trade self-cross prevention & cancellation audit
us-reg-sho-short-sale-locate-requirements US SEC Reg SHO Rule 203(b)(1) US Equity Brokers / Prime Brokers Mandatory pre-short locate verification & buy-in tracking
withdrawal-velocity-limits-and-anomaly-detection MAS Cyber Hygiene / Custody Risk Coinbase, Fireblocks, BitGo, HSM Automated hot wallet freeze on velocity breach

Quick start

# Option 1: Install directly with skills CLI (recommended)
npx skills add HimanshuJ16/Algo-Trading-Skills

# Option 2: Git clone
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 (504/504 pass)
python tools/run_all_tests.py      # 20,302 unit tests across 504 skills (~60-85s)

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.


Why this exists

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 turns generic code into institutional-grade trading systems.

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 "production-grade" 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, so the claims stay true or the build goes red.

504 working reference implementations ~292,000 lines of Python under skills/*/scripts/. Not pseudocode — importable modules with validated inputs and named exceptions. 465 of the 504 import nothing outside the Python standard library; the 39 that do reach mostly for numpy or pandas, and the uncommon dependencies are guarded imports, so the whole suite still runs on requirements-dev.txt alone.
504 unit test suites · 20,302 tests ~228,000 lines of tests, whole suite in ~60-85 seconds. A skill whose own reference implementation fails its own tests fails the build.
A machine-enforced contract tools/validate_skills.py checks frontmatter fields and semver, the seven required body sections, every Related Skills cross-reference against a real directory, the scripts/ layout, and that every test command quoted anywhere in a skill's Markdown actually runs from the repository root.
Verification you can paste All 504 skills quote a runnable command in their ## Verification section, alongside the concrete assertions to check by hand.
Sourced, or explicitly unsourced 461 of 504 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.

The CI workflow is .github/workflows/validate-skills.yml: validate, then run all 504 suites, on every push and PR to main.


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 Built Total Tracked Key capabilities
broker-integration 36 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 31 Producer-consumer tick pipelines, burst-safe buffering, explicit backpressure policy, WebSocket reconnection without duplicate subscriptions
backtesting-methodology 31 31 Lookahead bias elimination, walk-forward validation, realistic slippage/fee/latency simulation, synthetic data generation, standardized tearsheets
financial-ml 38 38 Leakage-free feature engineering, offline-train/online-infer deployment, triple barrier labeler, sample weighting, model staleness detection
risk-management 39 39 Kill switches and drawdown circuit breakers, correlation-aware exposure limits, Kupiec test VaR backtesting, tail risk hedging, risk escalation matrices
deployment-ops 30 30 systemd process supervision, paper-to-live promotion checklist, IaC for trading hosts, canary releases, chaos engineering, secrets vault
global-market-integration 44 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 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 28 SPAN margin calculation, futures contract roll automation, real-time Greeks aggregation, perpetual futures funding rates, variance swaps, CDS, quanto options
execution-algorithms 33 33 TWAP/VWAP order slicing, POV execution, implementation shortfall minimization, iceberg detection, smart order routing (SOR), dark pool routing, auctions
data-management-global 37 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 29 Wallet key custody, hot-cold split, withdrawal whitelisting, multi-sig approval, HSM integration, Shamir secret sharing, MPC custody
portfolio-multi-strategy 30 30 Cross-strategy correlation monitoring, performance-based capital reallocation, strategy retirement criteria, risk parity allocation, meta-strategy signal arbitration
market-microstructure-latency 24 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 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 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 indexed list with build status: index.json. Full 504-entry roadmap with one-line scope for every skill: docs/ROADMAP_500.md.


How AI agents use these skills

The full library is roughly 1.4 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 for all 504 skills, queryable without touching a single skill file ~90 tokens per skill
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

Because index.json is a flat JSON array, an agent narrows 504 candidates to a handful with a grep or a filter 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 504 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.


Skill anatomy

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
domain: algorithmic-trading
subdomain: broker-integration
tags:
- broker-integration
- fyers-api-v3
- zerodha-kite-connect
- icici-breeze-api
brokers_frameworks:
- Fyers API v3
- Zerodha Kite Connect
- ICICI Breeze API
- Upstox API v2
- Alpaca Trading API
- IBKR API
version: "2.0.0"
author: algo-trading-skills-contributors
license: Apache-2.0
---

Markdown body sections

## 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:

Platform / Agent Zero-Config Rule File Auto-Discovery Standard
Claude Code CLAUDE.md / .claude/config.json Anthropic Claude Code project convention
OpenAI Codex CLI / OpenHands AGENTS.md Open cross-tool agent instruction format
Gemini CLI GEMINI.md Google Gemini CLI project instructions
GitHub Copilot .github/copilot-instructions.md GitHub Copilot repo-level rules
Cursor .cursor/rules/algo-trading-skills.mdc Cursor MDC rule format
Cline / Roo Code .clinerules Cline / Roo Code system rule
Windsurf .windsurfrules Windsurf rule configuration
Continue .continue/rules/algo-trading-skills.md Continue dev auto-discovery rule
Aider CONVENTIONS.md / .aider.conf.yml Aider project conventions

AI code assistants

Claude Code (Anthropic) · GitHub Copilot (Microsoft) · Cursor · Windsurf · Cline · Aider · Continue · Roo Code · Amazon Q Developer · Tabnine · Sourcegraph Cody · JetBrains AI

CLI agents

OpenAI Codex CLI · Gemini CLI (Google)

Autonomous agents

Devin · Replit Agent · SWE-agent · OpenHands

Agent frameworks & SDKs

LangChain · CrewAI · AutoGen · Semantic Kernel · Haystack · Vercel AI SDK · Any MCP-compatible agent

All platforms that support the agentskills.io standard load these skills with zero configuration.


🏃 Runnable Examples & Cookbook

To see how skills chain together in institutional production 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 Status
v1.0.0 504 skills · 16 domains · 504 reference implementations · 504 unit test suites · tools/validate_skills.py + tools/run_all_tests.py CI-enforced 504/504 skills validated · 20,302/20,302 tests passing

Contributing

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 both gates locally — CI runs exactly these two commands:

python tools/validate_skills.py
python tools/run_all_tests.py

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.


Citation

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         = {504 structured algorithmic trading skills for AI agents,
                  mapped to SEC Rule 15c3-5, Reg NMS, MiFID II, FCA, SEBI, and ISDA standards}
}

License

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.


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.

S
Description
500+ algorithmic-trading skills for AI coding agents in the agentskills.io format. Every skill ships a working Python reference implementation and its own tests - 20,291 in CI. Broker APIs, backtesting, risk, execution, ML, compliance and 10 more domains. Apache-2.0
https://skills.himanshujangir.com Readme Apache-2.0 Cite this repository
20 MiB
Languages
Python 99%
TypeScript 0.9%
CSS 0.1%