Skip to main content
T+ supports two fundamental order types: limit orders and market orders. Both are submitted through OrderBookClient as signed requests; tpluspy handles the Ed25519 signing automatically. All prices and quantities travel as integers in the book’s native units — you must scale your human-readable amounts using the decimal information provided by the Market object before sending an order.

Quantities and Prices: Integer Book Units

Every on-the-wire quantity and price is an integer. The book’s decimal precision is specific to each market and is exposed through the Market object returned by get_market().
from tplus.model.asset_identifier import AssetIdentifier

asset = AssetIdentifier(200)
market = await client.get_market(asset)

print(market.book_price_decimals)     # e.g. 6 → price unit is 1e-6
print(market.book_quantity_decimals)  # e.g. 8 → quantity unit is 1e-8
If you want to place a limit order at a human-readable price of 1.50 and book_price_decimals is 6, the integer price you send is 1_500_000. Always derive decimals from the Market object — do not hardcode them.

Limit Orders

A limit order rests on the book at a specified price until it is filled, cancelled, or its time-in-force expires. Import the time-in-force classes from tplus.model.limit_order:
from tplus.model.limit_order import GTC, GTD, IOC

Time-in-Force Options

GTC — Good Till Cancelled

Rests on the book indefinitely until fully filled or explicitly cancelled. The default choice for passive market-making.

GTD — Good Till Date

Rests on the book until fully filled, cancelled, or the specified expiry timestamp is reached.

IOC — Immediate Or Cancel

Attempts to fill immediately against existing resting orders. Any unfilled portion is cancelled instantly — nothing rests on the book.

Placing Limit Orders

from tplus.model.asset_identifier import AssetIdentifier
from tplus.model.limit_order import GTC

asset = AssetIdentifier(200)

response = await client.create_limit_order(
    asset_id=asset,
    quantity=5,
    price=1_000,
    side="Sell",
    time_in_force=GTC(),
)
print(response)

Market Orders

A market order executes immediately at the best available price(s) on the book. There is no price parameter — quantity and side are sufficient.
from tplus.model.asset_identifier import AssetIdentifier

asset = AssetIdentifier(200)

response = await client.create_market_order(
    asset_id=asset,
    quantity=10,
    side="Buy",
    fill_or_kill=False,  # True: cancel entirely if not fully filled immediately
)
Set fill_or_kill=True if you need the entire quantity filled in a single sweep or not at all.

Order Lifecycle

1

Place

Submit a limit or market order. The exchange assigns an order_id returned in the response.
response = await client.create_limit_order(
    asset_id=asset, quantity=5, price=1_000, side="Buy", time_in_force=GTC()
)
order_id = response.order_id
2

Partial Fill

Resting orders may be partially filled as matching orders arrive. The unfilled quantity remains on the book (for GTC/GTD). Stream order events to track partial fills in real time:
async for event in client.stream_orders():
    print(event)
3

Full Fill

Once the full quantity is matched, the order is complete and removed from the book.
4

Cancel

Cancel an open order at any time by supplying its order_id and asset_id:
await client.cancel_order(order_id=order_id, asset_id=asset)
5

Replace

Amend the price or quantity of an open order atomically (cancel-and-replace):
await client.replace_order(
    original_order_id=order_id,
    asset_id=asset,
    new_quantity=6,
    new_price=1_050,
)
new_quantity and new_price are both optional — omit either to keep the existing value.

Querying Orders

# All orders for the authenticated user
orders, raw = await client.get_user_orders()

# Open orders for a specific book
open_orders = await client.get_open_orders_for_book(asset)

Batch Order Submission

Send multiple order requests in a single round-trip with send_multiple_orders. This is particularly useful for market-making strategies that need to update an entire quote sheet atomically:
from tplus.model.asset_identifier import AssetIdentifier
from tplus.model.limit_order import GTC

asset = AssetIdentifier(200)

# Build requests without awaiting each one
bid = client.build_limit_order_request(
    asset_id=asset, quantity=10, price=990, side="Buy", time_in_force=GTC()
)
ask = client.build_limit_order_request(
    asset_id=asset, quantity=10, price=1_010, side="Sell", time_in_force=GTC()
)

responses = await client.send_multiple_orders([bid, ask])

Error Handling

T+ raises specific exceptions for order-related failures. Import them from the top-level tplus package:
from tplus import OmsError, OrderRejected, RateLimitError, AuthError

OrderRejected

The exchange accepted the request but rejected the order — for example, an invalid price, insufficient margin, or a duplicate order ID. Check err.message for the rejection reason.

OmsError

A non-rejection error from the order management system — for example, trying to cancel an order that no longer exists. Usually indicates a state mismatch between your client and the exchange.

RateLimitError

You have exceeded the request rate limit. Back off and retry.

AuthError

The request signature was rejected. Ensure you are using the correct User object associated with the account that owns the order.
from tplus import OmsError, OrderRejected, RateLimitError
from tplus.model.asset_identifier import AssetIdentifier
from tplus.model.limit_order import GTC

asset = AssetIdentifier(200)

try:
    response = await client.create_limit_order(
        asset_id=asset,
        quantity=5,
        price=1_000,
        side="Buy",
        time_in_force=GTC(),
    )
except OrderRejected as err:
    print(f"Order rejected: {err}")
except OmsError as err:
    print(f"OMS error: {err}")
except RateLimitError:
    print("Rate limited — slow down and retry")

CLI Equivalent

Every order operation is also available through the tplus orders CLI:
# Limit order
tplus orders place --asset 200 --side buy --type limit --quantity 10 --price 1000

# Market order
tplus orders place --asset 200 --side sell --type market --quantity 5

# Cancel
tplus orders cancel <order_id> --asset 200

# Replace
tplus orders replace <order_id> --asset 200 --price 1050 --quantity 6

# List open orders
tplus orders list --asset 200 --open-only