Skip to Content
APIGetting started

Getting Started with StockAPIS

StockAPIS gives you real-time and historical market data from 80+ crypto exchanges, stock markets, brokers, data providers and news sources through one unified REST API — this guide gets you from zero to your first request in about 5 minutes.

This guide walks you through making your first API call and pulling market data from Binance, Coinbase, NYSE, Bloomberg and other sources on a single normalized schema.

Prerequisites

Before you begin, you will need:

  • StockAPIS account — sign up free (no credit card required)
  • Development environment — Python 3.7+, Node.js 14+, or any HTTP client
  • Basic knowledge — familiarity with REST APIs and JSON

Time required: ~5 minutes.

Step 1: Create Account and Get API Key

Create your account

  1. Visit stockapis.com/signup
  2. Enter your email and create a password
  3. Verify your email address
  4. A free trial starts automatically

Generate an API key

  1. Log in to your dashboard
  2. Open the API Keys section
  3. Click Generate New Key
  4. Copy your API key (keep it secret)

Your API key is like a password — never share it publicly or commit it to version control. Store it in an environment variable:

export STOCKAPIS_API_KEY="your_api_key_here"

Step 2: Install the SDK (optional)

# Python pip install stockapis # JavaScript npm install stockapis

Or call the REST API directly with any HTTP client.

Step 3: Make Your First Request

Python

from stockapis import StockAPIS client = StockAPIS(api_key="your_api_key") # Real-time ticker for a Binance pair btc = client.binance.get_market_data(symbol="BTCUSDT") print(f"Symbol: {btc['symbol']}") print(f"Price: ${btc['lastPrice']}") print(f"24h vol: {btc['volume']}") print(f"24h chg: {btc['priceChangePercent']}%")

JavaScript

const { StockAPIS } = require('stockapis'); const client = new StockAPIS({ apiKey: 'your_api_key' }); client.binance.getMarketData({ symbol: 'BTCUSDT' }) .then(t => { console.log(`Price: $${t.lastPrice}`); console.log(`24h change: ${t.priceChangePercent}%`); }) .catch(err => console.error('Error:', err));

REST

curl -X GET \ 'https://api.stockapis.com/v1/binance/ticker?symbol=BTCUSDT' \ -H 'Authorization: Bearer YOUR_API_KEY'

Response

{ "symbol": "BTCUSDT", "lastPrice": "45000.00", "priceChangePercent": "2.85", "bidPrice": "44999.50", "askPrice": "45000.50", "highPrice": "45200.00", "lowPrice": "43600.00", "volume": "1250.5", "quoteVolume": "56272500.00", "openTime": 1640995200000, "closeTime": 1641081600000 }

Step 4: Pull More Market Data

Order book and trades

# Live order book (top 100 levels) book = client.binance.get_order_book(symbol="BTCUSDT", limit=100) print(book["bids"][0], book["asks"][0]) # Recent trades trades = client.binance.get_recent_trades(symbol="BTCUSDT", limit=50)

Historical candles (OHLCV)

candles = client.binance.get_klines( symbol="BTCUSDT", interval="1h", limit=100, ) for c in candles[:3]: print(c["openTime"], c["open"], c["high"], c["low"], c["close"], c["volume"])

Because every source is normalized to the same schema, the same calls work across exchanges — swap client.binance for client.coinbase or client.kraken.

Error Handling

from stockapis import StockAPIS, APIError client = StockAPIS(api_key="your_api_key") try: btc = client.binance.get_market_data(symbol="BTCUSDT") print(btc["lastPrice"]) except APIError as e: if e.status_code == 404: print("Symbol not found") elif e.status_code == 429: print("Rate limit exceeded") else: print(f"API error: {e}")

Rate Limits

PlanRequests / minute
Starter100
Professional500
Enterprise2000

Check your current usage in the dashboard.

Supported Sources

StockAPIS covers 80+ financial data sources, grouped by asset type:

Browse all platforms.

Next Steps

Get Started Now

  1. Sign up for a free trial at stockapis.com/signup
  2. Generate your API key
  3. Make your first request (Step 3 above)
  4. Build your application

Ready to pull market data at scale? Start your free trial at stockapis.com/signup.

Last updated on