Execution & Risk Stocks, Crypto, DeFi

Order Execution

Paste into Claude, ChatGPT, or any coding agent

This skill handles the mechanics of placing and executing trades across centralized exchanges (CEX) and decentralized exchanges (DEX). It covers order type selection, algorithmic execution for large positions (TWAP/VWAP), slippage management, MEV protection, and execution quality analysis. CRITICAL PREREQUISITE: The Risk Management skill MUST be run before this skill — position size, stop-loss, and risk validation must be completed before any order is placed. Every live trade requires explicit human confirmation.

When to Use This Skill

  • When placing any trade on a CEX (Binance, Bybit, OKX, etc.)
  • When executing a DEX swap (Jupiter, Uniswap, Raydium, etc.)
  • When selecting the optimal order type for a given trade
  • When executing a large position that needs TWAP/VWAP splitting
  • When setting up trailing stops or conditional orders
  • When analyzing execution quality (slippage, fill rate)
  • When configuring MEV protection for on-chain transactions
  • ALWAYS after risk-management has approved the trade

What This Skill Does

  1. Order Type Selection: Recommends the optimal order type based on trade urgency, size, and market conditions
  2. CEX Execution: Places orders on Binance, Bybit, OKX, and other supported exchanges via MCP
  3. DEX Execution: Executes swaps on Jupiter (Solana), Uniswap (EVM), and other DEXs with slippage and MEV protection
  4. Algorithmic Execution: Implements TWAP and VWAP strategies for large positions to minimize market impact
  5. Human Confirmation Gate: Presents trade details and requires explicit user approval before any live execution
  6. Paper Trading Mode: Simulates execution for strategy testing without real capital
  7. Execution Quality Analysis: Tracks slippage, fill rates, and execution costs post-trade

How to Use

Simple Order

Buy 0.5 BTC at market on Binance
Place a limit order to sell 100 SOL at $185 on Bybit

Algorithmic Execution

Execute a TWAP buy of 10 ETH over 4 hours on Binance
VWAP sell $50,000 of SOL over the next trading session on Jupiter

DEX Swap

Swap 5 SOL for USDC on Jupiter with 0.5% max slippage
Swap 2 ETH for USDC on Uniswap with MEV protection

Paper Trade

Paper trade: buy 1 BTC at market — simulate fills and track

Execution Review

Review execution quality of my last 10 trades — what was my average slippage?

Data Sources

With MCP/CLI tools connected:

  • Binance MCP (TermiX) — Full trading API: spot, futures, margin orders, account data
  • Binance MCP (snjyor) — Alternative Binance integration, market data + trading
  • Bybit MCP — Bybit spot and derivatives trading, account management
  • OKX MCP — OKX spot and derivatives trading
  • Jupiter Talk MCP — Jupiter aggregator on Solana: swaps, limit orders, DCA
  • Uniswap MCP — Uniswap V3 swaps on Ethereum and L2s
  • Solana Agent Kit — Solana transaction construction, wallet management
  • DexScreener — DEX price quotes, liquidity depth for slippage estimation

Without tool access: Ask the user to:

  1. Specify the exchange/DEX they want to use
  2. Provide their current order book depth (bid/ask at various levels)
  3. State their desired order type and parameters
  4. Confirm they have sufficient balance for the trade

Provide the complete order specification and instruct them to place it manually. Include exact parameters: order type, side, size, price, stop, and any conditional logic.

Methodology

Step 0: PREREQUISITE — Risk Management Validation

╔══════════════════════════════════════════════════════════════════╗
║  MANDATORY: Before ANY order execution, the following MUST be   ║
║  completed via the risk-management skill:                       ║
║                                                                  ║
║  1. Position size calculated and validated                       ║
║  2. Stop-loss level determined                                   ║
║  3. Risk/reward ratio confirmed above minimum threshold          ║
║  4. Portfolio-level risk checks passed                           ║
║  5. Risk validation gate checklist completed                     ║
║                                                                  ║
║  If risk-management has NOT been run → STOP. Run it first.       ║
╚══════════════════════════════════════════════════════════════════╝

