Skip to content

Response drift: limitless — tradePrices.buy/sell directional pricing not extracted #799

@realfishsam

Description

@realfishsam

Exchange

limitless

Severity

MEDIUM

What Our Normalizer Expects

core/src/exchanges/limitless/normalizer.ts reads raw.prices (a 2-element [yesPrice, noPrice] float array) for outcome pricing. No access to tradePrices is present.

// utils.ts ~lines 51-54
const [yesPrice, noPrice] = raw.prices ?? [0.5, 0.5];

What The Live API Returns

The live /markets/active endpoint now exposes richer directional pricing under tradePrices in addition to the legacy prices[] array:

data[].prices[]: float                         ← still present, extracted
data[].tradePrices.buy.market[]: float         ← NEW, not extracted
data[].tradePrices.buy.limit[]: float          ← NEW, not extracted
data[].tradePrices.sell.market[]: float        ← NEW, not extracted
data[].tradePrices.sell.limit[]: float         ← NEW, not extracted

Endpoint tested: GET https://api.limitless.exchange/markets/active?limit=2

Impact

MEDIUM: prices[] is still present so existing normalizer logic works without crashing. However, tradePrices exposes executable market-order and limit-order prices for each direction — more accurate than the single mid-price in prices[] for order placement UI and spread calculation. The prices[] array likely represents mid prices.

Suggested Fix

Extend the market shape to surface the directional prices from tradePrices:

// In LimitlessRawMarket interface
tradePrices?: {
  buy:  { market: number[]; limit: number[] };
  sell: { market: number[]; limit: number[] };
};
// In normalizer, prefer tradePrices for buy/sell prices when available

Found by automated response shape drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    response-driftLive API response shape differs from normalizer expectations

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions