Skip to content

Commit 9de051e

Browse files
committed
chore: merge latest main and refresh docs for PR #837
2 parents 4e3f70b + d8ff7f1 commit 9de051e

27 files changed

Lines changed: 247 additions & 69 deletions

core/api-doc-config.generated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_generated": "Auto-generated by extract-jsdoc.js on 2026-06-08T08:31:38.004Z. Do not edit manually.",
2+
"_generated": "Auto-generated by extract-jsdoc.js on 2026-06-08T09:58:54.515Z. Do not edit manually.",
33
"methods": {
44
"has": {
55
"summary": "HTTP verb for the endpoint (e.g. GET, POST). */",

core/src/exchanges/gemini-titan/normalizer.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,19 @@ export class GeminiNormalizer implements IExchangeNormalizer<GeminiRawEvent, Gem
213213
// Extract prices
214214
const bestBid = contract.prices?.bestBid ? parseFloat(contract.prices.bestBid) : 0.5;
215215
const bestAsk = contract.prices?.bestAsk ? parseFloat(contract.prices.bestAsk) : 0.5;
216+
const buyYes = contract.prices?.buy?.yes ? parseFloat(contract.prices.buy.yes) : undefined;
217+
const sellYes = contract.prices?.sell?.yes ? parseFloat(contract.prices.sell.yes) : undefined;
218+
const buyNo = contract.prices?.buy?.no ? parseFloat(contract.prices.buy.no) : undefined;
219+
const sellNo = contract.prices?.sell?.no ? parseFloat(contract.prices.sell.no) : undefined;
216220
const lastPrice = contract.prices?.lastTradePrice
217221
? parseFloat(contract.prices.lastTradePrice)
218222
: (bestBid + bestAsk) / 2;
219223

220-
const yesPrice = roundPrice(Math.max(0, Math.min(1, lastPrice)));
221-
const noPrice = roundPrice(Math.max(0, Math.min(1, 1 - yesPrice)));
224+
const yesPriceSource = buyYes ?? sellYes ?? lastPrice;
225+
const noPriceSource = buyNo ?? sellNo ?? (1 - yesPriceSource);
226+
227+
const yesPrice = roundPrice(Math.max(0, Math.min(1, yesPriceSource)));
228+
const noPrice = roundPrice(Math.max(0, Math.min(1, noPriceSource)));
222229

223230
const outcomes: MarketOutcome[] = [
224231
{
@@ -258,7 +265,7 @@ export class GeminiNormalizer implements IExchangeNormalizer<GeminiRawEvent, Gem
258265
outcomes,
259266
resolutionDate,
260267
volume24h: 0,
261-
liquidity: event.liquidity ? parseFloat(event.liquidity) : 0,
268+
liquidity: event.liquidity ? parseFloat(event.liquidity) : (event.volume24h ? parseFloat(event.volume24h) : (event.volume ? parseFloat(event.volume) : 0)),
262269
url: buildExchangeUrl(event.ticker),
263270
category: event.category,
264271
tags,

core/src/exchanges/hyperliquid/normalizer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,13 @@ export class HyperliquidNormalizer implements IExchangeNormalizer<HyperliquidRaw
327327
const bids = rawBids.map(level => ({
328328
price: parseFloat(level.px),
329329
size: parseFloat(level.sz),
330+
orderCount: level.n,
330331
}));
331332

332333
const asks = rawAsks.map(level => ({
333334
price: parseFloat(level.px),
334335
size: parseFloat(level.sz),
336+
orderCount: level.n,
335337
}));
336338

337339
return {

core/src/exchanges/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface FetcherContext {
2020
// happens in a separate layer.
2121
// ----------------------------------------------------------------------------
2222

23-
export interface IExchangeFetcher<TRawMarket = unknown, TRawEvent = unknown> {
23+
export interface IExchangeFetcher<TRawMarket = unknown, TRawEvent = unknown, TRawPositions = unknown[]> {
2424
fetchRawMarkets(params?: MarketFilterParams): Promise<TRawMarket[]>;
2525
fetchRawEvents(params: EventFetchParams): Promise<TRawEvent[]>;
2626

@@ -30,7 +30,7 @@ export interface IExchangeFetcher<TRawMarket = unknown, TRawEvent = unknown> {
3030
fetchRawOrderBook?(id: string): Promise<unknown>;
3131
fetchRawTrades?(id: string, params: TradesParams): Promise<unknown[]>;
3232
fetchRawMyTrades?(params: MyTradesParams, walletAddress: string): Promise<unknown[]>;
33-
fetchRawPositions?(walletAddress: string): Promise<unknown[]>;
33+
fetchRawPositions?(walletAddress: string): Promise<TRawPositions>;
3434
fetchRawBalance?(walletAddress: string): Promise<unknown>;
3535
}
3636

core/src/exchanges/kalshi/fetcher.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export interface KalshiRawMarket {
2323
last_price_dollars?: string;
2424
yes_ask_dollars?: string;
2525
yes_bid_dollars?: string;
26+
yes_ask_size_fp?: string;
27+
yes_bid_size_fp?: string;
2628
rules_primary?: string;
2729
rules_secondary?: string;
2830
expiration_time: string;

core/src/exchanges/kalshi/normalizer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ export class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEvent, Kal
118118
sourceMetadata: buildSourceMetadata(
119119
market as unknown as Record<string, unknown>,
120120
KALSHI_PROMOTED_MARKET_KEYS,
121-
{ series_ticker: event.series_ticker, series_title: event.series_title },
121+
{
122+
yes_ask_size_fp: market.yes_ask_size_fp,
123+
yes_bid_size_fp: market.yes_bid_size_fp,
124+
series_ticker: event.series_ticker,
125+
series_title: event.series_title,
126+
},
122127
),
123128
} as UnifiedMarket;
124129

core/src/exchanges/limitless/fetcher.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export interface LimitlessRawMarket {
1616
description?: string;
1717
tokens?: Record<string, string>;
1818
prices?: number[];
19+
tradePrices?: {
20+
buy?: { market?: number[]; limit?: number[] };
21+
sell?: { market?: number[]; limit?: number[] };
22+
};
1923
expirationTimestamp?: string;
2024
volumeFormatted?: number;
2125
volume?: number;

core/src/exchanges/limitless/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ export function mapMarketToUnified(market: any, context: LimitlessMarketContext
7373
throw new Error(`[limitless] Market "${market.slug}" is missing token addresses`);
7474
}
7575

76-
const prices = Array.isArray(market.prices) ? market.prices : [];
77-
const yesPrice = prices[0] || 0;
78-
const noPrice = prices[1] || 0;
76+
const legacyPrices = Array.isArray(market.prices) ? market.prices : [];
77+
const yesPrice = market.tradePrices?.buy?.market?.[0] ?? legacyPrices[0] ?? 0.5;
78+
const noPrice = market.tradePrices?.sell?.market?.[0] ?? legacyPrices[1] ?? Math.max(0, Math.min(1, 1 - yesPrice));
7979
const yesLabel = hasParentContext ? rawTitle : 'Yes';
8080
const noLabel = hasParentContext ? `Not ${rawTitle}` : 'No';
8181

core/src/exchanges/myriad/normalizer.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ const MYRIAD_PROMOTED_EVENT_KEYS = [
1919
'id', 'title', 'markets',
2020
] as const;
2121

22+
const WEI_SCALE = BigInt('1000000000000000000');
23+
const PRECISION_SCALE = BigInt('1000000000000');
24+
25+
function weiStringToNumber(value: string): number {
26+
const scaled = (BigInt(value) * PRECISION_SCALE) / WEI_SCALE;
27+
return Number(scaled) / Number(PRECISION_SCALE);
28+
}
29+
2230
function selectTimeframe(interval: CandleInterval): string {
2331
switch (interval) {
2432
case '1m':
@@ -213,15 +221,14 @@ export class MyriadNormalizer implements IExchangeNormalizer<MyriadRawMarket, My
213221
}
214222

215223
normalizeClobOrderBook(raw: { bids: [string, string][]; asks: [string, string][] }): OrderBook {
216-
const WEI = 1e18;
217224
return {
218225
bids: raw.bids.map(([priceWei, sizeWei]) => ({
219-
price: Number(priceWei) / WEI,
220-
size: Number(sizeWei) / WEI,
226+
price: weiStringToNumber(priceWei),
227+
size: weiStringToNumber(sizeWei),
221228
})),
222229
asks: raw.asks.map(([priceWei, sizeWei]) => ({
223-
price: Number(priceWei) / WEI,
224-
size: Number(sizeWei) / WEI,
230+
price: weiStringToNumber(priceWei),
231+
size: weiStringToNumber(sizeWei),
225232
})),
226233
timestamp: Date.now(),
227234
};

core/src/exchanges/suibets/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* It is NOT wired into defineImplicitApi — the fetcher calls these endpoints
66
* directly via FetcherContext.http (the rate-limited HTTP client).
77
*
8-
* Base URL: https://suibets.replit.app
8+
* Base URL: https://www.suibets.com
99
*
1010
* Endpoints:
1111
* GET /api/p2p/offers - List open P2P offers (status, matchId, sport, limit, offset)

0 commit comments

Comments
 (0)