Step 1: Order Type Selection

Choose the optimal order type based on the trade’s characteristics.

Order Type Decision Matrix:

SituationRecommended OrderReasoning
Need immediate fill, small sizeMarket OrderFastest execution, acceptable slippage on liquid assets
Have specific price target, no urgencyLimit OrderZero slippage, may not fill
Breakout entry (buy above resistance)Stop-Limit OrderTriggers only if breakout occurs
Trailing profit protectionTrailing StopLocks in gains as price moves favorably
Large position (>0.5% daily volume)TWAP/VWAPMinimizes market impact
Large position, hide sizeIceberg OrderShows only small portion of total size
DCA into position over timeRecurring Limit OrdersSystematic entry, reduces timing risk
Conditional on another eventOCO (One-Cancels-Other)Links stop-loss with take-profit

Order Type Specifications:

MARKET ORDER
  Pros: Immediate fill, guaranteed execution
  Cons: Slippage, especially on large orders or illiquid assets
  Best for: Urgent entries/exits, very liquid assets, small positions
  Max recommended size: < 0.1% of asset's daily volume

LIMIT ORDER
  Pros: No slippage, price guaranteed if filled
  Cons: May not fill (opportunity cost), partial fills possible
  Best for: Non-urgent entries, scaling in/out, specific price levels
  Tip: Place 0.1-0.3% below market for buys (above for sells) for likely fill

STOP-LIMIT ORDER
  Trigger: Becomes a limit order when stop price is reached
  Stop price: The trigger level
  Limit price: The worst price you'll accept (set 0.2-0.5% beyond stop)
  Best for: Breakout entries, stop-losses (with limit buffer)
  Risk: In fast markets, price may gap past your limit → no fill

TRAILING STOP
  Tracks price by a fixed amount or percentage
  Long: Trails below highest price reached since entry
  Short: Trails above lowest price reached since entry
  Settings:
    Tight: 1-2% trail (volatile markets: ATR-based instead)
    Standard: 3-5% trail
    Wide: 5-10% trail (for swing/position trades)
  Best for: Letting winners run while protecting profits

ICEBERG ORDER
  Visible quantity: 10-20% of total order size
  Refills automatically as visible portion fills
  Best for: Large orders where showing full size would move the market
  Availability: Most CEXs support; DEXs do not natively support

OCO (ONE-CANCELS-OTHER)
  Combines: Take-profit limit + Stop-loss in one order
  When one fills, the other automatically cancels
  Best for: "Set and forget" trade management
  Example: Long entry at $100, OCO with TP at $115 and SL at $95

Step 2: Size Threshold Analysis — Simple vs. Algorithmic

Determine whether the position can be executed as a single order or requires algorithmic splitting.

POSITION SIZE vs DAILY VOLUME RATIO:

Ratio = Position Size ($) / Asset Daily Volume ($)

| Ratio | Execution Method | Expected Slippage |
|-------|-----------------|-------------------|
| < 0.05% | Single market order | < 0.05% |
| 0.05-0.2% | Single limit order | ~0 (if patient) |
| 0.2-0.5% | Multiple limit orders (2-5 tranches) | 0.05-0.1% |
| 0.5-2.0% | TWAP or VWAP (algorithmic) | 0.1-0.3% |
| 2.0-5.0% | TWAP with wide intervals + iceberg | 0.3-1.0% |
| > 5.0% | OTC desk or multi-day accumulation | Variable |

Step 3: TWAP Execution Strategy

Time-Weighted Average Price — splits a large order into equal-sized pieces executed at regular intervals.

TWAP PARAMETERS:

Total Size: S (total units to buy/sell)
Duration: T (total time to execute, e.g., 4 hours)
Intervals: N (number of child orders)
Child Size: S / N

