been using polygon.io as primary data source since 2023.
added iex cloud as backup last year.
here’s how they compare for algo trading.
polygon.io (primary) #
what I use it for:
- real-time equity data
- options chains and greeks
- historical tick data for backtesting
pricing: $199/month unlimited
pros:
- websocket streaming is solid
- options data is comprehensive
- tick-level historical goes back years
- api is well documented
cons:
- occasional gaps during high volatility
- options greeks can lag 15-30 seconds
- customer support is slow
import asyncio
from polygon import WebSocketClient, STOCKS_CLUSTER
class PolygonDataHandler:
def __init__(self, api_key: str):
self.api_key = api_key
self.client = None
self.last_quote = {}
async def connect(self):
self.client = WebSocketClient(
STOCKS_CLUSTER,
self.api_key,
self.process_message
)
await self.client.connect()
async def process_message(self, messages: list):
for msg in messages:
if msg.get('ev') == 'Q': # quote
symbol = msg.get('sym')
self.last_quote[symbol] = {
'bid': msg.get('bp'),
'ask': msg.get('ap'),
'bid_size': msg.get('bs'),
'ask_size': msg.get('as'),
'timestamp': msg.get('t')
}
async def subscribe(self, symbols: list[str]):
await self.client.subscribe(['Q.' + s for s in symbols])
iex cloud (backup) #
what I use it for:
- backup real-time quotes
- fundamental data
- earnings calendar
pricing: $99/month (grow plan)
pros:
- more stable during volatility
- fundamental data is excellent
- earnings calendar with surprises
- faster customer support
cons:
- no tick-level historical
- options data is limited
- quote depth not as good
import aiohttp
from typing import Optional
class IEXCloudClient:
BASE_URL = "https://cloud.iexapis.com/stable"
def __init__(self, api_key: str):
self.api_key = api_key
self.session: Optional[aiohttp.ClientSession] = None
async def __aenter__(self):
self.session = aiohttp.ClientSession()
return self
async def __aexit__(self, *args):
if self.session:
await self.session.close()
async def get_quote(self, symbol: str) -> dict:
url = f"{self.BASE_URL}/stock/{symbol}/quote"
params = {'token': self.api_key}
async with self.session.get(url, params=params) as resp:
if resp.status == 200:
return await resp.json()
return {}
async def get_earnings_calendar(self, symbol: str) -> list:
url = f"{self.BASE_URL}/stock/{symbol}/earnings"
params = {'token': self.api_key, 'period': 'quarterly'}
async with self.session.get(url, params=params) as resp:
if resp.status == 200:
return await resp.json()
return []
head-to-head comparison #
| feature | polygon | iex cloud |
|---|---|---|
| real-time latency | 10-15ms | 20-30ms |
| options data | excellent | limited |
| tick historical | yes | no |
| fundamentals | basic | excellent |
| stability | good | better |
| price | $199/mo | $99/mo |
my setup #
primary (polygon): all real-time trading data, options chains
backup (iex): failover quotes, earnings calendar, fundamentals
class DataFeedManager:
def __init__(self, polygon_key: str, iex_key: str):
self.polygon = PolygonDataHandler(polygon_key)
self.iex = IEXCloudClient(iex_key)
self.primary_healthy = True
async def get_quote(self, symbol: str) -> dict:
if self.primary_healthy:
try:
quote = self.polygon.last_quote.get(symbol)
if quote and self._is_fresh(quote['timestamp']):
return quote
except Exception:
self.primary_healthy = False
# fallback to IEX
return await self.iex.get_quote(symbol)
def _is_fresh(self, timestamp: int, max_age_ms: int = 5000) -> bool:
import time
current_ms = int(time.time() * 1000)
return (current_ms - timestamp) < max_age_ms
verdict #
if I could only pick one: polygon.io
options data is non-negotiable for my strategies.
optimal setup: both
polygon primary, iex backup.
$298/month total. cheap insurance.
the NexusFi trading reviews section has more detailed comparisons of various data providers if you’re shopping around.
3:12am thursday. polygon.io vs iex cloud after 2 years using both. polygon wins for options data and tick history ($199/mo). iex wins for fundamentals and stability ($99/mo). optimal: use both. polygon primary, iex failover. $298/mo total, cheap insurance for redundancy.
-AK