The resolution parameter in fetchTrades() is now deprecated and will be removed in v3.0.0.
Why? The resolution parameter only applies to aggregated candle data (OHLCV), not to raw trade events. It was previously ignored by all implementations but required by the type system, causing confusion.
Timeline:
- Current (v2.x.x): Deprecation warning appears when
resolutionis passed tofetchTrades() - v3.0.0: Parameter will be removed entirely
Before (deprecated):
// TypeScript
const trades = await exchange.fetchTrades(outcomeId, {
resolution: '1h', // ⚠️ Deprecated and ignored
limit: 100
});# Python
trades = exchange.fetch_trades(outcome_id, resolution='1h', limit=100) # ⚠️ DeprecatedAfter (correct):
// TypeScript
const trades = await exchange.fetchTrades(outcomeId, {
limit: 100 // ✅ No resolution parameter
});# Python
trades = exchange.fetch_trades(outcome_id, limit=100) # ✅ No resolution parameterNote: fetchOHLCV() still requires the resolution parameter, as it determines candle aggregation intervals.
If you're upgrading from v1.x to v2.0.0, use this checklist to ensure your code is compatible:
- Replace
event.searchMarkets(query)withexchange.filterMarkets(event.markets, query) - Replace all
outcome.idwithoutcome.outcomeId - Replace all
market.idwithmarket.marketId - Python: Remove all parameter wrapper classes (
HistoryFilterParams,MarketFilterParams,EventFetchParams,CreateOrderParams) - Python: Update
create_order()calls to use direct arguments instead ofCreateOrderParams - Python: Update
fetch_markets()andfetch_events()calls to removeparams=argument - Verify all examples use the new unified API (
fetchMarkets,fetchEvents) - Update error handling to use new error classes (if relying on error types)
If you already migrated to the unified API in v1.7.0, you only need to:
- Replace
event.searchMarkets(query)withexchange.filterMarkets(event.markets, query) - Replace
.idwith.outcomeId/.marketId - Python only: Remove all parameter wrapper classes and use direct kwargs/arguments
TypeScript:
// v1.x Code
const events = await poly.fetchEvents({ query: 'Fed Chair' });
const market = events[0].searchMarkets('Kevin Warsh')[0]; // Removed
const outcomeId = market.yes.id; // Removed
// v2.0.0 Code
const events = await poly.fetchEvents({ query: 'Fed Chair' });
const market = poly.filterMarkets(events[0].markets, 'Kevin Warsh')[0]; //
const outcomeId = market.yes.outcomeId; // Python:
# v1.x Code
events = poly.fetch_events(query='Fed Chair')
market = events[0].search_markets('Kevin Warsh')[0] # Removed
outcome_id = market.yes.id # Removed
candles = poly.fetch_ohlcv(outcome_id, pmxt.HistoryFilterParams(resolution='1h', limit=100)) # Removed
order = poly.create_order(pmxt.CreateOrderParams(market_id='...', outcome_id='...', side='buy', type='limit', amount=10, price=0.5)) # Removed
# v2.2.0+ Code
events = poly.fetch_events(query='Fed Chair')
market = events[0].markets.match('Kevin Warsh') #
outcome_id = market.yes.outcome_id #
candles = poly.fetch_ohlcv(outcome_id, resolution='1h', limit=100) #
order = poly.create_order(market_id='...', outcome_id='...', side='buy', type='limit', amount=10, price=0.5) #Run your test suite and look for:
- TypeScript compilation errors about missing properties
- Runtime errors about undefined methods
- Deprecation warnings in console (should be none in v2.0.0)
Consolidated searchMarkets(), getMarketsBySlug(), and searchEvents() into unified fetchMarkets() and fetchEvents() methods that accept optional parameters, following CCXT conventions.
The following methods are now deprecated and will be removed in v2.0:
searchMarkets(query, params)→ UsefetchMarkets({ query, ...params })getMarketsBySlug(slug)→ UsefetchMarkets({ slug })searchEvents(query, params)→ UsefetchEvents({ query, ...params })
Deprecation warnings will appear in the console when using the old methods.
TypeScript:
// OLD (deprecated)
const markets = await exchange.searchMarkets('Trump', { limit: 10 });
const bySlug = await exchange.getMarketsBySlug('fed-chair-2025');
const events = await exchange.searchEvents('Election', { limit: 5 });
// NEW (CCXT-style)
const markets = await exchange.fetchMarkets({ query: 'Trump', limit: 10 });
const bySlug = await exchange.fetchMarkets({ slug: 'fed-chair-2025' });
const events = await exchange.fetchEvents({ query: 'Election', limit: 5 });Python:
# OLD (deprecated)
markets = await exchange.search_markets('Trump', limit=10)
by_slug = await exchange.get_markets_by_slug('fed-chair-2025')
events = await exchange.search_events('Election', limit=5)
# NEW (CCXT-style)
markets = await exchange.fetch_markets(query='Trump', limit=10)
by_slug = await exchange.fetch_markets(slug='fed-chair-2025')
events = await exchange.fetch_events(query='Election', limit=5)- Unified interface: Single method for all market fetching operations
- CCXT compatibility: Familiar API for CCXT users
- Cleaner code: No need to remember different method names for different operations
- Backward compatible: Old methods still work (with warnings) until v2.0
Introduced dedicated filter_markets() and filter_events() methods to replace manual list filtering and unify searching.
Instead of manually filtering lists using list comprehensions or filter(), use the unified methods:
# OLD
warsh = fed_event.search_markets('Kevin Warsh')[0]
# NEW (v2.0.0)
warsh = api.filter_markets(fed_event.markets, "Kevin Warsh")[0]
# NEWER (v2.1.0+)
warsh = fed_event.markets.match("Kevin Warsh")Introduced explicit marketId and outcomeId properties to replace the ambiguous .id property.
IMPORTANT: The deprecated .id fields still exist for backwards compatibility but will be removed in v2.0. Update your code now to use the new fields.
Update your code to use the specific identifiers:
- Markets: Use
market.marketId(TypeScript) ormarket.market_id(Python) instead ofmarket.id - Outcomes: Use
outcome.outcomeId(TypeScript) oroutcome.outcome_id(Python) instead ofoutcome.id
Python:
# OLD (deprecated, will be removed in v2.0)
await poly.fetch_order_book(outcome.id)
# NEW
await poly.fetch_order_book(outcome.outcome_id)TypeScript:
// OLD (deprecated, will be removed in v2.0)
await poly.fetchOrderBook(outcome.id)
// NEW
await poly.fetchOrderBook(outcome.outcomeId)