Install
$ agentstack add skill-brainbytes-dev-everything-claude-trading-transaction-cost-analysis ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Transaction Cost Analysis
> Transaction cost analysis (TCA) — slippage, market impact, benchmarks for measuring execution quality.
When to Activate
- User needs to measure and decompose execution costs
- Evaluating broker or algorithm performance
- Building market impact models (Almgren-Chriss, square-root model)
- Comparing execution against benchmarks (VWAP, arrival price, close)
- Conducting pre-trade cost estimation for portfolio rebalancing
Core Concepts
What TCA Measures
TCA quantifies the total cost of transforming an investment decision into executed trades. This includes everything from the moment a portfolio manager decides to trade until the last share is filled.
Cost Taxonomy
Explicit Costs (directly observable):
- Commissions: $0.001-0.005/share for institutional equity (declining toward zero)
- Exchange fees: $0.0003-0.003/share (varies by venue, maker/taker)
- Stamp duty / FTT: 0.5% UK, 0.1% HK, varies by jurisdiction
- Clearing fees: negligible for equities, meaningful for derivatives
Implicit Costs (estimated from market data):
- Bid-ask spread cost: half-spread on average for market orders
- Market impact: permanent price movement caused by the trade
- Timing cost: price drift between decision and execution
- Opportunity cost: cost of not executing (unexecuted portion)
Implementation Shortfall Decomposition
Perold (1988) defined implementation shortfall as the difference between paper portfolio return and actual portfolio return:
IS = Paper Return - Actual Return
Decomposed into:
IS = Delay Cost + Market Impact + Spread Cost + Opportunity Cost + Commissions
Where:
- Delay Cost = price move from decision to order release
- Market Impact = price move from order release to execution (attributable to our trading)
- Spread Cost = half the bid-ask spread at execution
- Opportunity Cost = return on unexecuted shares (for partial fills)
- Commissions = explicit fees
Methodology
Step 1: Single-Order TCA
import pandas as pd
import numpy as np
def implementation_shortfall(decision_price, arrival_price, exec_price,
close_price, exec_qty, order_qty,
side, commission_per_share=0.003):
"""
Full IS decomposition for a single order.
decision_price: price when PM made the decision
arrival_price: price when order reached the trading desk
exec_price: volume-weighted average execution price
close_price: closing price on the day
"""
direction = 1 if side == 'BUY' else -1
fill_rate = exec_qty / order_qty
# Component costs (in bps of notional)
delay_cost = direction * (arrival_price - decision_price) / decision_price * 10000
market_impact = direction * (exec_price - arrival_price) / arrival_price * 10000
spread_cost = abs(exec_price - arrival_price) / arrival_price * 10000 # approximate
commissions = commission_per_share / exec_price * 10000
# Opportunity cost: return on unfilled shares
if fill_rate 30 orders per group)
- [ ] Outlier orders investigated individually (extreme slippage may indicate information leakage)
- [ ] Portfolio-level TCA links costs to alpha — are we paying more to trade than we earn?
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [brainbytes-dev](https://github.com/brainbytes-dev)
- **Source:** [brainbytes-dev/everything-claude-trading](https://github.com/brainbytes-dev/everything-claude-trading)
- **License:** MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.