RECOMMENDED SETTINGS BY SIZE:

| Position / Daily Vol | Duration | Intervals | Child Order Type |
|---------------------|----------|-----------|-----------------|
| 0.5-1.0% | 2-4 hours | 8-16 | Limit (0.1% from mid) |
| 1.0-2.0% | 4-8 hours | 16-32 | Limit (0.1% from mid) |
| 2.0-5.0% | 8-24 hours | 32-96 | Limit + iceberg |
| > 5.0% | Multi-day | 50+ per day | Limit + iceberg |

TWAP EXECUTION RULES:
1. Calculate child order size: Total / N
2. Set interval: Duration / N (e.g., 4h / 16 = 15 min intervals)
3. At each interval:
   a. Check current mid price
   b. Place limit order 0.05-0.1% better than mid (buy below, sell above)
   c. If not filled within 80% of interval, convert to market order
4. Add randomness: ±20% variation in interval timing to avoid detection
5. Pause if spread widens >3× normal (low liquidity event)
6. Track: average fill price vs. arrival price → implementation shortfall

IMPLEMENTATION SHORTFALL = Average Fill Price - Arrival Price (at decision time)
  < 0.1%: Excellent execution
  0.1-0.3%: Acceptable
  > 0.3%: Poor — review and adjust strategy

Step 4: VWAP Execution Strategy

Volume-Weighted Average Price — weights child order sizes to match the asset’s historical volume profile.

VWAP PARAMETERS:

1. Fetch historical hourly volume profile for the asset (30-day average)
2. Calculate volume weight per hour:
   Weight_h = Volume_h / Total_Volume

3. Allocate child order sizes proportionally:
   Child_Size_h = Total_Size × Weight_h

4. Execute larger portions during high-volume hours, smaller during low-volume

EXAMPLE (BTC/USDT, $500K buy over 12 hours):
  Hour  | Hist Vol% | Allocation | Child Size
  00:00 | 8%        | $40,000    | 0.59 BTC
  01:00 | 6%        | $30,000    | 0.44 BTC
  02:00 | 5%        | $25,000    | 0.37 BTC
  ...   | ...       | ...        | ...
  16:00 | 12%       | $60,000    | 0.89 BTC  (US market hours = higher vol)
  17:00 | 11%       | $55,000    | 0.81 BTC

VWAP ADVANTAGE vs TWAP:
  - Executes more during liquid periods → lower slippage
  - Benchmark: Your avg fill vs market VWAP → should be close
  - If your fill > VWAP (for buys): you are paying market impact premium

Step 5: CEX Execution Procedures

Specific procedures for each supported exchange.

BINANCE (via TermiX or snjyor MCP):
  Spot:     POST /api/v3/order — type, side, symbol, quantity, price, timeInForce
  Futures:  POST /fapi/v1/order — add leverage, marginType, positionSide
  Order types supported: LIMIT, MARKET, STOP_LIMIT, TAKE_PROFIT_LIMIT, TRAILING_STOP_MARKET

  Pre-flight checks:
  1. Confirm balance: GET /api/v3/account
  2. Check current price: GET /api/v3/ticker/price
  3. Verify trading pair is active: GET /api/v3/exchangeInfo
  4. Check minimum order size (notional and quantity filters)

BYBIT (via Bybit MCP):
  Spot:     /v5/order/create — category=spot
  Linear:   /v5/order/create — category=linear (USDT perps)
  Inverse:  /v5/order/create — category=inverse

  Pre-flight checks:
  1. Wallet balance: /v5/account/wallet-balance
  2. Current price: /v5/market/tickers
  3. Instrument info: /v5/market/instruments-info

OKX (via OKX MCP):
  Unified: POST /api/v5/trade/order — instType, side, ordType, sz, px
  Order types: market, limit, post_only, fok, ioc

  Pre-flight checks:
  1. Balance: /api/v5/account/balance
  2. Ticker: /api/v5/market/ticker
  3. Instrument: /api/v5/public/instruments

