Skip to main content

Official Python SDK for Nirium autonomous agents on Stellar (x402 + MPP)

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_tickers(), get_market(), get_stats(), 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.5.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nirium-0.5.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file nirium-0.5.0.tar.gz.

File metadata

  • Download URL: nirium-0.5.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nirium-0.5.0.tar.gz
Algorithm Hash digest
SHA256 12b539aaa820f8305fe376041005612074148aab6d157513bd75272a790da311
MD5 95fffb2cc146d6990133262ce75d38e3
BLAKE2b-256 e2ea00683255aba1f48972637488329cd8cb30f9c991b0cc6abc4e83bc4a5987

See more details on using hashes here.

File details

Details for the file nirium-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nirium-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nirium-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e13abb353fdcb9437eff5bb1bb81f1f7b31225e361cf5259da1f9543d496f84
MD5 7ce8ac4ce56673c1ccb9b710266a9267
BLAKE2b-256 8cbc6a69551e16ce97afa0a28bbadf87bbb19c939b2a9c96cb4ec282c272a010

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page