SPI Adapter Spec Reference
Adapter-Mediated Producer Integration This document is for operators configuring pull-mode (adapter) integrations. If you’re a producer wanting to submit signals directly, see External Producers.Overview
The adapter framework lets b1e55ed consume an external producer’s existing API without requiring any changes on the producer’s side. The operator writes a YAML spec that describes:- Where to find the signals (endpoint, auth, polling interval)
- How to extract them (field mappings from their format to SPI format)
- How to normalize them (confidence scaling, direction translation)
accept_signal() pipeline as native producers. The producer gets identical karma tracking and attribution.
YAML Spec Format
Top-Level Fields
Health Endpoint (Optional but Recommended)
Authentication
${VAR} syntax are expanded at runtime. Never hardcode credentials in the YAML file.
Signals Endpoint
Items Path
response.signals as the signal list. Use dot notation for nested paths: "data.items.signals".
Field Mapping
"168" is a literal 168. "timestamp" is a field lookup.
Direction Mapping
When the producer’sdirection field uses different values from SPI’s bullish|bearish|neutral:
Confidence Normalization
The producer’s confidence values may be on a different scale. Configure normalization:
Note: Unknown strategy values silently floor confidence at 0.55.
direct (default)
Use the producer’s confidence value directly. Assumes it’s already in [0.55, 0.99]. Values outside this range are clamped.
hit_rate
Uses the producer’s historical hit rate to calibrate confidence. Linearly rescales from the producer’s range to SPI’s range:
[0, 100] → hit_rate maps to [0.55, 0.95].
logistic
Apply a logistic function to map any range to (0, 1), then clamp to [0.55, 0.99]:
Complete Example: post-fiat-signals
This is the reference adapter for the post-fiat-signals producer:- Poll
${POST_FIAT_SIGNALS_URL}/signals/filtered?filter=ACTIONABLEevery 60 seconds - Parse
response.signalsas the signal array - Map
ticker→ symbol,action→ direction (with BUY/SELL/HOLD translation),confidence→ confidence - Use literal
168for all signals’horizon_hours(weekly horizon) - Skip signals older than 300 seconds (
stale_threshold_sec) - Skip signals with confidence below
0.55(min_confidence)
Environment Variable Expansion
Any string value in the YAML can reference environment variables with${VAR_NAME} syntax:
- Variables are expanded at adapter load time (not at each poll)
- If a referenced variable is not set, adapter startup fails with a clear error
- Variable names are case-sensitive
- Nested variables are not supported:
${${VAR}}does not work
.env or your deployment secrets manager. Never commit credentials.
Spec File Location
Place adapter specs in:.yaml files in this directory at startup.
Testing a Spec
Before deploying, validate a spec and do a dry-run poll:Common Issues
Signals not appearing after adapter startup- Check health endpoint — if unhealthy, polls are skipped
- Verify
POST_FIAT_SIGNALS_URLenv var is set - Check
stale_threshold_sec— all signals may be older than the threshold - Run
b1e55ed adapter dry-runto see raw response
- Producer is returning values below
min_confidence - Review
confidence_normalization— may needhit_rateif producer uses a different range
- Check
direction_mapping— producer may use different strings - Run dry-run with
--verboseto see the rawactionfield values
- Add
client_signal_idto field_mapping pointing to the producer’s signal ID - Without this, each poll cycle creates new records even if signals haven’t changed
Adapter vs Native Migration
Adapter mode is a bootstrap path. If you’re a producer currently integrated via adapter and want to switch to native (push) mode:- Contact the operator — your producer record already exists, the adapter just gets disabled
- Implement the POST
/api/v1/spi/signalscall in your system - Operator provides your
spi_key_*and marks your ingress mode asnative - Begin submitting directly