Step 6: DEX Execution Procedures

JUPITER (Solana — via Jupiter Talk MCP):
  Swap endpoint: /v6/swap
  Quote first: /v6/quote?inputMint=X&outputMint=Y&amount=Z

  SLIPPAGE SETTINGS:
  | Asset Type | Max Slippage | Priority Fee |
  |-----------|-------------|-------------|
  | SOL, USDC, major | 0.3-0.5% | Standard |
  | Mid-cap SPL tokens | 0.5-1.0% | Standard |
  | Small-cap / new tokens | 1.0-3.0% | Higher |
  | Memecoins | 3.0-10.0% | Highest |

  MEV PROTECTION:
  - Use Jupiter's built-in MEV protection (Jito bundles)
  - Set maxAutoSlippageBps to limit worst-case slippage
  - For large swaps: use Jupiter DCA feature (TWAP equivalent on-chain)

UNISWAP (Ethereum/L2 — via Uniswap MCP):
  Router: SwapRouter02
  Quote: Quoter V2 contract

  SLIPPAGE SETTINGS:
  | Asset Type | Max Slippage | Gas Priority |
  |-----------|-------------|-------------|
  | ETH, USDC, major ERC-20 | 0.3-0.5% | Standard |
  | Mid-cap ERC-20 | 0.5-1.5% | Standard |
  | Small-cap / new | 1.0-5.0% | Higher |

  MEV PROTECTION:
  - Use Flashbots Protect RPC (https://rpc.flashbots.net) to prevent sandwich attacks
  - Set deadline parameter: block.timestamp + 300 seconds (5 min max)
  - For large swaps: split across Uniswap V3 fee tiers (0.05%, 0.3%, 1.0%)

GENERAL DEX RULES:
  1. ALWAYS get a quote before executing
  2. Compare quote to spot price → expected slippage
  3. If expected slippage > 1% on a major token: liquidity is too low, reconsider
  4. Check pool liquidity depth: position should be < 5% of pool TVL
  5. Verify token contract address (use CoinGecko or official sources — never trust links)

Step 7: MANDATORY Human Confirmation Gate

╔══════════════════════════════════════════════════════════════════╗
║                    HUMAN CONFIRMATION REQUIRED                   ║
║                                                                  ║
║  EVERY live trade — whether manual or agent-initiated — MUST     ║
║  be presented to the user for explicit approval before execution.║
║                                                                  ║
║  The confirmation prompt MUST include:                           ║
║  1. Action: BUY or SELL                                          ║
║  2. Asset: exact trading pair                                    ║
║  3. Size: quantity and USD value                                 ║
║  4. Price: limit price or "MARKET"                               ║
║  5. Exchange/DEX: where the order will be placed                 ║
║  6. Order type: market, limit, stop-limit, etc.                  ║
║  7. Risk: dollar risk amount and % of portfolio                  ║
║  8. Stop-loss: level and order type                              ║
║  9. Estimated fees: trading fee + gas (if DEX)                   ║
║  10. Slippage estimate: expected vs max allowed                  ║
║                                                                  ║
║  Format the confirmation as:                                     ║
╚══════════════════════════════════════════════════════════════════╝

## CONFIRM TRADE

| Field | Value |
|-------|-------|
| Action | BUY |
| Asset | BTC/USDT |
| Size | 0.15 BTC ($10,050) |
| Price | LIMIT $67,000 |
| Exchange | Binance |
| Order Type | Limit GTC |
| Risk | $500 (1.0% of portfolio) |
| Stop-Loss | $63,900 (Stop-Limit) |
| Est. Fee | $10.05 (0.1% maker) |
| Est. Slippage | ~0% (limit order) |

**Type "CONFIRM" to execute or "CANCEL" to abort.**

RULES:
  - NEVER execute without receiving "CONFIRM" (or equivalent affirmative)
  - If the user modifies parameters, re-display the updated confirmation
  - For agent trades: present to human supervisor, wait for approval
  - Paper trades do NOT require confirmation (but clearly label as paper)

Step 8: Paper Trading and Simulation

Always recommend paper trading before live execution, especially for new strategies.

PAPER TRADE EXECUTION:
1. Record order details as if placed (timestamp, price, size, type)
2. Simulate fill:
   - Market order: fill at current bid (sell) or ask (buy) + estimated slippage
   - Limit order: fill when price crosses limit level (check historical data)
   - Add realistic slippage: 0.05% for liquid, 0.2% for mid-cap, 1%+ for small-cap
3. Record fill price and timestamp
4. Track P&L from entry, mark-to-market daily
5. Apply all fees (maker/taker rates for the exchange)
6. Treat paper stops/targets identically to live orders

PAPER → LIVE TRANSITION:
  Minimum requirements before going live:
  - 20+ paper trades executed
  - Positive expectancy over paper trading period
  - Sharpe ratio > 1.0 on paper trades
  - Max paper drawdown < predefined risk tolerance
  - User explicitly requests to go live

Step 9: Post-Execution Quality Analysis

After every trade (or batch of trades), analyze execution quality.

EXECUTION QUALITY METRICS:

1. SLIPPAGE
   Slippage = Fill Price - Expected Price (at time of decision)
   Slippage % = Slippage / Expected Price × 100

   Benchmarks:
   | Market | Good | Acceptable | Poor |
   |--------|------|-----------|------|
   | BTC/ETH spot | < 0.02% | 0.02-0.1% | > 0.1% |
   | Altcoin spot | < 0.1% | 0.1-0.5% | > 0.5% |
   | DEX swap (major) | < 0.2% | 0.2-0.5% | > 0.5% |
   | DEX swap (small) | < 1.0% | 1.0-3.0% | > 3.0% |

2. IMPLEMENTATION SHORTFALL
   IS = (Fill Price - Arrival Price) / Arrival Price × 100
   Includes: slippage + market impact + timing cost
   Target: IS < 0.1% for single orders, < 0.3% for TWAP/VWAP

3. FILL RATE
   Fill Rate = Filled Quantity / Ordered Quantity × 100
   For limit orders: Track how often limits fill vs expire
   Target: > 80% fill rate for limit orders (adjust price if too low)

4. TIMING COST
   Timing Cost = Price at execution - Price at signal generation
   Measures delay cost from analysis to execution
   Minimize by: having orders pre-staged, using automation

POST-TRADE LOG (record for every trade):
  - Order ID, timestamp, asset, side, size, order type
  - Expected price (at decision), fill price, slippage
  - Fees paid (trading fee + gas if applicable)
  - Implementation shortfall
  - Time from signal to fill
  - Notes (any issues, partial fills, rejections)

Anti-Patterns

DO NOT do these — they cause execution failures and losses:

  1. Executing before risk validation: NEVER place an order without first running the Risk Management skill. Position size and stop-loss must be determined before execution begins.

  2. Market ordering large positions: Placing a $500K market order on a $10M daily volume asset will cause 3-5% slippage. Use TWAP/VWAP for positions > 0.5% of daily volume.

  3. Skipping the human confirmation gate: No matter how confident the analysis, every live trade must have explicit human approval. This is a non-negotiable safety rule.

  4. Setting slippage too high on DEXs: Setting 10% slippage on a major token swap is an invitation for sandwich attacks. Use the minimum necessary slippage for the token type.

  5. Not verifying token contract addresses: On DEXs, always verify the token contract address against CoinGecko or the project’s official site. Fake/scam tokens with similar names are common.

  6. Chasing fills on limit orders: If a limit order does not fill, do not repeatedly move it closer to market price. Reassess whether the trade setup is still valid.

  7. Ignoring partial fills: A partially filled order changes your risk profile. If only 30% fills, your stop-loss and target may need adjustment.

  8. No paper trading first: Going live with a new strategy without paper trading is gambling, not trading. Always simulate first.

Validation Checkpoints

Input Validation (Pre-Execution)

  • Risk Management skill has been run and trade is APPROVED
  • Position size validated against portfolio limits
  • Stop-loss level determined and order type selected
  • Exchange/DEX specified and API access confirmed
  • Sufficient balance for the trade (including fees)
  • Trading pair is active and not in maintenance
  • Minimum order size requirements met
  • Slippage tolerance set appropriately for asset type
  • For DEX: token contract address verified against trusted source

Execution Validation

  • Human confirmation received (explicit “CONFIRM”)
  • Order placed successfully (order ID received)
  • Fill confirmation received (or partial fill status tracked)
  • Stop-loss order placed immediately after entry fill
  • Take-profit order placed (if using OCO)

Post-Execution Validation

  • Fill price recorded and slippage calculated
  • Implementation shortfall calculated
  • Fees recorded
  • Trade logged with full details (entry, stop, target, reasoning)
  • Portfolio state updated
  • Execution quality within acceptable benchmarks

Example

User: “Buy 5 ETH at market on Binance. My portfolio is $100,000 and risk-management already approved 1.39 ETH with stop at $3,140.”

Execution Process:

## Pre-Execution Checks

1. Risk-management status: APPROVED ✓
   - Approved size: 1.39 ETH (note: user requested 5 ETH, but risk-approved size is 1.39 ETH)
   - ⚠️ OVERRIDE: User requested 5 ETH but risk-management approved 1.39 ETH.
     Proceeding with risk-approved size of 1.39 ETH unless user explicitly overrides.

2. Exchange: Binance — API connected via TermiX MCP ✓
3. Balance check: 5,200 USDT available ✓ (need ~$4,865 + fees)
4. Pair: ETHUSDT — active, no maintenance ✓
5. Min order: 0.001 ETH — our 1.39 ETH exceeds minimum ✓
6. Size vs volume: ETH daily volume $8.2B, our $4,865 = 0.00006% → single market order OK ✓

## Order Specification
- Order type: MARKET (position is 0.00006% of daily volume → negligible impact)
- Side: BUY
- Quantity: 1.39 ETH
- Estimated fill: ~$3,500 (current ask)
- Estimated slippage: < 0.01%
- Fee: 0.1% taker = ~$4.87

## Stop-Loss Order (placed immediately after fill)
- Order type: STOP-LIMIT
- Side: SELL
- Trigger price: $3,145 (5 above stop to ensure trigger)
- Limit price: $3,135 (10 below stop for fill buffer)
- Quantity: 1.39 ETH

## CONFIRM TRADE

| Field | Value |
|-------|-------|
| Action | BUY |
| Asset | ETH/USDT |
| Size | 1.39 ETH (~$4,865) |
| Price | MARKET (~$3,500) |
| Exchange | Binance |
| Order Type | Market |
| Risk | $500 (1.0% of $50K portfolio) |
| Stop-Loss | $3,140 (Stop-Limit at $3,145/$3,135) |
| Est. Fee | $4.87 (0.1% taker) |
| Est. Slippage | < 0.01% |

**Type "CONFIRM" to execute or "CANCEL" to abort.**

---

[After user confirms "CONFIRM"]

## Execution Report

| Field | Value |
|-------|-------|
| Order ID | 847291635 |
| Fill Price | $3,500.40 |
| Slippage | +$0.40 (+0.011%) — Excellent |
| Quantity Filled | 1.39 ETH |
| Total Cost | $4,865.56 |
| Fee | $4.87 |
| Stop-Loss Order | Placed — ID 847291702 |
| Impl. Shortfall | 0.011% — Excellent |

Trade executed successfully. Stop-loss at $3,140 is active.
Next: Monitor position. See risk-management for drawdown management if needed.