Skip to main content

OrderArgs

Arguments for creating a new order. This is the input type you use when building an order.
market_id
str
required
Unique identifier for the market (hex string)
side
Side
required
Order side: Side.BUY (0) or Side.SELL (1)
outcome
Outcome
required
Market outcome: Outcome.YES (0) or Outcome.NO (1)
price
int
required
Price scaled by 1e6 (0 to 1,000,000). For example, 500,000 = 50% = $0.50Valid range: 1 to 999,999
size
int
required
Order size in 6 decimals. For example, 1,000,000 = 1 shareMust be positive. For taker orders (orders that fill immediately), size × price must be ≥ $1 USDC.
expiration
int
required
Unix timestamp when the order expiresMust be positive and in the future.
nonce
int
default:"0"
Order nonce for replay protection. Auto-generated if 0.
maker_fee_recipient
str
default:"0x0000000000000000000000000000000000000000"
Address to receive maker fees (typically left as zero address)

Example

from turbine_client import OrderArgs, Side, Outcome
import time

order_args = OrderArgs(
    market_id="0xabc123...",
    side=Side.BUY,
    outcome=Outcome.YES,
    price=600_000,  # 60% = $0.60
    size=5_000_000,  # 5 shares
    expiration=int(time.time()) + 3600,  # 1 hour from now
    nonce=0  # Auto-generated
)

Validation

The dataclass performs automatic validation in __post_init__:
  • price: Must be between 1 and 999,999
  • size: Must be positive
  • expiration: Must be positive
These checks raise ValueError if validation fails.

SignedOrder

A signed order ready for submission to the API. This is returned by TurbineClient.create_limit_buy() and create_limit_sell().
market_id
str
Market identifier
trader
str
Trader’s wallet address
side
int
Order side (0 = BUY, 1 = SELL)
outcome
int
Outcome (0 = YES, 1 = NO)
price
int
Price scaled by 1e6
size
int
Size in 6 decimals
nonce
int
Order nonce
expiration
int
Expiration timestamp
maker_fee_recipient
str
Fee recipient address
signature
str
EIP-712 signature (hex string)
order_hash
str
Unique hash identifying this order
permit_signature
PermitSignature | None
Optional gasless USDC approval signature

Methods

to_dict()

Converts the signed order to a dictionary for API submission.
signed_order = client.create_limit_buy(
    market_id="0xabc...",
    outcome=Outcome.YES,
    price=600_000,
    size=1_000_000
)

# Submit to API
result = client.post_order(signed_order)

JSON Format

{
  "order": {
    "marketId": "0xabc123...",
    "trader": "0xdef456...",
    "side": 0,
    "outcome": 0,
    "price": 600000,
    "size": 1000000,
    "nonce": 1,
    "expiration": 1704067200,
    "makerFeeRecipient": "0x0000000000000000000000000000000000000000"
  },
  "signature": "0x123abc..."
}

Side

Enum for order side.
class Side(IntEnum):
    BUY = 0
    SELL = 1

Usage

from turbine_client import Side

# Creating orders
if should_buy:
    side = Side.BUY
else:
    side = Side.SELL

# Comparing
if order.side == Side.BUY:
    print("This is a buy order")

Outcome

Enum for market outcomes.
class Outcome(IntEnum):
    YES = 0
    NO = 1

Usage

from turbine_client import Outcome

# Creating orders
if btc_price > strike_price:
    outcome = Outcome.YES
else:
    outcome = Outcome.NO

# Checking market resolution
if market.winning_outcome == Outcome.YES:
    print("YES won")

Order

An order on the orderbook (returned by get_orders()).
order_hash
str
Unique hash identifying this order
market_id
str
Market identifier
trader
str
Trader’s wallet address
side
int
Order side (0 = BUY, 1 = SELL)
outcome
int
Outcome (0 = YES, 1 = NO)
price
int
Price scaled by 1e6
size
int
Original order size
filled_size
int
Amount filled so far
remaining_size
int
Amount remaining to be filled
nonce
int
Order nonce
expiration
int
Expiration timestamp
status
str
Order status (e.g., “OPEN”, “FILLED”, “CANCELLED”)
created_at
int
Creation timestamp

Example

orders = client.get_orders(trader="0xabc...")

for order in orders:
    print(f"Order {order.order_hash}:")
    print(f"  Side: {'BUY' if order.side == 0 else 'SELL'}")
    print(f"  Outcome: {'YES' if order.outcome == 0 else 'NO'}")
    print(f"  Price: {order.price / 1e6:.2%}")
    print(f"  Filled: {order.filled_size / 1e6:.2f} / {order.size / 1e6:.2f}")
    print(f"  Status: {order.status}")

PermitSignature

EIP-2612 permit signature for gasless USDC approval.
nonce
int
The nonce used when signing (must match on-chain)
value
int
Amount approved (in USDC with 6 decimals)
deadline
int
Expiration timestamp for the permit
v
int
ECDSA signature parameter v
r
str
ECDSA signature parameter r (hex string with 0x prefix)
s
str
ECDSA signature parameter s (hex string with 0x prefix)

Methods

to_dict()

Converts to dictionary for API submission.
permit = PermitSignature(
    nonce=0,
    value=1000_000_000,  # 1000 USDC
    deadline=int(time.time()) + 3600,
    v=27,
    r="0x123...",
    s="0x456..."
)

data = permit.to_dict()
# Returns: {"nonce": 0, "value": 1000000000, "deadline": ..., "v": 27, "r": "0x123...", "s": "0x456..."}
You typically don’t need to create PermitSignature objects directly. The SDK handles this automatically when you call approve_usdc_for_settlement().

Build docs developers (and LLMs) love