Signals
Spread
Track the price gap between two related instruments.
What it is
Spread computes the price difference between a primary symbol and a comparison symbol, optionally scaled by a ratio for pair-trading or synthetic basket analysis.
When to use it
- Tracking the distance between two related instruments.
- Researching mean-reverting pairs and relative-value setups.
- Visualizing whether a long/short relationship is widening or compressing.
The maths
Spread(A, B) = close_A[t] - close_B[t] This is the simple price difference per bar.
What it tells you
A widening spread between two historically cointegrated instruments may signal a mean-reversion opportunity. Traders use it in pairs trading to identify when a relationship looks stretched.
REST example
python
import os
import requests
response = requests.get(
'https://api.financedata.com/v1/signals/Spread/AAPL',
params={
'compare_symbol': 'MSFT',
'start_date': '2025-01-01',
'end_date': '2025-04-30',
'ratio': 1.0,
},
headers={'X-API-Key': os.environ['FDA_KEY']},
timeout=30,
)
response.raise_for_status()
print(response.json())MCP example
Tool call body
{
"name": "run_signals",
"arguments": {
"symbols": ["AAPL"],
"signal_names": ["Spread"],
"start_date": "2025-01-01",
"end_date": "2025-04-30",
"signal_parameters": {
"Spread": {
"symbol": "MSFT",
"ratio": 1.0
}
}
}
}Spread also uses the batch run_signals MCP entry point today; pass the peer symbol and ratio under signal_parameters for the Spread signal.
Agent prompt that triggers it
Compute the price spread between AAPL and MSFT and tell me whether the gap is widening or narrowing into the latest observation.