Skip to main content
async def retrieveOrder(oid, mid):
    base_url = os.getenv("API_SERVER_URL")
    async with httpx.AsyncClient() as session:
        client = PerpetualsClient(base_url=base_url, session=session)
        try:
            address = os.getenv("ACCOUNT")
            order = await client.get_order(order_id=oid, market=mid, reduce_only=False)

            print(order)
        except Exception as e:
            print(f"Error getting order: {e}")
            print("\nTroubleshooting:")
            print("  - Is the server running?")
            print("  - Does this address have orders in the database?")