Official Python SDK for the Nirium autonomous DeFi agent on Stellar
Project description
nirium
Official Python SDK for the Nirium Protocol — autonomous DeFi agent on Stellar/Soroban.
Install
pip install nirium
Quick Start
import asyncio
from nirium import Agent
agent = Agent(
api_url="https://api.nirium.xyz",
api_key="sk_inst_your_key_here",
)
async def main():
# Health check
alive = await agent.ping()
print(f"Agent alive: {alive}")
# Real market data from Stellar Horizon
market = await agent.get_market()
print(f"XLM Price: ${market['xlmPrice']:.4f}")
# Execute a strategy
result = await agent.execute("flash-loan-arb", "XLM-USDC", {"amount": 5000})
print(f"Profit: {result['profit']}")
asyncio.run(main())
Real-Time Signals (WebSocket)
agent = Agent(api_url="https://api.nirium.xyz", api_key="sk_inst_...", token="eyJhbG...")
@agent.on("signal")
async def on_signal(data):
print(f"Signal: {data['signal_type']} — {data['data']['details']}")
asyncio.run(agent.subscribe())
Authentication
# API Key for REST endpoints
agent = Agent(api_url="https://api.nirium.xyz", api_key="sk_inst_...")
# With JWT token for WebSocket
agent = Agent(api_url="https://api.nirium.xyz", api_key="sk_inst_...", token="eyJhbG...")
Endpoint Access Model
| Access | Endpoints |
|---|---|
| Public (no key) | health, loop/status, execute-demo, signals/recent, skills list |
| Protected (API key) | execute, market, loop/start|stop|scan, subscriptions, skills/install, webhooks |
| WebSocket (JWT) | /ws/signals — real-time signal stream |
API Coverage
| Category | Methods |
|---|---|
| Health | ping(), health(), system_health() |
| Execution | execute(), execute_demo() |
| Market | get_market(), get_loop_status(), start_loop(), stop_loop(), trigger_scan() |
| Signals | get_recent_signals() |
| Skills | get_skills(), install_skill(), uninstall_skill() |
| Webhooks | register_webhook(), get_webhooks(), delete_webhook(), test_webhook() |
| WebSocket | subscribe(), on() decorator |
Requirements
- Python >= 3.10
- aiohttp >= 3.9.0
- websockets >= 13.0
License
MIT — Nirium Protocol
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nirium-0.2.1.tar.gz
(4.9 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
File details
Details for the file nirium-0.2.1.tar.gz.
File metadata
- Download URL: nirium-0.2.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fd201d044731542422d688a2a0f4a8d10239045e5cbdbb1643f62a5fc4951b0
|
|
| MD5 |
3e1b78ca9c67427a57ec49074fbdfcb0
|
|
| BLAKE2b-256 |
1cf6d060eb2e8eccf8b6cbfccfa503c0d2a6af4d79ef1a111a418c44575a6a5e
|
File details
Details for the file nirium-0.2.1-py3-none-any.whl.
File metadata
- Download URL: nirium-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.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 |
c2bab1b069137b82a6cd201dc254f938ee141e8e24310dfe0b0d669c86ab2490
|
|
| MD5 |
e2f304470b48085e04dbefba1e0e16c3
|
|
| BLAKE2b-256 |
0c10d11087e5abe0ef2a1c678c3c33fe4f1e23c559c3da8b60b7f05a8c1d9137
|