compute_attribution
Analyze trade attribution and rotation effectiveness by matching round-trips, computing swap alpha and benchmark-relative returns, and providing pattern analysis with calibration recommendations.
Instructions
Analyze trade attribution and rotation effectiveness.
Matches BUY/SELL trades into round-trips, computes swap alpha (what the replaced stock did), benchmark-relative returns, and pattern analysis with calibration recommendations.
Args: trades_json: JSON array of trades, e.g. '[{"date": "2025-01-15", "action": "BUY", "ticker": "NVDA", "shares": 50, "price": 120.00, "score": 75, "replaced": "INTC"}, ...]'. prices_json: JSON of price data from fetch_prices (the "prices" array). benchmark: Benchmark ticker (default "SPY").
Returns: JSON with round_trips (per-trade attribution, swap alpha) and patterns (win rate, avg return, score-return correlation, recommendations).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"trades_json": "<trades_json>",
"prices_json": "<prices_json>"
},
"name": "compute_attribution"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trades_json | Yes | ||
| prices_json | Yes | ||
| benchmark | No | SPY |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |