StockAPIS for Developers
Ship faster with one REST API that normalizes prices, OHLCV, order books, news and sentiment across Binance, Coinbase, NYSE, Polygon and 80+ other financial sources into a single schema.
Key Benefits
- One Integration: Replace dozens of exchange and vendor SDKs with a single client
- Unified Schema: Same fields for crypto, equities and FX — no per-source mapping
- Real-Time and Historical: Live quotes plus deep OHLCV and tick history
- Built-In Failover: Auto-fallback across providers when an upstream is down
- Predictable Limits: One rate-limit and one billing model instead of many
Use Cases
Cross-Exchange Price Aggregation
Pull a normalized quote for the same asset across multiple crypto exchanges:
from stockapis import StockAPIS
api = StockAPIS(api_key='your_api_key')
def best_bid_ask(symbol, exchanges):
quotes = []
for exchange in exchanges:
q = api.platforms.crypto_exchanges.get_ticker(
exchange=exchange,
symbol=symbol
)
quotes.append({
'exchange': exchange,
'bid': q.bid,
'ask': q.ask,
'volume_24h': q.volume_24h
})
best_bid = max(quotes, key=lambda x: x['bid'])
best_ask = min(quotes, key=lambda x: x['ask'])
spread = best_ask['ask'] - best_bid['bid']
print(f"Best Bid: {best_bid['bid']} ({best_bid['exchange']})")
print(f"Best Ask: {best_ask['ask']} ({best_ask['exchange']})")
print(f"Cross-Exchange Spread: {spread:.2f}")
return quotes
best_bid_ask('BTC-USD', ['binance', 'coinbase', 'kraken'])OHLCV and Historical Candles
Fetch normalized candles for backtesting from financial data APIs:
def load_candles(symbol, interval='1h', limit=500):
candles = api.platforms.financial_data_apis.get_ohlcv(
source='polygon',
symbol=symbol,
interval=interval,
limit=limit
)
closes = [c.close for c in candles]
highest = max(c.high for c in candles)
lowest = min(c.low for c in candles)
print(f"OHLCV - {symbol} ({interval})")
print(f"Candles: {len(candles)}")
print(f"Period High: {highest}")
print(f"Period Low: {lowest}")
print(f"Last Close: {closes[-1]}")
return candlesOrder Book Depth
Snapshot the live order book from a single crypto exchange:
def order_book_imbalance(symbol, depth=20):
book = api.platforms.crypto_exchanges.get_order_book(
exchange='binance',
symbol=symbol,
depth=depth
)
bid_volume = sum(level.size for level in book.bids)
ask_volume = sum(level.size for level in book.asks)
imbalance = bid_volume / (bid_volume + ask_volume)
print(f"Order Book - {symbol}")
print(f"Top Bid: {book.bids[0].price} x {book.bids[0].size}")
print(f"Top Ask: {book.asks[0].price} x {book.asks[0].size}")
print(f"Bid/Ask Imbalance: {imbalance:.1%}")
if imbalance > 0.6:
print("→ Buy-side pressure")
elif imbalance < 0.4:
print("→ Sell-side pressure")
return bookUnified Equities and Crypto
Query stock exchanges and crypto through the same call shape:
def get_quotes(symbols):
results = []
for sym in symbols:
q = api.quote(symbol=sym) # routes to the right source automatically
results.append({
'symbol': sym,
'asset_class': q.asset_class,
'price': q.price,
'change_pct': q.change_pct
})
print("Unified Quotes:")
for r in results:
print(f" {r['symbol']:10} [{r['asset_class']:7}] "
f"{r['price']:>12,.2f} {r['change_pct']:+.2f}%")
return results
# Equities and crypto in one list — no per-source code
get_quotes(['AAPL', 'BTC-USD', 'TSLA', 'ETH-USD'])News and Sentiment Signals
Combine financial news headlines with social signals for an asset:
def signal_digest(symbol):
news = api.platforms.financial_news.search(
sources=['bloomberg', 'reuters'],
symbol=symbol,
published_in_last_hours=24
)
sentiment = api.platforms.social_signals.get_sentiment(
symbol=symbol,
window='24h'
)
print(f"Signal Digest - {symbol}")
print(f"Headlines (24h): {len(news)}")
print(f"Social Sentiment: {sentiment.score:+.2f} "
f"({sentiment.label})")
print(f"Mentions: {sentiment.mentions:,}")
print("\nTop Headlines:")
for item in news[:3]:
print(f" [{item.source}] {item.title}")
return news, sentimentQuick Start
from stockapis import StockAPIS
api = StockAPIS(api_key='your_api_key')
# One call, normalized across every source
ticker = api.platforms.crypto_exchanges.get_ticker(
exchange='binance',
symbol='BTC-USD'
)
print(f"Price: {ticker.last:,.2f}")
print(f"24h Change: {ticker.change_pct:+.2f}%")
print(f"24h Volume: {ticker.volume_24h:,.0f}")
print(f"Bid/Ask: {ticker.bid:,.2f} / {ticker.ask:,.2f}")Browse every supported source on the platforms page, follow the API getting-started guide, or contact us about plans on the pricing page.