Skip to main content

Module parse

Module parse 

Source
Expand description

Parsing functions for Polymarket execution reports.

Structs§

MarketPriceResult
Result of walking the order book to compute market order parameters.

Functions§

adjust_market_buy_amount
Adjusts a market-BUY pUSD amount to fit within the user’s pUSD balance once platform and builder taker fees are deducted. Mirrors adjust_market_buy_amount in polymarket-rs-clob-client-v2’s clob/utilities.rs.
build_maker_fill_report
Builds a [FillReport] from a PolymarketMakerOrder and trade-level context.
calculate_market_price
Calculates the market-crossing price and expected base quantity by walking the order book.
compute_commission
Computes a pUSD commission using Polymarket’s fee formula.
determine_order_side
Determines the order side for a fill based on trader role and asset matching.
instrument_fee_exponent
Returns the fee-schedule exponent for a Polymarket instrument. Polymarket stores feeSchedule.exponent in the instrument’s info map at parse time. Defaults to 1.0 when missing so the fee curve degenerates to the simple fee = C * rate * p * (1 - p) form used by compute_commission.
instrument_taker_fee
Returns the effective taker fee rate for a Polymarket instrument.
make_composite_trade_id
Creates a composite trade ID bounded to 36 characters.
parse_balance_allowance
Converts a raw micro-pUSD balance from the Polymarket API into an [AccountBalance].
parse_fill_report
Parses a PolymarketTradeReport into a [FillReport].
parse_liquidity_side
Converts a PolymarketLiquiditySide to a Nautilus [LiquiditySide].
parse_order_status_report
Parses a PolymarketOpenOrder into an [OrderStatusReport].
parse_timestamp
Parses a timestamp string into [UnixNanos].
resolve_order_status
Resolves the Nautilus order status from Polymarket status and event type.