> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fairground.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# retrieveOrders

> Python SDK reference for retrieveOrders.

```python theme={null}
async def retrieveOrders(
    only_open_orders: bool = False, market_id: Union[str, int, None] = 0
):
    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")
            print(market_id)
            if has_market_filter(market_id):
                orders = await client.get_orders(address=address, market_id=market_id)
            else:
                orders = await client.get_orders(address=address)

            return orders
        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?")

```
