Skip to content

Commit 49df283

Browse files
committed
fix: remove HistoryFilterParams from fetchOHLCV to fix Python SDK oneOf deserialization error
1 parent 44eb954 commit 49df283

File tree

12 files changed

+24
-50
lines changed

12 files changed

+24
-50
lines changed

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.17.8] - 2026-02-25
6+
7+
### Fixed
8+
9+
- **Python SDK `fetch_ohlcv` deserialization error**: Calling `fetch_ohlcv()` raised `ValueError: Multiple matches found when deserializing... with oneOf schemas: HistoryFilterParams, OHLCVParams` because the OpenAPI spec emitted `oneOf: [OHLCVParams, HistoryFilterParams]` for the `params` argument. Since both schemas are structurally identical in JSON (same four fields, differing only in `resolution` being optional vs. required), pydantic matched both branches and raised an exception. Fixed by removing the deprecated `HistoryFilterParams` union from `fetchOHLCV` in `BaseExchange.ts` and all exchange implementations, then regenerating the OpenAPI spec. The spec now emits only `OHLCVParams` for this parameter. `fetchTrades` is unaffected as its `HistoryFilterParams | TradesParams` union has no structural ambiguity.
10+
511
## [2.17.7] - 2026-02-25
612

713
### Fixed

core/src/BaseExchange.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ export abstract class PredictionMarketExchange {
607607
* @notes Polymarket: outcomeId is the CLOB Token ID. Kalshi: outcomeId is the Market Ticker.
608608
* @notes Resolution options: '1m' | '5m' | '15m' | '1h' | '6h' | '1d'
609609
*/
610-
async fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams): Promise<PriceCandle[]> {
610+
async fetchOHLCV(id: string, params: OHLCVParams): Promise<PriceCandle[]> {
611611
throw new Error("Method fetchOHLCV not implemented.");
612612
}
613613

core/src/exchanges/kalshi/fetchOHLCV.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { HistoryFilterParams, OHLCVParams } from "../../BaseExchange";
1+
import { OHLCVParams } from "../../BaseExchange";
22
import { PriceCandle } from "../../types";
33
import { mapIntervalToKalshi } from "./utils";
44
import { validateIdFormat } from "../../utils/validation";
55
import { kalshiErrorMapper } from "./errors";
66

77
export async function fetchOHLCV(
88
id: string,
9-
params: OHLCVParams | HistoryFilterParams,
9+
params: OHLCVParams,
1010
callApi: (operationId: string, params?: Record<string, any>) => Promise<any>,
1111
): Promise<PriceCandle[]> {
1212
validateIdFormat(id, "OHLCV");

core/src/exchanges/kalshi/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class KalshiExchange extends PredictionMarketExchange {
158158

159159
async fetchOHLCV(
160160
id: string,
161-
params: OHLCVParams | HistoryFilterParams,
161+
params: OHLCVParams,
162162
): Promise<PriceCandle[]> {
163163
return fetchOHLCV(id, params, this.callApi.bind(this));
164164
}

core/src/exchanges/limitless/fetchOHLCV.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HistoryFilterParams, OHLCVParams } from '../../BaseExchange';
1+
import { OHLCVParams } from '../../BaseExchange';
22
import { PriceCandle } from '../../types';
33
import { mapIntervalToFidelity } from './utils';
44
import { validateIdFormat } from '../../utils/validation';
@@ -8,7 +8,7 @@ import { limitlessErrorMapper } from './errors';
88
* Fetch historical price data (candles) for a specific market.
99
* @param id - The market slug
1010
*/
11-
export async function fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>): Promise<PriceCandle[]> {
11+
export async function fetchOHLCV(id: string, params: OHLCVParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>): Promise<PriceCandle[]> {
1212
validateIdFormat(id, 'OHLCV');
1313

1414
// Validate resolution is provided

core/src/exchanges/limitless/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class LimitlessExchange extends PredictionMarketExchange {
139139
return fetchEvents(params, this.callApi.bind(this), this.http);
140140
}
141141

142-
async fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams): Promise<PriceCandle[]> {
142+
async fetchOHLCV(id: string, params: OHLCVParams): Promise<PriceCandle[]> {
143143
return fetchOHLCV(id, params, this.callApi.bind(this));
144144
}
145145

core/src/exchanges/myriad/fetchOHLCV.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OHLCVParams, HistoryFilterParams } from '../../BaseExchange';
1+
import { OHLCVParams } from '../../BaseExchange';
22
import { PriceCandle, CandleInterval } from '../../types';
33
import { myriadErrorMapper } from './errors';
44

@@ -26,7 +26,7 @@ function selectTimeframe(interval: CandleInterval): string {
2626

2727
export async function fetchOHLCV(
2828
id: string,
29-
params: OHLCVParams | HistoryFilterParams,
29+
params: OHLCVParams,
3030
callApi: (operationId: string, params?: Record<string, any>) => Promise<any>
3131
): Promise<PriceCandle[]> {
3232
if (!params.resolution) {

core/src/exchanges/myriad/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class MyriadExchange extends PredictionMarketExchange {
8787
return fetchEvents(params, this.getHeaders(), this.http);
8888
}
8989

90-
async fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams): Promise<PriceCandle[]> {
90+
async fetchOHLCV(id: string, params: OHLCVParams): Promise<PriceCandle[]> {
9191
return fetchOHLCV(id, params, this.callApi.bind(this));
9292
}
9393

core/src/exchanges/polymarket/fetchOHLCV.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HistoryFilterParams, OHLCVParams } from '../../BaseExchange';
1+
import { OHLCVParams } from '../../BaseExchange';
22
import { PriceCandle } from '../../types';
33
import { mapIntervalToFidelity } from './utils';
44
import { validateIdFormat, validateOutcomeId } from '../../utils/validation';
@@ -8,7 +8,7 @@ import { polymarketErrorMapper } from './errors';
88
* Fetch historical price data (OHLCV candles) for a specific token.
99
* @param id - The CLOB token ID (e.g., outcome token ID)
1010
*/
11-
export async function fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>): Promise<PriceCandle[]> {
11+
export async function fetchOHLCV(id: string, params: OHLCVParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>): Promise<PriceCandle[]> {
1212
validateIdFormat(id, 'OHLCV');
1313
validateOutcomeId(id, 'OHLCV');
1414

core/src/exchanges/polymarket/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class PolymarketExchange extends PredictionMarketExchange {
203203
return fetchEvents(params, this.http);
204204
}
205205

206-
async fetchOHLCV(id: string, params: OHLCVParams | HistoryFilterParams): Promise<PriceCandle[]> {
206+
async fetchOHLCV(id: string, params: OHLCVParams): Promise<PriceCandle[]> {
207207
return fetchOHLCV(id, params, this.callApi.bind(this));
208208
}
209209

0 commit comments

Comments
 (0)