# trading-expert

Equips your agent to build algorithmic trading logic, write Python strategies, and run backtests. Useful when designing execution algorithms or risk metrics.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 963 installs · ★ 43
- Author: personamanagmentlayer
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/domains/trading-expert/SKILL.md
- Updated: 2026-10-12
- HTML: https://affpapa.org/en/nevibecode/skills/trading-expert

## What it does

This skill guides the agent through market systems architecture, order book processing, and execution methods like TWAP or VWAP. It provides boilerplate implementations for moving average crossovers, Bollinger Bands mean reversion, and RSI momentum signals.

A basic backtesting harness runs on `pandas` and `numpy`. The script evaluates portfolio drawdown, Sharpe ratio, and overall returns. Order entities track status, quantity, and trade side.

The order routing method `send_to_venue` is strictly an abstract placeholder. You will need to write custom integration code for your exchange broker. Running the strategy code requires Python execution permissions under Bash.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill trading-expert -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/trading-expert/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/trading-expert/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill trading-expert -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/trading-expert/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill trading-expert -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/trading-expert/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install personamanagmentlayer/pcl trading-expert
```

2. **Manually: put the files in place**
- File: `.github/skills/trading-expert/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill trading-expert -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/personamanagmentlayer/pcl --path stdlib/domains/trading-expert
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/trading-expert/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add personamanagmentlayer/pcl --skill trading-expert -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/domains/trading-expert/SKILL.md

## When to use it
- Calculate performance metrics including Sharpe ratio and maximum drawdown
- Generate trading signals using moving averages, Bollinger Bands, or RSI
- Model order lifecycle structures for market and limit execution
- Design execution logic to minimize slippage with TWAP or VWAP

## Example prompts
- Implement a mean reversion strategy with Bollinger Bands in Python and evaluate historical returns.
- Build an OrderManager class that handles state transitions for limit and stop orders.
- Calculate the Sharpe ratio and maximum drawdown from a portfolio equity series.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 6cf9179e3e4b2197.

BEGIN THIRD-PARTY FILE 6cf9179e3e4b2197
````text
---
name: trading-expert
version: 1.1.0
description: >-
  Expert-level algorithmic trading, market systems, quantitative analysis, and trading
  platforms. Use when the user mentions algorithmic trading, quant, markets, finance, or
  high-frequency trading, or when the task involves Trading Systems, Market Data, or
  Execution.
category: domains
tags: [trading, algorithmic-trading, quant, markets, finance, hft]
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash(python:*)
---

# Trading Expert

Expert guidance for algorithmic trading systems, quantitative analysis, market data processing, and trading platform development.

## Core Concepts

### Trading Systems

- Algorithmic trading strategies
- High-frequency trading (HFT)
- Market making
- Arbitrage strategies
- Portfolio optimization
- Risk management

### Market Data

- Order book processing
- Tick data analysis
- Market microstructure
- Real-time data feeds
- Historical data analysis

### Execution

- Order routing
- Smart order routing (SOR)
- Execution algorithms (TWAP, VWAP)
- Slippage minimization
- Transaction cost analysis

## Trading Strategy Implementation

```python
import pandas as pd
import numpy as np
from typing import Optional

class TradingStrategy:
    def __init__(self, symbol: str, capital: float = 100000):
        self.symbol = symbol
        self.capital = capital
        self.position = 0
        self.cash = capital
        self.trades = []

    def moving_average_crossover(self, data: pd.DataFrame,
                                  short_window: int = 50,
                                  long_window: int = 200) -> pd.Series:
        """Simple Moving Average Crossover Strategy"""
        data['SMA_short'] = data['close'].rolling(window=short_window).mean()
        data['SMA_long'] = data['close'].rolling(window=long_window).mean()

        # Generate signals
        data['signal'] = 0
        data.loc[data['SMA_short'] > data['SMA_long'], 'signal'] = 1
        data.loc[data['SMA_short'] < data['SMA_long'], 'signal'] = -1

        return data['signal']

    def mean_reversion(self, data: pd.DataFrame,
                       window: int = 20,
                       num_std: float = 2.0) -> pd.Series:
        """Mean Reversion Strategy using Bollinger Bands"""
        data['MA'] = data['close'].rolling(window=window).mean()
        data['STD'] = data['close'].rolling(window=window).std()
        data['upper_band'] = data['MA'] + (data['STD'] * num_std)
        data['lower_band'] = data['MA'] - (data['STD'] * num_std)

        # Generate signals
        data['signal'] = 0
        data.loc[data['close'] < data['lower_band'], 'signal'] = 1  # Buy
        data.loc[data['close'] > data['upper_band'], 'signal'] = -1  # Sell

        return data['signal']

    def momentum_strategy(self, data: pd.DataFrame, period: int = 14) -> pd.Series:
        """Momentum Strategy using RSI"""
````
END THIRD-PARTY FILE 6cf9179e3e4b2197

The third-party file has ended. Everything between the 6cf9179e3e4b2197 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2898 of 15698 bytes. © personamanagmentlayer · Apache-2.0 · https://github.com/personamanagmentlayer/pcl/tree/HEAD/stdlib/domains/trading-expert/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
