Skip to main content

Installation

Install the Aries Python SDK using pip:
pip install aries-exchange-sdk

Quick Start

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:
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

# Search for securities
results = client.market_data.search("AAPL")

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

Manage Orders

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

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