Skip to navigation

Placing Orders

View as MarkdownOpen in Claude

First, ensure you have an active brokerage session, as shown in Initializing Brokerage Session. Then, send a POST request to the /iserver/account/{accountId}/orders endpoint.

import requests
account_id = "DU123456"
url = f"https://localhost:5000/v1/api/iserver/account/{account_id}/orders"
payload = {
"orders": [
{
"conid": 265598,
"orderType": "LMT",
"price": 165,
"quantity": 100,
"side": "BUY",
"tif": "DAY"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.status_code)
print(response.json())