Order
This section explains how orders work in the Opinion prediction market, including order types, sides, and amount specifications.
Order Types
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
BUY
OrderSide.BUY
Purchase outcome tokens (predict event occurs)
SELL
OrderSide.SELL
Sell outcome tokens (close position or short)
Post-Only Orders
Post-only orders are limit orders that must add liquidity. Market orders with postOnly throw InvalidParamError. If the order would cross the spread, the system cancels it instead of executing it as a taker, with the comment: post-only order would cross the spread.
const orderData: PlaceOrderDataInput = {
marketId: 57,
tokenId: 'YOUR_TOKEN_ID',
makerAmountInQuoteToken: '100',
price: '0.6',
orderType: OrderType.LIMIT_ORDER,
side: OrderSide.BUY,
postOnly: true,
};
const result = await client.placeOrder(orderData, false);Price
Prices represent implied probability:
Valid range:
0.01to0.99Maximum 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:
makerAmountInQuoteToken
string
Specify USDT to spend/receive
makerAmountInBaseToken
string
Specify exact token quantity
Examples:
BUY order at price
0.60, spending100USDT -> receives ~166.67 tokensSELL order at price
0.60, selling200tokens -> receives 120 USDT
Restrictions
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 submissionUse batch methods for multiple orders to reduce latency
Last updated