Feeds provide live price data to your pipeline functions viaDocumentation Index
Fetch the complete documentation index at: https://mathematicalcompany.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ctx.feeds. Each feed runs as an async task on the engine’s tokio runtime.
Available Feeds
BinanceWS
Real-time trade stream from Binance WebSocket.
PolymarketBook
Polymarket orderbook snapshots via WebSocket.
KalshiBook
Kalshi orderbook polling via REST.
RESTFeed
Generic REST API polling for any endpoint.
PredictItFeed
PredictIt market contract prices.
ManifoldFeed
Manifold Markets crowd probabilities.
ESPNFeed
Live sports scores from ESPN.
NWSFeed
National Weather Service forecasts and alerts.
RESTJsonPathFeed
Any REST API with dot-notation JSON path extraction.
ChainlinkFeed
On-chain Chainlink price oracle via JSON-RPC.
MempoolFeed
Polygon mempool watcher for CTF exchange order flow.
AlpacaFeed
Real-time stock data from Alpaca Markets via WebSocket.
CoinbaseFeed
Coinbase Advanced Trade ticker data via WebSocket.
RobinhoodFeed
Robinhood crypto quotes via REST polling.
IBKRFeed
Interactive Brokers market data via REST polling.
CalendarFeed
Economic events and earnings calendar feed.
TreasuryFeed
Treasury yield curve data from FRED API.
BinanceWS
Real-time price stream from Binance via WebSocket:price, bid, ask, and timestamp on each trade.
| Field | Description |
|---|---|
symbol | Binance trading pair (e.g., "btcusdt", "ethusdt") |
PolymarketBook
Polymarket orderbook feed via WebSocket. Streams real-time best bid/ask from the CLOB WebSocket and updates on every orderbook change.| Field | Description |
|---|---|
market_slug | Polymarket market slug or CLOB token ID |
- Initial book snapshot - full L2 orderbook with bid/ask levels
- Price change updates - best bid/ask deltas
- Direct book messages - fallback top-of-book format
KalshiBook
Kalshi orderbook feed via REST polling:| Field | Description |
|---|---|
ticker | Kalshi market ticker (e.g., "KXBTC-25FEB16") |
RESTFeed
Generic REST API polling feed for any JSON endpoint:| Field | Default | Description |
|---|---|---|
url | required | REST endpoint URL |
interval | 5.0 | Polling interval in seconds |
PredictItFeed
PredictIt market contract prices via REST polling:| Field | Default | Description |
|---|---|---|
market_id | required | PredictIt market ID (integer) |
contract_id | None | Specific contract ID. If None, uses the first contract. |
interval | 5.0 | Polling interval in seconds (minimum 1s) |
price = lastTradePrice, bid = bestBuyYesCost, ask = bestSellYesCost.
Handles HTTP 429 with automatic exponential backoff.
ManifoldFeed
Manifold Markets probability feed via REST polling:| Field | Default | Description |
|---|---|---|
slug | required | Manifold market slug |
interval | 5.0 | Polling interval in seconds |
price = probability, volume_24h = volume.
ESPNFeed
Live sports scores from ESPN’s scoreboard API:| Field | Default | Description |
|---|---|---|
sport | required | ESPN sport name (e.g., "basketball", "football") |
league | required | ESPN league name (e.g., "nba", "nfl") |
event_id | None | Filter to a specific game. If None, picks the first active game. |
interval | 10.0 | Polling interval in seconds |
price = home score, bid = away score, volume_24h = period/quarter. The source field encodes the game status ("in_progress", "scheduled", "final").
NWSFeed
National Weather Service data in two modes:Forecast mode (default)
Alerts mode
| Field | Default | Description |
|---|---|---|
office | "" | NWS office code (e.g., "TOP", "MIA"). Required for forecast mode. |
grid_x | 0 | Grid X coordinate. Required for forecast mode. |
grid_y | 0 | Grid Y coordinate. Required for forecast mode. |
state | "" | US state abbreviation (e.g., "FL"). Required for alerts mode. |
mode | "forecast" | "forecast" or "alerts" |
user_agent | "Horizon-SDK/0.4.5" | User-Agent header (NWS requires one) |
interval | 60.0 | Polling interval in seconds (minimum 60s per NWS policy) |
price = temperature, bid = wind speed, ask = precipitation chance.
Alerts mapping: price = 1.0 if active alerts else 0.0, bid = alert count. Source encodes severity.
RESTJsonPathFeed
Flexible REST feed that extracts values from any JSON API using dot-notation paths:"price"→json["price"]"data.market.price"→json["data"]["market"]["price"]"markets.0.lastPrice"→json["markets"][0]["lastPrice"]- Numeric segments try array index first, then object key
- String values are auto-parsed to
f64
| Field | Default | Description |
|---|---|---|
url | required | REST endpoint URL |
price_path | None | Dot-notation path to price field. Falls back to json["price"]. |
bid_path | None | Dot-notation path to bid field. Falls back to json["bid"]. |
ask_path | None | Dot-notation path to ask field. Falls back to json["ask"]. |
volume_path | None | Dot-notation path to volume field. Falls back to json["volume"]. |
interval | 5.0 | Polling interval in seconds |
ChainlinkFeed
On-chain Chainlink price oracle feed. ReadslatestRoundData() from any Chainlink aggregator proxy contract via JSON-RPC eth_call. Works with any EVM chain - Ethereum, Arbitrum, Polygon, BSC, etc.
| Field | Default | Description |
|---|---|---|
contract_address | required | Chainlink aggregator proxy address (with 0x prefix) |
rpc_url | required | JSON-RPC endpoint URL for the target chain |
decimals | 8 | Price decimals (most Chainlink feeds use 8; some use 18) |
interval | 10.0 | Polling interval in seconds (minimum 1s) |
price = on-chain price (divided by 10^decimals), timestamp = on-chain updatedAt.
Common contract addresses (Ethereum mainnet):
| Pair | Address |
|---|---|
| ETH/USD | 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419 |
| BTC/USD | 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c |
| LINK/USD | 0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c |
| USDC/USD | 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6 |
MempoolFeed
Polygon mempool watcher that monitors pending transactions to Polymarket’s CTF exchange contracts. Provides visibility into large pending orders before they confirm on-chain.| Field | Default | Description |
|---|---|---|
rpc_url | "" | Polygon JSON-RPC URL (or set POLYGON_RPC_URL env var) |
ctf_addresses | CTF + Neg Risk CTF | Contract addresses to monitor |
interval | 2.0 | Polling interval in seconds |
price= number of pending CTF tradesvolume_24h= total pending USDC volumebid= largest pending buyask= largest pending selllast_trade_size= largest single trade
| Contract | Address |
|---|---|
| CTF Exchange | 0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E |
| Neg Risk CTF | 0xC5d563A36AE78145C45a50134d48A1215220f80a |
AlpacaFeed
Real-time stock and ETF data from Alpaca Markets via WebSocket, streaming trades and quotes for one or more symbols.| Field | Default | Description |
|---|---|---|
symbols | [] | List of stock/ETF ticker symbols (e.g., ["AAPL", "SPY"]) |
api_key | None | Alpaca API key (or set ALPACA_API_KEY / APCA_API_KEY_ID env var) |
api_secret | None | Alpaca API secret (or set ALPACA_API_SECRET / APCA_API_SECRET_KEY env var) |
data_source | "iex" | Data source: "iex" (free) or "sip" (paid, all exchanges) |
CoinbaseFeed
Coinbase Advanced Trade real-time ticker data via WebSocket for crypto trading pairs.| Field | Default | Description |
|---|---|---|
product_ids | [] | List of Coinbase product IDs (e.g., ["BTC-USD", "ETH-USD"]) |
api_key | None | Coinbase API key (or set COINBASE_API_KEY env var) |
api_secret | None | Coinbase API secret (or set COINBASE_API_SECRET env var) |
RobinhoodFeed
Robinhood crypto quotes via REST polling at a configurable interval.| Field | Default | Description |
|---|---|---|
symbols | [] | List of crypto pair symbols (e.g., ["BTC-USD", "ETH-USD"]) |
api_key | None | Robinhood API key (or set ROBINHOOD_API_KEY env var) |
interval | 5.0 | Polling interval in seconds |
IBKRFeed
Interactive Brokers market data feed via REST polling against the Client Portal API. Supports stocks, options, futures, and ForecastEx event contracts.| Field | Default | Description |
|---|---|---|
conids | [] | List of IBKR contract IDs (e.g., ["265598"] for AAPL) |
access_token | None | OAuth2 access token (or set IBKR_ACCESS_TOKEN env var) |
api_url | None | API base URL (auto-set based on paper flag if None) |
paper | True | Use paper trading API (paper-api.ibkr.com) vs live (api.ibkr.com) |
interval | 5.0 | Polling interval in seconds |
CalendarFeed
Economic event and earnings calendar feed. Polls bundled or API-provided event data and maps the nearest upcoming event to FeedSnapshot fields.| Field | Default | Description |
|---|---|---|
events_json | "" | JSON string of custom events. If empty, uses bundled FOMC/CPI dates. |
api_url | "" | Optional API URL to fetch events from |
interval | 300.0 | Polling interval in seconds |
bid = seconds until next event, ask = event type code.
TreasuryFeed
Treasury yield curve data from the Federal Reserve Economic Data (FRED) API. Polls multiple maturity series and maps the primary series to the price field.| Field | Default | Description |
|---|---|---|
api_key | None | FRED API key (or set FRED_API_KEY env var). Get one free at fred.stlouisfed.org. |
series_ids | 9 maturities | FRED series to fetch: 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 20Y, 30Y |
primary_series | "DGS10" | Series mapped to price field (default: 10-year yield) |
interval | 300.0 | Polling interval in seconds |
price = yield for primary_series (default 10Y).
Feed Data in Context
Each feed is accessible in pipeline functions viactx.feeds:
FeedSnapshot (Engine Level)
At the Engine level, feed data is stored asFeedSnapshot objects:
Feed Staleness
In live mode, the strategy loop checks feed staleness before quoting. If any feed is stale (no update within the threshold), quoting is skipped for that cycle:FeedData.is_stale() method checks staleness:
Engine-Level Feed Management
When using the Engine directly, start feeds withstart_feed():