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

# Python SDK

> Official Python SDK for the Aries API

## Installation

Install the Aries Python SDK using pip:

```bash theme={null}
pip install aries-exchange-sdk
```

## Quick Start

```python theme={null}
from aries_exchange import AriesClient

# Initialize the client
client = AriesClient(
    client_id="your_client_id",
    client_secret="your_client_secret"
)

# Get account information
account = client.accounts.get_user_accounts()
print(account)

# Place an order
order = client.orders.place_order(
    symbol="AAPL",
    quantity=10,
    side="buy",
    order_type="market"
)
print(order)
```

## Authentication

The Python SDK supports OAuth2 authentication:

```python theme={null}
from aries_exchange import AriesClient

client = AriesClient(
    client_id="your_client_id",
    client_secret="your_client_secret"
)

# The SDK handles token management automatically
```

## Making API Calls

### Get Market Data

```python theme={null}
# Search for securities
results = client.market_data.search("AAPL")

# Get equity details
equity = client.market_data.get_equity_details("AAPL")
```

### Manage Orders

```python theme={null}
# Place a limit order
order = client.orders.place_order(
    symbol="AAPL",
    quantity=10,
    side="buy",
    order_type="limit",
    limit_price=150.00
)

# Cancel an order
client.orders.cancel_order(order_id="order_123")
```

## WebSocket Support

Stream real-time data using WebSockets:

```python theme={null}
from aries_exchange import AriesWebSocket

ws = AriesWebSocket(
    client_id="your_client_id",
    client_secret="your_client_secret"
)

# Subscribe to market data
@ws.on_market_data
def handle_market_data(data):
    print(f"Received: {data}")

ws.subscribe_market_data(["AAPL", "GOOGL"])
ws.connect()
```

## Error Handling

```python theme={null}
from aries_exchange import AriesClient, AriesAPIError

client = AriesClient(client_id="...", client_secret="...")

try:
    order = client.orders.place_order(...)
except AriesAPIError as e:
    print(f"API Error: {e.message}")
    print(f"Status Code: {e.status_code}")
```

## Requirements

* Python 3.7 or higher
* requests
* websocket-client

## Additional Resources

* [GitHub Repository](#)
* [PyPI Package](#)
* [API Reference](/api-reference)
