Skip to main content
Order methods handle the creation, signing, and management of limit orders on the Turbine CLOB.

create_order

Create and sign an order from order arguments.
order_args
OrderArgs
required
Order parameters including market_id, side, outcome, price, size, and expiration.
settlement_address
str | None
Settlement contract address. If not provided, fetched from the market.
Returns: SignedOrder - A signed order ready for submission Requires: Private key (signing capability) Example:
from turbine_client import TurbineClient, OrderArgs, Side, Outcome
import time

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key"
)

# Get the current market
quick_market = client.get_quick_market("BTC")

# Create order arguments
order_args = OrderArgs(
    market_id=quick_market.market_id,
    side=Side.BUY,
    outcome=Outcome.YES,
    price=550_000,  # 55% (scaled by 1e6)
    size=1_000_000,  # 1.0 shares (6 decimals)
    expiration=int(time.time()) + 3600,  # 1 hour
)

# Create and sign the order
signed_order = client.create_order(order_args)
print(f"Order hash: {signed_order.order_hash}")

create_limit_buy

Create a limit buy order.
market_id
str
required
The market ID to trade on.
outcome
Outcome
required
The outcome to buy: Outcome.YES or Outcome.NO.
price
int
required
Price scaled by 1e6 (0 to 1,000,000 = 0% to 100%).
size
int
required
Size with 6 decimals. 1,000,000 = 1 share.
expiration
int | None
Expiration timestamp. Defaults to 1 hour if not provided.
settlement_address
str | None
Settlement contract address. If not provided, fetched from the market.
Returns: SignedOrder - A signed buy order ready for submission Requires: Private key (signing capability) Example:
import time
from turbine_client import TurbineClient, Outcome

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key"
)

# Get the current BTC market
quick_market = client.get_quick_market("BTC")

# Create a buy order: buy 2 YES shares at 60%
signed_order = client.create_limit_buy(
    market_id=quick_market.market_id,
    outcome=Outcome.YES,
    price=600_000,  # 60%
    size=2_000_000,  # 2.0 shares
    expiration=int(time.time()) + 3600,
)

print(f"Created buy order: {signed_order.order_hash}")

create_limit_sell

Create a limit sell order.
market_id
str
required
The market ID to trade on.
outcome
Outcome
required
The outcome to sell: Outcome.YES or Outcome.NO.
price
int
required
Price scaled by 1e6 (0 to 1,000,000 = 0% to 100%).
size
int
required
Size with 6 decimals. 1,000,000 = 1 share.
expiration
int | None
Expiration timestamp. Defaults to 1 hour if not provided.
settlement_address
str | None
Settlement contract address. If not provided, fetched from the market.
Returns: SignedOrder - A signed sell order ready for submission Requires: Private key (signing capability) Example:
import time
from turbine_client import TurbineClient, Outcome

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key"
)

# Get the current BTC market
quick_market = client.get_quick_market("BTC")

# Create a sell order: sell 1.5 NO shares at 45%
signed_order = client.create_limit_sell(
    market_id=quick_market.market_id,
    outcome=Outcome.NO,
    price=450_000,  # 45%
    size=1_500_000,  # 1.5 shares
    expiration=int(time.time()) + 3600,
)

print(f"Created sell order: {signed_order.order_hash}")

post_order

Submit a signed order to the orderbook.
signed_order
SignedOrder
required
The signed order to submit.
Returns: dict[str, Any] - Order submission response from the API Requires: API credentials (bearer token authentication) Example:
import time
from turbine_client import TurbineClient, Outcome

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key",
    api_key_id="your_api_key_id",
    api_private_key="your_api_private_key"
)

# Get the current market
quick_market = client.get_quick_market("BTC")

# Create and sign a buy order
signed_order = client.create_limit_buy(
    market_id=quick_market.market_id,
    outcome=Outcome.YES,
    price=550_000,
    size=1_000_000,
    expiration=int(time.time()) + 3600,
)

