Skip to main content

Module models

Module models 

Source

Structs§

Candlestick
OHLCV candlestick, normalized across all exchanges. Prices are decimals (0.0 to 1.0). Timestamp is the period START (not end). Serialized over the wire as RFC3339 (DateTime) for API consistency.
CryptoPrice
Fill
A single fill (trade execution) from a user’s order.
FixedPrice
Fixed-point price representation. 1 tick = 0.0001 (scale factor 10,000). Eliminates f64 comparison issues (no PRICE_EPSILON), enables Ord (no NaN), and uses integer arithmetic (1-5ns vs 20-100ns for f64 ops).
Market
Unified prediction market model.
MarketTrade
Normalized public market trade, suitable for “tape” UIs.
Order
Orderbook
OrderbookSnapshot
A point-in-time L2 orderbook snapshot, used for historical orderbook data.
OutcomeToken
Position
PriceLevel
PriceLevelChange
A single price level change. Absolute replacement semantics: size > 0 = set level to this size, size == 0 = remove level.
PricePoint
PublicTrade
RestPriceLevel
SportResult
Real-time sports score/state from the Polymarket Sports WebSocket. Serializes as snake_case for end-users; aliases accept the upstream camelCase.

Enums§

CryptoPriceSource
LiquidityRole
MarketStatus
Normalized market status across all exchanges.
MarketType
Market type classification.
OrderSide
OrderStatus
OrderType
Order time-in-force / execution type.
OrderbookUpdate
Emitted by exchange WS implementations through OrderbookStream.
PriceHistoryInterval
PriceLevelSide
Bid or ask side. Serializes as “bid”/“ask” on the wire.

Functions§

insert_ask
Insert a price level into an ask-sorted (ascending) list. Uses push + sort_unstable for prediction market books (typically < 100 levels).
insert_bid
Insert a price level into a bid-sorted (descending) list. Uses push + sort_unstable for prediction market books (typically < 100 levels). sort_unstable avoids the allocation of a merge-sort buffer and is faster on small, nearly-sorted arrays than Vec::insert’s O(n) memcpy shift.
sort_asks
Sort price levels in ascending order (lowest price first) – ask side ordering. Uses integer comparison via FixedPrice::Ord (no partial_cmp/NaN handling).
sort_bids
Sort price levels in descending order (highest price first) – bid side ordering. Uses integer comparison via FixedPrice::Ord (no partial_cmp/NaN handling).

Type Aliases§

ChangeVec
Stack-allocated change list. Kalshi = 1 change, Polymarket typically 1-3. Falls back to heap only if > 4 changes in a single update (rare).