Python SDK for the Stable Sea Terminal API
Project description
Stable Sea Python SDK
Official Python client for the Stable Sea Terminal API, for managing organizations, quotes, orders, and API keys.
Installation
pip install stablesea
Or install from source:
pip install /path/to/sdk/python
Quickstart
from stablesea import StableseaClient
# Initialize with your API key (sandbox by default)
client = StableseaClient(api_key="sk_your_api_key")
# List organizations
organizations = client.organizations.list()
# Create an organization
org = client.organizations.create(
name="Acme Corp",
contact={"email": "john@acme.com", "first_name": "John", "last_name": "Doe"},
idempotency_key="unique-key-123",
)
# Create a quote (organization-scoped)
quote = client.quotes.create(
organization_id="org_01k2cm4r59e5z8k5ggrbbxjcwy",
offering_id="off_01k4qph5ezfsga7fkvbygsqq93",
payin_amount="100",
idempotency_key="quote-key-456",
)
# Create an order from the quote
order = client.orders.create(
organization_id="org_01k2cm4r59e5z8k5ggrbbxjcwy",
quote_id=quote["id"],
idempotency_key="order-key-789",
)
# List API keys
api_keys = client.api_keys.list()
# Create a new API key
new_key = client.api_keys.create(
name="Production API",
environment="PRODUCTION",
permission_level="STANDARD",
)
# Store new_key["api_key"] securely - it's only returned once!
# List liquidity providers
providers = client.liquidity_providers.list()
# Get exchange rate for a provider
rate = client.liquidity_providers.get_exchange_rate("ALPHA")
client.close()
Async Support
For async/await support, use AsyncStableseaClient:
import asyncio
from stablesea import AsyncStableseaClient
async def main():
async with AsyncStableseaClient(api_key="sk_your_api_key") as client:
orgs = await client.organizations.list()
quote = await client.quotes.create(
organization_id="org_...",
offering_id="off_...",
payin_amount="100",
idempotency_key="unique-key",
)
print(orgs, quote)
asyncio.run(main())
Configuration
| Parameter | Default | Description |
|---|---|---|
api_key |
(required) | Your Stable Sea API key |
base_url |
https://api-sandbox.stablesea.com/v1 |
API base URL (use production URL for live) |
timeout |
30.0 |
Request timeout in seconds |
API Resources
| Resource | Methods |
|---|---|
client.organizations |
list(), create(), get() |
client.quotes |
create(), get() |
client.orders |
create(), list(), get() |
client.api_keys |
list(), create(), rotate(), revoke() |
client.liquidity_providers |
list(), get_exchange_rate() |
client.offerings |
create(), get() |
client.external_payment_instruments |
list(), create(), get(), archive() |
Error Handling
from stablesea import StableseaClient, APIError
client = StableseaClient(api_key="sk_...")
try:
client.organizations.create(...)
except APIError as e:
print(f"API error {e.status_code}: {e.message}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stablesea-0.1.0.tar.gz
(8.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
stablesea-0.1.0-py3-none-any.whl
(13.9 kB
view details)
File details
Details for the file stablesea-0.1.0.tar.gz.
File metadata
- Download URL: stablesea-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
067bfd42af56fde7d8df1a41993553588094be4287dd8df7a7339e341410c9e0
|
|
| MD5 |
e1b4d47cd266af671ad0ee8fcc43b9be
|
|
| BLAKE2b-256 |
4395e8f0730dc5e8e66b9484c86439d8c1726a935b1c307e9f4fdec6431ba0f1
|
File details
Details for the file stablesea-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stablesea-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1121d6437fe4fd5c2e307c1d41aae21ba92e8ce63eb73a672a66b4ee8f7467b3
|
|
| MD5 |
86eaa2379b42d87e0b01bb0821652948
|
|
| BLAKE2b-256 |
f9ca1ee1034b4a562034c208453a38e01132bee3727144767892acc02d6656a6
|