Skip to content

PolymarketUS price/config helpers (roundToTickSize, toLongSidePrice, toAmount, tick-size constants) are public core exports absent from both SDKs #2102

Description

@realfishsam

Gap

core/src/exchanges/polymarket_us/price.ts and config.ts export a set of price-conversion helpers and venue constants that are re-exported all the way to the core package's public entry point. Neither SDK exports any of them, so an SDK user working with PolymarketUS's long/short price convention has to reimplement the conversions by hand.

Core

Publicly exported, via export * from './price' and export * from './config' at core/src/exchanges/polymarket_us/index.ts:57-58, which is itself re-exported by core/src/index.ts:17 (export * from './exchanges/polymarket_us'):

core/src/exchanges/polymarket_us/price.ts

Export line Signature / value
POLYMARKET_US_MIN_PRICE :17 0.01
POLYMARKET_US_MAX_PRICE :18 0.99
POLYMARKET_US_TICK_SIZE :25 0.001
POLYMARKET_US_PRICE_DECIMALS :31 3
POLYMARKET_US_CURRENCY :32 'USD'
roundToTickSize :48 rounds a price to the venue tick
validatePriceBounds :63 (price: number) => void, throws outside min/max
toLongSidePrice :92 (intent: OrderIntent, userPrice: number) => number
fromLongSidePrice :112 inverse of the above
toAmount :136 user amount → venue Amount
fromAmount :157 (amount: Amount | undefined) => number

core/src/exchanges/polymarket_us/config.ts

Export line
POLYMARKET_US_API_BASE_URL :10
POLYMARKET_US_GATEWAY_BASE_URL :11
PolymarketUSConfig (interface) :15
getPolymarketUSConfig :25

These are not underscore-prefixed, not marked internal, and are consumed by the exchange's own buildOrder (core/src/exchanges/polymarket_us/index.ts:374, via the imports at :50-55).

TypeScript SDK

Missing — sdks/typescript/index.ts exports no PolymarketUS helper or constant. The PolymarketUS/Polymarket_us class (sdks/typescript/pmxt/client.ts:3602-3609) is the only PolymarketUS surface.

Python SDK

Missing — sdks/python/pmxt/__init__.py exports no equivalent. The PolymarketUS/Polymarket_us class (sdks/python/pmxt/_exchanges.py:460) is the only PolymarketUS surface.

Evidence

grep -n "polymarket_us" core/src/index.ts returns 17:export * from './exchanges/polymarket_us';, confirming the helpers reach the core package's public API. Grepping either SDK for roundToTickSize, toLongSidePrice, toAmount, POLYMARKET_US_TICK_SIZE, or getPolymarketUSConfig returns zero matches.

Same class of gap as #2043 (addBinaryOutcomes, used by every normalizer, not exported from core or either SDK) and #2046 (MAX_TRADES_LIMIT not exported by either SDK) — a public core helper with no SDK counterpart.

Impact

PolymarketUS is the only venue in the catalog that expresses every order in long-side price terms with :long/:short outcome id suffixes (core/src/exchanges/polymarket_us/index.ts:283). An SDK user doing pre-trade math — checking whether a price is inside the tradeable band, snapping a computed price to the venue tick before submitting, or converting a displayed short-side price to the long-side value the venue actually stores — must hardcode 0.01/0.99/0.001 and reimplement toLongSidePrice/fromLongSidePrice from scratch, with no compile-time link to core if the venue changes them. Note #521 already tracks a pending breaking change to the hardcoded tick size, which would silently desynchronize every such reimplementation.


Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions