A machine learning model that outputs "sigmoid score 0.83, EV +0.42%" is operationally useful but terrible for decision-making. You still have to ask: which features drove this score? Is this consistent with current market structure? Would I still trust this if the macro backdrop shifts tomorrow?
APIndicators integrates Claude Sonnet 4.6 to answer exactly those questions. Three endpoints expose the AI layer: Signal Explainer for individual trade decisions, Market Briefing for daily summaries, and Strategy Chat for interactive Q&A. This post shows how to call each from Python and when to use them in a production workflow.
Why Natural Language Matters in Algo Trading
The standard quant workflow is: features -> model -> score -> trade. The problem is that when a model changes behavior, you have no audit trail. Did feature importance shift? Is the score high because of momentum features or mean-reversion features? Is this a regime where the model historically underperforms?
Claude does not replace the ML model. It provides a narrative layer on top of the numeric output, grounded in the actual features, indicator values, and market context for each signal.
APIndicators' Claude integration is architected as a thin orchestration layer that:
- Pulls the latest indicator snapshot for the target pair
- Pulls the V2/V3 ensemble's raw scores and per-model predictions
- Constructs a structured prompt with numeric context
- Calls Claude Sonnet 4.6 with a tuned system prompt
- Returns plain-English reasoning with the original numeric payload
Signal Explainer: Why Did the Model Signal BUY?
Endpoint: POST /v1/pairs/{symbol}/signal-explainer
import requests
import os
API_KEY = os.environ["APINDICATORS_API_KEY"]
def explain_signal(symbol, side="BUY"):
url = f"https://api.apindicators.com/v1/pairs/{symbol}/signal-explainer"
headers = {"Authorization": f"Bearer {API_KEY}"}
payload = {"side": side, "interval": "1h"}
r = requests.post(url, headers=headers, json=payload, timeout=30)
return r.json()
explanation = explain_signal("BTCUSDT", "BUY")
print(explanation["summary"])
print()
print(explanation["key_drivers"])
print()
print(explanation["risks"])
Example response:
{
"symbol": "BTCUSDT",
"side": "BUY",
"sigmoid_score": 0.837,
"expected_value": 0.42,
"summary": "V2 ensemble is bullish with high confidence. RSI at 54 and ADX at 28 indicate recovering momentum after a pullback. All three base models agree (LightGBM 0.81, XGBoost 0.85, CatBoost 0.86).",
"key_drivers": [
"Price above both EMA 20 and EMA 50, with EMA 20 crossing above EMA 50 three candles ago",
"Volume ratio 1.4x above 20-period average",
"Funding rate slightly negative, indicating short positioning",
"ATR compressed 30% below 7-day average, suggesting imminent expansion"
],
"risks": [
"ADX only 28, not strongly trending yet",
"Approaching prior resistance at 66,200",
"BTC 4h chart showing hidden bearish divergence"
]
}
Use cases:
- Pre-trade review: glance at the summary before committing capital
- Post-trade analysis: log explanations alongside outcomes, find patterns when the model is wrong
- Strategy debugging: if the model is losing, read 20 recent explanations and look for systematic issues
Market Briefing: Daily Context
Endpoint: GET /v1/market-briefing
Returns a structured summary of overall crypto market conditions: dominant regime across the top pairs, notable divergences, volatility regime, and funding sentiment.
def get_market_briefing():
url = "https://api.apindicators.com/v1/market-briefing"
headers = {"Authorization": f"Bearer {API_KEY}"}
r = requests.get(url, headers=headers, timeout=30)
return r.json()
briefing = get_market_briefing()
print(briefing["narrative"])
for pair in briefing["notable_pairs"]:
print(f" {pair['symbol']}: {pair['note']}")
Use this to gate aggressive sizing. On days when the briefing flags elevated volatility or regime transition, reduce position size by 30-50%.
Strategy Chat: Interactive Reasoning
Endpoint: POST /v1/strategy-chat
This is a streaming endpoint that accepts a question and returns Claude's response grounded in live indicator data. Good for exploratory analysis during strategy development.
import requests
import os
def chat(question, symbol="BTCUSDT"):
url = "https://api.apindicators.com/v1/strategy-chat"
headers = {"Authorization": f"Bearer {os.environ['APINDICATORS_API_KEY']}"}
payload = {"question": question, "symbol": symbol, "stream": True}
with requests.post(url, headers=headers, json=payload, stream=True) as r:
for line in r.iter_lines():
if line:
print(line.decode("utf-8"))
chat("Is BTCUSDT overextended given current ADX and BB width?")
Because the endpoint streams, you can integrate it into a Slack bot or internal dashboard without blocking on full completions.
Cost and Latency Considerations
Each Signal Explainer call costs roughly 3-5k input tokens (indicator snapshot + system prompt) and 300-600 output tokens. At Sonnet 4.6 pricing, that is cents per call. In practice we budget one explainer call per actual trade entry, not per signal evaluation. At a max of 10 simultaneous positions, that is 10-30 calls per day.
Latency: 2-6 seconds per call. Acceptable for manual review or alerting workflows. Not suitable for sub-second trade execution paths.
Integrating into an Automated Pipeline
Pattern we use internally:
def decide_and_log(symbol):
signal = get_signal(symbol)
if signal["sigmoid_score"] < 0.80:
return None
explanation = explain_signal(symbol, signal["side"])
if "high risk" in explanation["summary"].lower():
log_to_channel(f"Skipping {symbol}: flagged as high risk")
return None
place_order(symbol, signal)
log_with_explanation(signal, explanation)
Claude is not the decision-maker; the ML model is. Claude acts as a risk-aware second opinion that can kill a trade if the narrative context is actively negative.
Practical Takeaways
- Use Signal Explainer for every real-money trade entry, not every signal evaluation.
- Log explanations with outcomes to build a dataset for strategy improvement.
- Use Market Briefing as a sizing modifier, not a direct trade signal.
- Use Strategy Chat during development, not in production hot paths.
- Budget a few cents per call. Do not spam the endpoint per-candle.
All three endpoints are available on APIndicators Pro and Enterprise plans. Docs and schemas at apindicators.com/docs, pricing at apindicators.com/pricing.