From f3a30ec4b49f078ef95595787252469e56943d9e Mon Sep 17 00:00:00 2001 From: Zihao Xue Date: Sun, 22 Mar 2026 14:12:47 -0700 Subject: [PATCH 1/4] refactor: handle error in fetch_order_book() in the same way --- sdks/python/pmxt/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdks/python/pmxt/client.py b/sdks/python/pmxt/client.py index 835ade4..0c468fc 100644 --- a/sdks/python/pmxt/client.py +++ b/sdks/python/pmxt/client.py @@ -622,6 +622,9 @@ def fetch_order_book(self, id: str) -> OrderBook: data = self._handle_response(json.loads(response.data)) return _convert_order_book(data) except Exception as e: + from pmxt.errors import OrderNotFound + if isinstance(e, OrderNotFound): + return OrderBook(bids=[], asks=[]) raise self._parse_api_exception(e) from None def cancel_order(self, order_id: str) -> Order: From ad31ed0e58fb09e4d82df3f85ecd3242aca9bec1 Mon Sep 17 00:00:00 2001 From: Zihao Xue Date: Sun, 22 Mar 2026 14:49:33 -0700 Subject: [PATCH 2/4] refactor: add 'watchAddress' into SKIP_GENERATE --- sdks/python/scripts/generate-client-methods.js | 1 + sdks/typescript/scripts/generate-client-methods.js | 1 + 2 files changed, 2 insertions(+) diff --git a/sdks/python/scripts/generate-client-methods.js b/sdks/python/scripts/generate-client-methods.js index 62b1343..51b0d5c 100644 --- a/sdks/python/scripts/generate-client-methods.js +++ b/sdks/python/scripts/generate-client-methods.js @@ -34,6 +34,7 @@ const SKIP_GENERATE = new Set([ 'fetchTrades', // special parameter handling 'watchOrderBook', // streaming 'watchTrades', // streaming + 'watchAddress', // streaming 'createOrder', // outcome shorthand logic 'buildOrder', // complex args format 'submitOrder', // complex args format diff --git a/sdks/typescript/scripts/generate-client-methods.js b/sdks/typescript/scripts/generate-client-methods.js index 60765c4..3ff8d83 100644 --- a/sdks/typescript/scripts/generate-client-methods.js +++ b/sdks/typescript/scripts/generate-client-methods.js @@ -33,6 +33,7 @@ const SKIP_GENERATE = new Set([ 'fetchTrades', // resolution parameter handling 'watchOrderBook', // streaming 'watchTrades', // streaming + 'watchAddress', // streaming 'createOrder', // outcome shorthand logic 'buildOrder', // complex args format, returns BuiltOrder 'getExecutionPrice', // delegates to getExecutionPriceDetailed From d5a820ed8032bbcc038a858789809eccc80712da Mon Sep 17 00:00:00 2001 From: "Samuel EF. Tinnerholm" Date: Mon, 23 Mar 2026 09:19:32 +0200 Subject: [PATCH 3/4] Revert "refactor: handle error in fetch_order_book() in the same way" This reverts commit f3a30ec4b49f078ef95595787252469e56943d9e. --- sdks/python/pmxt/client.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdks/python/pmxt/client.py b/sdks/python/pmxt/client.py index 0c468fc..835ade4 100644 --- a/sdks/python/pmxt/client.py +++ b/sdks/python/pmxt/client.py @@ -622,9 +622,6 @@ def fetch_order_book(self, id: str) -> OrderBook: data = self._handle_response(json.loads(response.data)) return _convert_order_book(data) except Exception as e: - from pmxt.errors import OrderNotFound - if isinstance(e, OrderNotFound): - return OrderBook(bids=[], asks=[]) raise self._parse_api_exception(e) from None def cancel_order(self, order_id: str) -> Order: From 4c71a18403eebb8e919f20bd319bfa4f1f73c2e3 Mon Sep 17 00:00:00 2001 From: "Samuel EF. Tinnerholm" Date: Mon, 23 Mar 2026 09:22:48 +0200 Subject: [PATCH 4/4] fix: throw errors for non-existing orderbooks across all exchanges Closes #66 --- core/src/exchanges/baozi/normalizer.ts | 5 +++-- core/src/exchanges/kalshi/fetcher.ts | 5 +++++ core/src/exchanges/limitless/fetcher.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/exchanges/baozi/normalizer.ts b/core/src/exchanges/baozi/normalizer.ts index 6afc42f..fdb24c4 100644 --- a/core/src/exchanges/baozi/normalizer.ts +++ b/core/src/exchanges/baozi/normalizer.ts @@ -1,5 +1,6 @@ import { MarketFetchParams } from '../../BaseExchange'; import { UnifiedMarket, UnifiedEvent, PriceCandle, OrderBook, Trade, Position, Balance } from '../../types'; +import { NotFound } from '../../errors'; import { IExchangeNormalizer } from '../interfaces'; import { LAMPORTS_PER_SOL, @@ -88,12 +89,12 @@ export class BaoziNormalizer implements IExchangeNormalizer o.outcomeId === outcomeId); diff --git a/core/src/exchanges/kalshi/fetcher.ts b/core/src/exchanges/kalshi/fetcher.ts index 1922424..f4746a6 100644 --- a/core/src/exchanges/kalshi/fetcher.ts +++ b/core/src/exchanges/kalshi/fetcher.ts @@ -1,6 +1,7 @@ import { MarketFilterParams, EventFetchParams, OHLCVParams, TradesParams, MyTradesParams } from '../../BaseExchange'; import { IExchangeFetcher, FetcherContext } from '../interfaces'; import { kalshiErrorMapper } from './errors'; +import { NotFound } from '../../errors'; import { validateIdFormat } from '../../utils/validation'; import { mapIntervalToKalshi } from './utils'; @@ -253,6 +254,10 @@ export class KalshiFetcher implements IExchangeFetcher