ptrade-dev

ptrade-dev is a skill for Claude Code, Codex from kay-ou/ClaudeSkills. It costs 126 tokens per session (3,139 once invoked), scanned A, original, MIT.

A coding guide for PTrade and SimTradeLab, platforms used to write and test quantitative trading strategies.

In plain words
What is it for?
Use it when writing, editing, or reviewing PTrade strategies and SimTradeLab backtests.
Why use it?
It helps avoid platform-specific syntax and API mistakes that could make a strategy fail or behave incorrectly.

Skill for Claude CodeCodex

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/kay-ou/claudeskills/ptrade-dev
Any agent
npx skills add kay-ou/ClaudeSkills --skill ptrade-dev
Clone the repo
git clone --depth 1 https://github.com/kay-ou/ClaudeSkills

Made for: Claude Code, 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 ptrade-dev

README.md
[![agentmods](https://agentmods.dev/badge/skills/kay-ou/claudeskills/ptrade-dev.svg)](https://agentmods.dev/skills/kay-ou/claudeskills/ptrade-dev)
Your own site
<a href="https://agentmods.dev/skills/kay-ou/claudeskills/ptrade-dev"><img src="https://agentmods.dev/badge/skills/kay-ou/claudeskills/ptrade-dev.svg" alt="Measured on agentmods" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,139 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 $0.00126 $0.03139
Opus 5 $0.00063 $0.01570
Sonnet 5 $0.00025 $0.00628
Haiku 4.5 $0.00013 $0.00314

Measured 3d ago against content hash b396932247f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ptrade-dev 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 3d 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.

.claude/skills/ptrade-dev/SKILL.md · 305 lines

How it starts

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

PTrade Strategy Development Skill

You are writing code for the PTrade quantitative trading platform or its local simulator SimTradeLab. This skill ensures you NEVER make API errors by providing the complete reference inline.

CRITICAL PLATFORM CONSTRAINTS

These constraints apply to ALL code that runs on PTrade (NOT local-only files like research/run_local_backtest.py):

  1. NO f-strings — Use % formatting or .format(). PTrade's Python does not support f-strings.

    # WRONG
    log.info(f"price: {price}")
    # CORRECT
    log.info("price: %s" % price)
    log.info("price: {}".format(price))
    
  2. NO import io or import sys — These modules are blocked on PTrade.

  3. NO walrus operator := — Not supported.

  4. NO match/case — Not supported.

  5. Code format: PTrade uses .SS (Shanghai) and .SZ (Shenzhen) suffixes, but Order objects return .XSHG / .XSHE suffixes. Be aware of this difference.

  6. Global object g: Use g.xxx for cross-function state. Variables starting with __ are private and won't be persisted.

  7. log object: Use log.info(), log.warning(), log.error() etc. Never print().

STRATEGY LIFECYCLE (MANDATORY KNOWLEDGE)

A strategy has exactly 2 required functions and 5 optional ones:

initialize(context)          # REQUIRED — runs once at startup
handle_data(context, data)   # REQUIRED — runs every bar (daily/minute)
before_trading_start(context, data)  # optional — runs before market open
after_trading_end(context, data)     # optional — runs after market close
tick_data(context, data)     # optional — runs every 3s (live trading only)
on_order_response(context, order_list)  # optional — order callback (live only)
on_trade_response(context, trade_list)  # optional — trade callback (live only)

Lifecycle Timing

  • initialize: runs ONCE at strategy start
  • before_trading_start: backtest 8:30, live 9:10 (configurable)
  • handle_data: backtest 9:31-15:00 (minute) or 15:00 (daily); live 9:30-14:59
  • after_trading_end: ~15:30
  • tick_data: 9:30-14:59, every 3s (live only)

Read the full file on GitHub · 305 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. 3d ago First seen · 305 lines · 126 tokens per session scan A b396932247f6

Subscribe to this mod's changes

ptrade-dev is a skill published in the GitHub repository kay-ou/ClaudeSkills (11 stars, last pushed 5mo ago), licensed MIT. It adds 126 tokens to every session and 3,139 once invoked, about $0.0006 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

invoice-organizer

Automatically organizes invoices and receipts for tax preparation by reading messy files, extracting key information, renaming them consistently, and sorting them into logical folders. Turns hours of manual bookkeeping into minutes of automated organization.

Prat011/awesome-llm-skills · 44 tokens

convex-add

Add a capability to the CURRENT Convex app — consults the served Convex capability catalog for always-current procedures (billing, crons, auth, agent, search, …); falls back to built-in hosting or @convex-dev component search. TRIGGER when the user runs /add, or asks to add hosting/publishing or any backend capability…

openclaw/clawhub · 81 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

Use when evaluating A-share limit-up (涨停板) setups through Chen Hao's sentiment and momentum lens: market emotion cycles, board strength, follow-through, and short-term aggressive momentum trading.

questflowai/investorskills · 44 tokens

trading-risk-gate

Unified pre-trade safety gate: Ruin check (Law #1), ergodicity audit, and win-rate dominance validation. Absorbs: ergodicity-check, law-of-ruin, win-rate-dominance.

winstonkoh87/Athena-Public · 53 tokens

cwv-optimizer

Diagnose and fix Core Web Vitals issues on AEM Edge Delivery Services pages. Goes deeper than generic CWV advice by understanding EDS-specific performance patterns including the 100KB LCP budget, E-L-D loading phases, block rendering behavior, and third-party script impact. Produces specific fixes for LCP, CLS, and…

adobe/skills · 112 tokens