pub struct PolymarketOrderBuilder { /* private fields */ }Expand description
Builds signed Polymarket orders for submission to the CLOB V2 exchange.
last_timestamp_ms backs a strictly-monotonic millisecond clock so that
bursts of submissions landing in the same wall-clock millisecond still
produce distinct timestamp values (the V2 per-address uniqueness field).
Implementations§
Source§impl PolymarketOrderBuilder
impl PolymarketOrderBuilder
Sourcepub fn new(
order_signer: OrderSigner,
signer_address: String,
maker_address: String,
signature_type: SignatureType,
) -> Self
pub fn new( order_signer: OrderSigner, signer_address: String, maker_address: String, signature_type: SignatureType, ) -> Self
Creates a new PolymarketOrderBuilder.
Sourcepub fn build_limit_order(
&self,
token_id: &str,
side: PolymarketOrderSide,
price: Decimal,
quantity: Decimal,
expiration: &str,
neg_risk: bool,
tick_decimals: u32,
) -> Result<PolymarketOrder>
pub fn build_limit_order( &self, token_id: &str, side: PolymarketOrderSide, price: Decimal, quantity: Decimal, expiration: &str, neg_risk: bool, tick_decimals: u32, ) -> Result<PolymarketOrder>
Builds and signs a limit order for submission.
expiration is a unix-seconds timestamp ("0" for non-GTD orders).
It is carried in the wire body but excluded from the EIP-712 signed hash.
Sourcepub fn build_market_order(
&self,
token_id: &str,
side: PolymarketOrderSide,
price: Decimal,
amount: Decimal,
neg_risk: bool,
tick_decimals: u32,
) -> Result<PolymarketOrder>
pub fn build_market_order( &self, token_id: &str, side: PolymarketOrderSide, price: Decimal, amount: Decimal, neg_risk: bool, tick_decimals: u32, ) -> Result<PolymarketOrder>
Builds and signs a market order for submission.
amount semantics differ by side:
- BUY:
amountis pUSD to spend - SELL:
amountis shares to sell
Market orders never set an expiration.
Sourcepub fn validate_limit_order(order: &OrderAny) -> Result<(), String>
pub fn validate_limit_order(order: &OrderAny) -> Result<(), String>
Validates a limit order before building, returning a denial reason if invalid.
Sourcepub fn validate_market_order(order: &OrderAny) -> Result<(), String>
pub fn validate_market_order(order: &OrderAny) -> Result<(), String>
Validates a market order before building, returning a denial reason if invalid.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PolymarketOrderBuilder
impl RefUnwindSafe for PolymarketOrderBuilder
impl Send for PolymarketOrderBuilder
impl Sync for PolymarketOrderBuilder
impl Unpin for PolymarketOrderBuilder
impl UnsafeUnpin for PolymarketOrderBuilder
impl UnwindSafe for PolymarketOrderBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more