import pmxt
from datetime import datetime, timezone
# API key optional — enables faster catalog-backed lookups
exchange = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
)
result = exchange.fetch_ohlcv(
"67890",
resolution="1h",
start=datetime(2026, 1, 1, tzinfo=timezone.utc),
end=datetime(2026, 1, 31, tzinfo=timezone.utc),
limit=10,
){
"success": true,
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
},
"data": [
{
"timestamp": 123,
"open": 123,
"high": 123,
"low": 123,
"close": 123,
"volume": 123
}
]
}Order Book & Trades
Fetch OHLCV
Fetch historical OHLCV (candlestick) price data for a specific market outcome.
GET
/
api
/
{exchange}
/
fetchOHLCV
import pmxt
from datetime import datetime, timezone
# API key optional — enables faster catalog-backed lookups
exchange = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
)
result = exchange.fetch_ohlcv(
"67890",
resolution="1h",
start=datetime(2026, 1, 1, tzinfo=timezone.utc),
end=datetime(2026, 1, 31, tzinfo=timezone.utc),
limit=10,
){
"success": true,
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
},
"data": [
{
"timestamp": 123,
"open": 123,
"high": 123,
"low": 123,
"close": 123,
"volume": 123
}
]
}Hosted and self-hosted data depth — Hosted
api.pmxt.dev calls require a PMXT API key. If you omit the key, SDK calls route through your local pmxt-core process and use venue-native APIs. fetchOHLCV returns normalized PriceCandle rows for venues whose implementation supports fetchOHLCV; history length, volume, and rate limits remain venue-specific. Check Feature Support & Compliance for the current matrix. Get your API key.Use cases
Get hourly candles for a market
import pmxt
# Hosted route: include pmxt_api_key. Omit it for self-hosted/local pmxt-core.
api = pmxt.Polymarket(pmxt_api_key="YOUR_PMXT_API_KEY")
market = api.fetch_market(slug="will-alexandria-ocasio-cortez-win-the-2028-us-presidential-election")
candles = api.fetch_ohlcv(market.yes, resolution="1h", limit=100)
for c in candles:
print(f"{c.open:.2f} {c.high:.2f} {c.low:.2f} {c.close:.2f} V:{c.volume}")
import { Polymarket } from "pmxtjs";
// Hosted route: include pmxtApiKey. Omit it for self-hosted/local pmxt-core.
const api = new Polymarket({ pmxtApiKey: "YOUR_PMXT_API_KEY" });
const market = await api.fetchMarket({ slug: "will-alexandria-ocasio-cortez-win-the-2028-us-presidential-election" });
const candles = await api.fetchOHLCV(market.yes, { resolution: "1h", limit: 100 });
candles.forEach((c) => console.log(`${c.open} ${c.high} ${c.low} ${c.close} V:${c.volume}`));
# First get the outcome ID from a market, then pass it as the outcomeId parameter
curl "https://api.pmxt.dev/api/polymarket/fetchOHLCV?outcomeId=YOUR_OUTCOME_ID&resolution=1h&limit=100" \
-H "Authorization: Bearer $PMXT_API_KEY"
Path Parameters
The prediction market exchange to target.
Available options:
polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us, gemini-titan, hyperliquid, suibets, rain, hunch, router Query Parameters
Required for candle aggregation
Start of the time range
End of the time range
Maximum number of results to return
Response
200 - application/json
Fetch OHLCV response
Example:
true
Structured error envelope returned inside BaseResponse.error and ErrorResponse.error. Hosted-mode endpoints populate code, retryable, and optionally exchange / detail; legacy local-mode endpoints may still return only message.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?

