Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/src/exchanges/baozi/normalizer.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -88,12 +89,12 @@ export class BaoziNormalizer implements IExchangeNormalizer<BaoziRawMarket, Baoz

normalizeOrderBook(raw: BaoziRawMarket | null, outcomeId: string): OrderBook {
if (!raw) {
throw new Error(`Market not found for outcome: ${outcomeId}`);
throw new NotFound(`Market not found for outcome: ${outcomeId}`, 'Baozi');
}

const market = this.normalizeMarket(raw);
if (!market) {
throw new Error(`Could not parse market for outcome: ${outcomeId}`);
throw new NotFound(`Could not parse market for outcome: ${outcomeId}`, 'Baozi');
}

const outcome = market.outcomes.find(o => o.outcomeId === outcomeId);
Expand Down
5 changes: 5 additions & 0 deletions core/src/exchanges/kalshi/fetcher.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -253,6 +254,10 @@ export class KalshiFetcher implements IExchangeFetcher<KalshiRawEvent, KalshiRaw
validateIdFormat(id, 'OrderBook');
const ticker = id.replace(/-NO$/, '');
const data = await this.ctx.callApi('GetMarketOrderbook', { ticker });
const book = data.orderbook_fp;
if (!book || (!book.yes_dollars?.length && !book.no_dollars?.length)) {
throw new NotFound(`Order book not found: ${id}`, 'Kalshi');
}
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/exchanges/limitless/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class LimitlessFetcher implements IExchangeFetcher<LimitlessRawMarket, Li
timestamp: data.timestamp,
};
} catch (error: any) {
return { bids: [], asks: [] };
throw limitlessErrorMapper.mapError(error);
}
}

Expand Down
1 change: 1 addition & 0 deletions sdks/python/scripts/generate-client-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sdks/typescript/scripts/generate-client-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading