Skip to content

SDK drift: fetchOHLCV/fetchTrades crash when called without a params argument in TypeScript; Python's equivalents are fully optional #1556

Description

@realfishsam

Drift

TypeScript's fetchOHLCV/fetchTrades declare params with no default and no ? marker, and immediately dereference it (params.resolution). Calling either method with only the outcome id throws a native TypeError, re-wrapped as a PmxtError. Python's equivalents accept the outcome id alone and work fine, since every other parameter is independently optional with a None default. This is distinct from already-filed #1383/#1425 (which are about the opaque params: any typing style vs. named kwargs) — this issue is about the default-value/optionality gap that causes a runtime crash.

TypeScript SDK

sdks/typescript/pmxt/client.ts:1844-1847 (fetchOHLCV) and :1882-1885 (fetchTrades):

async fetchOHLCV(
    outcomeId: string | MarketOutcome,
    params: any
): Promise<PriceCandle[]> {
async fetchTrades(
    outcomeId: string | MarketOutcome,
    params: any
): Promise<Trade[]> {

client.ts:1851 immediately does const paramsDict: any = { resolution: params.resolution }; — if params is undefined this throws, caught and re-wrapped as PmxtError at client.ts:1868-1869.

Python SDK

sdks/python/pmxt/client.py:2224-2232 (fetch_ohlcv) and :2287-2296 (fetch_trades) — resolution, limit, since, start, end are all independently optional with None defaults; fetch_ohlcv(outcome_id) and fetch_trades(outcome_id) work with zero extra arguments.

Expected

TypeScript's fetchOHLCV/fetchTrades should accept an omitted/undefined params argument without crashing, matching Python's ability to call with only the outcome id.

Impact

Any TypeScript caller doing exchange.fetchOHLCV(outcomeId) or exchange.fetchTrades(outcomeId) gets PmxtError: Failed to fetch OHLCV: TypeError: Cannot read properties of undefined (reading 'resolution') instead of a working call, unlike the equivalent Python call.


Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions