> ## 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.

# streamAllMarketSummaries

> Python SDK reference for streamAllMarketSummaries.

Stream market summary updates for all markets and yield JSON objects.

<ResponseField name="yields" type="object" required>
  Dictionary containing list of market summaries, or None on error
</ResponseField>

**Raises**

* **ValueError** — If API\_SERVER\_URL environment variable is not set

**Example**

```python theme={null}
>>> import os
>>> os.environ["API_SERVER_URL"] = "http://localhost:8080"
>>> async for summaries in streamAllMarketSummaries():
...     print(len(summaries.get("marketSummaries", [])))
```

```python theme={null}
async def streamAllMarketSummaries() -> AsyncIterator[Optional[Dict[str, Any]]]:
    base_url = os.getenv('API_SERVER_URL')
    if not base_url:
        raise ValueError('API_SERVER_URL environment variable not set')
    async with httpx.AsyncClient() as session:
        client = PerpetualsClient(base_url=base_url, session=session)
        try:
            async for market_summaries in client.stream_all_market_summaries():
                summaries_list = [_filter_executable_depth(MessageToDict(summary, always_print_fields_with_no_presence=True)) for summary in market_summaries]
                yield {'marketSummaries': summaries_list}
        except Exception as e:
            print(f'Error streaming all market summaries: {e}')
            print('\nTroubleshooting:')
            print('  - Is the server running?')
            print('  - Are there markets configured in the database?')
            print('  - Check network connectivity')
            yield None
```
