Robinhood offers commission-free crypto trading. Horizon connects to Robinhood’s crypto trading API for spot execution alongside prediction market strategies.
Quick Setup
hz.run(
name="rh_crypto",
exchange=hz.Robinhood(api_key="..."),
mode="live",
...
)
Credentials
Explicit
Environment variables
hz.Robinhood(api_key="rh_xxxxxxxx...")
export ROBINHOOD_API_KEY="rh_xxxxxxxx..."
hz.Robinhood() # reads from env
Robinhood Configuration
@dataclass
class Robinhood:
api_key: str | None = None
api_url: str = "https://trading.robinhood.com/api/v1"
| Field | Default | Description |
|---|
api_key | None | Robinhood API key (env: ROBINHOOD_API_KEY) |
api_url | https://trading.robinhood.com/api/v1 | Override API base URL |
Authentication
Robinhood uses Bearer token auth:
Authorization: Bearer {api_key}
Market Data Feed
Robinhood uses REST polling (no public WebSocket):
hz.run(
feeds={
"btc": hz.RobinhoodFeed(symbols=["BTC-USD"]),
"eth": hz.RobinhoodFeed(symbols=["ETH-USD"], interval=3.0),
},
...
)
The feed polls Robinhood’s quote endpoint at the configured interval for each symbol.
| Field | Type | Default | Description |
|---|
symbols | list[str] | required | Crypto pairs to poll (e.g., ["BTC-USD"]) |
api_key | str | None | Override API key (defaults to env vars) |
interval | float | 5.0 | Polling interval in seconds |
Symbol Mapping
Robinhood uses BASE-QUOTE format for crypto:
market = hz.Market(id="BTC-USD", name="Bitcoin / USD")
| Horizon Field | Robinhood Field | Notes |
|---|
OrderRequest.market_id | symbol | e.g., “BTC-USD”, “ETH-USD” |
OrderRequest.order_side | side | "buy" or "sell" |
OrderRequest.price | limit_price | Limit order price |
OrderRequest.size | quantity | Base currency quantity |
Robinhood uses Side.Long for all positions. Prediction market concepts like Side.Yes / Side.No do not apply to crypto orders.
Multi-Exchange
hz.run(
name="rh_hedge",
exchange=[
hz.Kalshi(), # prediction market
hz.Robinhood(), # crypto hedge
],
feeds={
"btc_event": hz.KalshiBook("KXBTC-25MAR15"),
"btc_spot": hz.RobinhoodFeed(symbols=["BTC-USD"]),
},
pipeline=[my_strategy],
)
Getting API Keys
- Open the Robinhood app or website
- Navigate to Account > Settings > API Trading
- Generate a new API key
- Store the key securely