Skip to content

Python SDK

Installation

pip install sarna-sdk

Quick Start

from openapi import Openapi

client = Openapi(
    bearer_auth="sandbox_test_xxxx12345",
    server_url="https://api.sandbox.sarna.io"
)

# Get a quote
quote = client.market_data.get_quote(symbol="AAPL")

# Place an order
order = client.orders.place_order(request={
    "AccountId": 500123,
    "Symbol": "AAPL",
    "Quantity": 100,
    "PriceType": "Limit",
    "LimitPrice": -150.25,
    "Side": "Buy",
    "TimeInForce": "Day"
})

Features

  • Pydantic models for all request/response types
  • Async support (sync and async client interfaces)
  • Full type hints throughout
  • Pre-built Bearer token authentication
  • Automatic retry with exponential backoff
  • Comprehensive inline documentation

Resources