Order

This section explains how orders work in the Opinion prediction market, including order types, sides, and amount specifications.

Order Types

Type
Enum Value
Description
Price Parameter

Market Order

OrderType.MARKET_ORDER

Execute immediately at best available price

Ignored, price is always "0" for market order.

Limit Order

OrderType.LIMIT_ORDER

Execute only at specified price or better

Required (e.g., "0.50")

Order Sides

Side
Enum Value
Description

BUY

OrderSide.BUY

Purchase outcome tokens (predict event occurs)

SELL

OrderSide.SELL

Sell outcome tokens (close position or short)

Price

Prices represent implied probability:

  • Valid range: 0.01 to 0.99

  • Maximum 4 decimal places

  • "0.50" = 50% probability, costs $0.50 per token, pays $1.00 if correct

Amount Specifications

You must specify exactly one of:

Parameter
Type
Usage

makerAmountInQuoteToken

string

Specify USDT to spend/receive

makerAmountInBaseToken

string

Specify exact token quantity

Examples:

  • BUY order at price 0.60, spending 100 USDT -> receives ~166.67 tokens

  • SELL order at price 0.60, selling 200 tokens -> receives 120 USDT

Restrictions

Side
Order Type
Allowed Amount

BUY

Market

makerAmountInQuoteToken only

SELL

Market

makerAmountInBaseToken only

BUY

Limit

Either

SELL

Limit

Either

Placing Orders

Cancelling Orders

Batch Operations

Note: The placeOrdersBatch method accepts an optional second parameter checkApproval (default false). When set to true, it calls enableTrading() once before placing any orders.

Best Practices

  • Review orderbook before placing market orders to assess slippage

  • Break large orders into smaller limit orders to minimize market impact

  • Validate price is within [0.01, 0.99] range before submission

  • Use batch methods for multiple orders to reduce latency

Last updated