The easiest way to get live crypto prices from Switchboard Surge.
# Clone the repository
git clone https://github.com/you/IAmSurging.git
cd IAmSurging
# Run the setup script (generates feedIds.json, creates .env)
./scripts/setup.sh
# Or for non-interactive setup with defaults
./scripts/setup.sh --quickThe setup script will:
- Check for required dependencies (Node.js 18+)
- Create
.envfrom the template - Generate
feedIds.jsonwith 2,000+ trading pairs from Switchboard - Optionally build the project
# Set API key during setup (for server authentication)
./scripts/setup.sh --api-key your-secret-key
# Use a custom Switchboard API endpoint
./scripts/setup.sh --feeds-api https://custom.api.url/feeds
# Show all options
./scripts/setup.sh --helpcargo install --path .# Get a price (shortcuts work: btc = BTC/USD)
surge btc
# BTC/USD: $89846.94
# Get multiple prices
surge btc eth sol
# BTC/USD: $89846.94
# ETH/USD: $2999.88
# SOL/USD: $129.68
# Stream live prices
surge stream btc eth
# List all 2000+ symbols
surge list
surge list --filter solsurge --json btc eth soluse i_am_surging::get_price;
#[tokio::main]
async fn main() {
let price = get_price("btc").await.unwrap();
println!("Bitcoin: ${:.2}", price.value);
}use i_am_surging::get_prices;
#[tokio::main]
async fn main() {
let prices = get_prices(&["btc", "eth", "sol"]).await.unwrap();
for p in prices {
println!("{}: ${:.2}", p.symbol, p.value);
}
}use i_am_surging::SurgeClient;
#[tokio::main]
async fn main() {
let client = SurgeClient::new().unwrap();
// Shortcuts work
let btc = client.get_price("btc").await.unwrap();
// Full symbols work too
let eth = client.get_price("ETH/USDT").await.unwrap();
}[dependencies]
i-am-surging = { git = "https://github.com/you/IAmSurging" }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }Run as an HTTP/WebSocket API server:
# Start the server
cargo run --bin surge-server
# With authentication enabled
SURGE_API_KEY=your-secret-key cargo run --bin surge-serverSee API.md for full API documentation.
| Variable | Default | Description |
|---|---|---|
SURGE_API_KEY |
- | API key for authentication. If not set, auth is disabled |
SURGE_HOST |
0.0.0.0 |
Server bind address |
SURGE_PORT |
9000 |
Server port |
RUST_LOG |
info |
Log level (trace, debug, info, warn, error) |
# Build the image (requires feedIds.json in project root)
docker build -t surge-server .
# Run with authentication
docker run -p 9000:9000 -e SURGE_API_KEY=your-secret-key surge-server
# Run without authentication (development only)
docker run -p 9000:9000 surge-serverNote: The Docker build requires feedIds.json in the project root. Run ./scripts/setup.sh to generate it automatically.
- You request a price (e.g., "btc")
- Symbol is normalized ("btc" → "BTC/USD")
- Feed ID is looked up from
feedIds.json - Crossbar API returns the oracle price
- You get a reliable, manipulation-resistant price
2,266 trading pairs including:
- Major: BTC, ETH, SOL, BNB, XRP, ADA, DOGE, AVAX, DOT, MATIC
- Stablecoins: USDC, USDT, DAI
- DeFi: UNI, AAVE, LINK, MKR, CRV, LDO
- And 2,200+ more
Run surge list to see all.
MIT
Unofficial project. Not affiliated with Switchboard.