# Submit the order
response = client.post_order(signed_order)
print(f"Order submitted: {response}")

cancel_order

Cancel an open order.
order_hash
str
required
The hash of the order to cancel.
market_id
str | None
Optional market ID for validation.
side
Side | None
Optional side (BUY or SELL) for validation.
Returns: dict[str, Any] - Cancellation response from the API Requires: API credentials (bearer token authentication) Example:
from turbine_client import TurbineClient

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key",
    api_key_id="your_api_key_id",
    api_private_key="your_api_private_key"
)

# Get open orders
orders = client.get_orders(trader=client.address, status="open")

if orders:
    # Cancel the first order
    order_hash = orders[0].order_hash
    response = client.cancel_order(order_hash)
    print(f"Order cancelled: {response}")

get_orders

Get orders, optionally filtered by trader, market, or status.
trader
str | None
Filter by trader address.
market_id
str | None
Filter by market ID.
status
str | None
Filter by status: “open”, “filled”, or “cancelled”.
Returns: list[Order] - List of orders matching the filters Requires: API credentials (bearer token authentication) Example:
from turbine_client import TurbineClient

client = TurbineClient(
    host="https://api.turbinefi.com",
    chain_id=137,
    private_key="your_private_key",
    api_key_id="your_api_key_id",
    api_private_key="your_api_private_key"
)

# Get all open orders for your address
open_orders = client.get_orders(
    trader=client.address,
    status="open"
)

for order in open_orders:
    outcome_label = "YES" if order.outcome == 0 else "NO"
    side_label = "BUY" if order.side == 0 else "SELL"
    price_pct = order.price / 10_000  # Convert to percentage
    size = order.size / 1_000_000  # Convert to shares
    print(f"{side_label} {size:.2f} {outcome_label} @ {price_pct:.2f}%")

# Get all orders for a specific market
quick_market = client.get_quick_market("BTC")
market_orders = client.get_orders(market_id=quick_market.market_id)
print(f"Found {len(market_orders)} orders on this market")

OrderArgs

@dataclass
class OrderArgs:
    market_id: str
    side: Side  # Side.BUY or Side.SELL
    outcome: Outcome  # Outcome.YES or Outcome.NO
    price: int  # 0 to 1,000,000 (scaled by 1e6)
    size: int  # Size with 6 decimals
    expiration: int  # Unix timestamp
    nonce: int = 0  # Auto-generated if 0
    maker_fee_recipient: str = "0x0000000000000000000000000000000000000000"

SignedOrder

@dataclass
class SignedOrder:
    market_id: str
    trader: str  # Signer's address
    side: int  # 0 = BUY, 1 = SELL
    outcome: int  # 0 = YES, 1 = NO
    price: int
    size: int
    nonce: int
    expiration: int
    maker_fee_recipient: str
    signature: str  # EIP-712 signature
    order_hash: str  # Unique order identifier
    permit_signature: PermitSignature | None

Order

@dataclass
class Order:
    order_hash: str
    market_id: str
    trader: str
    side: int
    outcome: int
    price: int
    size: int
    filled_size: int
    status: str  # "open", "filled", "cancelled"
    created_at: int
    updated_at: int

Notes

  • Price scaling: All prices are scaled by 1e6. A price of 500,000 = 50%.
  • Size scaling: All sizes use 6 decimals. 1,000,000 = 1 share.
  • Minimum order size: Taker orders (immediate fills) must have size × price ≥ 1_000_000 ($1 USDC minimum). Maker orders (resting limit orders) have no minimum.
  • Gasless: All operations are gasless. Orders are signed off-chain with your private key and submitted via the API.
  • Authentication levels:
    • create_order, create_limit_buy, create_limit_sell: Require private key (signing)
    • post_order, cancel_order, get_orders: Require API credentials (bearer token)

Build docs developers (and LLMs) love