Overview
The Orders API allows you to execute trades, modify existing orders, cancel orders, and preview orders before execution. All order operations require proper authentication and trading permissions.Class Reference
Methods
place_order()
Place a new trading order.symbol(str): Stock symbol (e.g., “AAPL”, “TSLA”)quantity(int): Number of sharesside(str): “buy” or “sell”order_type(str): “market”, “limit”, “stop”, or “stop_limit”price(float, optional): Limit price for limit ordersstop_price(float, optional): Stop price for stop orderstime_in_force(str): “day”, “gtc”, “ioc”, “fok”
update_order()
Modify an existing order.order_id(str): Order ID to updatequantity(int, optional): New quantityprice(float, optional): New limit price
cancel_order()
Cancel an active order.order_id(str): Order ID to cancel
preview_order()
Preview order cost and impact before placing.place_order()
Returns: Order preview object with cost estimates
Order Types
Market Orders
Buy or sell immediately at the best available price:Limit Orders
Buy or sell at a specified price or better:Stop Orders
Trigger a market order when price reaches stop price:Stop-Limit Orders
Trigger a limit order when stop price is reached:Time in Force
Day Orders (DAY)
Order is active only for the current trading day:Good ‘Til Cancelled (GTC)
Order remains active until filled or cancelled:Immediate or Cancel (IOC)
Fill immediately, cancel any unfilled portion:Fill or Kill (FOK)
Fill entire order immediately or cancel:Multi-Leg Orders
For complex options strategies:Examples
Preview Before Trading
Always preview orders to check costs:Bracket Order Strategy
Place entry with automatic profit target and stop loss:Modify Order
Update quantity or price of pending order:Cancel Orders
Error Handling
Response Objects
Order Object
Preview Object
Best Practices
- Always preview orders before placing to check costs
- Use limit orders in volatile markets to control execution price
- Set stop losses to manage risk on positions
- Use appropriate time_in_force based on your strategy
- Handle errors gracefully with proper error handling
- Check order status after placement to confirm execution
- Cancel stale orders to avoid unintended fills
Related APIs
- Accounts - Check account balances and positions before trading
- Market Data - Get current prices for order placement
- Users - Retrieve trading accounts
API Endpoints
This SDK wraps the following REST API endpoints:POST /v1/orders- Place orderPUT /v1/orders- Update orderDELETE /v1/orders- Cancel orderPOST /v1/orders/preview- Preview order