Requesting Positions

View as MarkdownOpen in Claude

In order to request your account’s positions, you must first query the /portfolio/accounts endpoint. After sending a request to this endpoint, the /portfolio2/:accountId/positions endpoint can be queried for account positions.

import requests
headers = {"Content-Type": "application/json"}
url = f"https://localhost:5000/v1/api/portfolio/accounts"
response = requests.get(url, headers=headers, verify=False)
accountId = response.json()[0]["id"]
url = f"https://localhost:5000/v1/api/portfolio2/:accountId/positions"
response = requests.get(url, headers=headers)
print("response: ", response.json())