Skip to content

Exchanges

StratEvo supports 12 exchange adapters across crypto, US equities, and China A-shares. All adapters implement a common interface: get_ticker(), get_ohlcv(), and market-specific methods.


Exchange Overview

Exchange Type Module Auth Required WebSocket
Yahoo Finance US/Global Stocks yahoo_finance No No
Polygon US Stocks polygon Yes (API key) No
Alpha Vantage US/Global Stocks alpha_vantage Yes (API key) No
AkShare China A-Shares akshare_adapter No No
BaoStock China A-Shares baostock_adapter No No
Tushare China A-Shares tushare_adapter Yes (token) No
Binance Crypto binance Yes (API key) Yes
Bybit Crypto bybit Yes (API key) Yes
OKX Crypto okx Yes (API key) Yes
Coinbase Crypto coinbase Yes (API key) No
Kraken Crypto kraken Yes (API key) No
Alpaca US Stocks alpaca Yes (API key) No

US / Global Stock Exchanges

Yahoo Finance (Default)

No API key required. Best for getting started.

from stratevo.exchanges.registry import ExchangeRegistry

yahoo = ExchangeRegistry.get("yahoo")
quote = yahoo.get_ticker("AAPL")
candles = yahoo.get_ohlcv("AAPL", "1d", limit=50)
# CLI
python stratevo.py signal --ticker AAPL --strategy momentum

Polygon

High-quality US market data. Free tier available at polygon.io.

Setup:

export POLYGON_API_KEY="your_key_here"
polygon = ExchangeRegistry.get("polygon")
quote = polygon.get_ticker("MSFT")

Alpha Vantage

Free tier: 25 requests/day. Get a key at alphavantage.co.

export ALPHA_VANTAGE_API_KEY="your_key_here"
av = ExchangeRegistry.get("alpha_vantage")
quote = av.get_ticker("GOOGL")

Alpaca

Paper and live trading via alpaca.markets.

export ALPACA_API_KEY="your_key"
export ALPACA_SECRET_KEY="your_secret"
export ALPACA_BASE_URL="https://paper-api.alpaca.markets"  # paper trading

China A-Shares

AkShare

Open-source China market data. No API key needed.

akshare = ExchangeRegistry.get("akshare")
quote = akshare.get_ticker("000001.SZ")  # Ping An Bank
candles = akshare.get_ohlcv("600519.SH", "1d", limit=100)  # Moutai
python stratevo.py scan --market china --style buffett

BaoStock

Another free China data source with good historical coverage.

baostock = ExchangeRegistry.get("baostock")
candles = baostock.get_ohlcv("sh.600000", "1d", limit=200)

Tushare

Professional China market data. Get a token at tushare.pro.

export TUSHARE_TOKEN="your_token_here"
tushare = ExchangeRegistry.get("tushare")
quote = tushare.get_ticker("000001.SZ")

Crypto Exchanges

Binance

The largest crypto exchange by volume. Supports WebSocket streaming.

export BINANCE_API_KEY="your_key"
export BINANCE_API_SECRET="your_secret"
binance = ExchangeRegistry.get("binance")
quote = binance.get_ticker("BTCUSDT")
candles = binance.get_ohlcv("ETHUSDT", "1h", limit=100)

WebSocket streaming:

from stratevo.exchanges.binance_ws import BinanceWebSocket

ws = BinanceWebSocket()
ws.subscribe("BTCUSDT", callback=on_tick)
ws.start()

Bybit

Derivatives-focused exchange with WebSocket support.

export BYBIT_API_KEY="your_key"
export BYBIT_API_SECRET="your_secret"
bybit = ExchangeRegistry.get("bybit")
quote = bybit.get_ticker("BTCUSDT")

OKX

Full-featured crypto exchange with WebSocket.

export OKX_API_KEY="your_key"
export OKX_API_SECRET="your_secret"
export OKX_PASSPHRASE="your_passphrase"
okx = ExchangeRegistry.get("okx")
quote = okx.get_ticker("BTC-USDT")

Coinbase

US-regulated crypto exchange.

export COINBASE_API_KEY="your_key"
export COINBASE_API_SECRET="your_secret"

Kraken

European crypto exchange with strong security reputation.

export KRAKEN_API_KEY="your_key"
export KRAKEN_API_SECRET="your_secret"

Data Aggregator

Combine multiple sources for resilience and quality:

from stratevo.exchanges.data_aggregator import DataAggregator

agg = DataAggregator(sources=["yahoo", "polygon", "alpha_vantage"])
quote = agg.get_best_quote("AAPL")  # Uses the freshest available

Exchange Registry

List all available exchanges programmatically:

from stratevo.exchanges.registry import ExchangeRegistry

# List by type
ExchangeRegistry.list_by_type("crypto")    # ['binance', 'bybit', 'okx', ...]
ExchangeRegistry.list_by_type("stock_us")  # ['yahoo', 'polygon', ...]
ExchangeRegistry.list_by_type("stock_cn")  # ['akshare', 'baostock', ...]

Adding a New Exchange

See Plugins → Exchange Plugins for how to create custom exchange adapters.