xu-agent-sdk
Python SDK for connecting autonomous trading agents to 1XU's AI-powered signal pipeline.
Features
- ⚡ Real-time Signals — AI-powered trading signals for Polymarket
- 📡 20+ Endpoints — Full A2A protocol with REST API & webhooks
- 📊 Performance Tracking — Report trades and track your P&L
- 🔄 Streaming — Long-polling and webhook delivery
- ✅ On-chain Verification — Prove your trades on-chain
Installation
pip install xu-agent-sdk
Quick Start
import asyncio
from xu_agent_sdk import XuAgent
async def main():
# Initialize with your API key
agent = XuAgent(api_key="1xu_your_api_key_here")
# Verify connection and get plan info
info = await agent.verify_connection()
print(f"Connected! Plan: {info['plan']}")
# Get latest signals
signals = await agent.get_signals(limit=5, min_confidence=0.6)
for signal in signals:
print(f"Signal: {signal.market}")
print(f" Direction: {signal.direction}")
print(f" Confidence: {signal.confidence:.1%}")
print(f" Entry: {signal.entry_price:.3f}")
print()
await agent.close()
asyncio.run(main())
Getting an API Key
- Deposit USDC at https://1xu.app and get your API key instantly
- $2/day during 15-day trial, then $10/day
- Cancel anytime
Usage Examples
Get Signals
# Get latest signals
signals = await agent.get_signals(limit=10)
# Filter by confidence
signals = await agent.get_signals(min_confidence=0.7)
# Filter by direction
signals = await agent.get_signals(direction='yes')
Report Trades
# Report a trade execution
result = await agent.report_trade(
signal_id=signal.id,
market_id=signal.market_id,
direction='yes',
size_usd=100.0,
entry_price=0.65,
tx_hash="0x..." # Optional, for verification
)
trade_id = result['trade_id']
# Later, report the close
await agent.report_close(
trade_id=trade_id,
exit_price=0.85,
pnl_usd=30.77 # (0.85-0.65)/0.65 * 100
)
Report Skips/Failures
# Skip a signal
await agent.report_skip(
signal_id=signal.id,
reason="below_threshold" # or "no_liquidity", "already_positioned"
)
# Report failure
await agent.report_failure(
signal_id=signal.id,
reason="slippage_too_high"
)
Check Stats
# Your performance
stats = await agent.get_my_stats()
print(f"Win Rate: {stats['win_rate']:.1f}%")
print(f"Total P&L: ${stats['total_pnl_usd']:.2f}")
Stream Signals (Long-polling)
async for signal in agent.stream_signals(min_confidence=0.6):
print(f"New signal: {signal.market} -> {signal.direction}")
# Execute your trading logic here
Register Webhook
# For real-time delivery
await agent.register_webhook("https://your-agent.com/webhook")
Error Handling
from xu_agent_sdk import (
XuAuthError,
XuRateLimitError,
XuPaymentRequiredError,
XuSignalLimitError
)
try:
signals = await agent.get_signals()
except XuAuthError:
print("Invalid API key")
except XuRateLimitError as e:
print(f"Rate limited, retry in {e.retry_after}s")
except XuSignalLimitError as e:
print(f"Daily limit reached, resets in {e.resets_in_seconds}s")
except XuPaymentRequiredError as e:
print(f"Deposit USDC required: {e.pricing}")
Webhook Payload
When you register a webhook, signals are POSTed with this format:
{
"event": "new_signal",
"signal_id": "abc123",
"timestamp": "2026-02-03T10:30:00Z",
"data": {
"market": "Will Bitcoin hit $100k by March 2026?",
"market_id": "0x1234...",
"direction": "yes",
"confidence": 0.72,
"suggested_size": "$50-100",
"entry_price": 0.65
}
}
Verify webhooks using the X-1xu-Signature header.
Support
- Documentation: https://1xu.app/docs/sdk
- Discord: https://discord.gg/1xu
- Email: dev@1xu.app
License
MIT
Metadata
Release files for xu-agent-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xu_agent_sdk-0.1.1.tar.gz | 10.9 kB | Without provenance | Details for xu_agent_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xu_agent_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for xu_agent_sdk-0.1.1-py3-none-any.whl |
Total release size: 20.9 kB
Release files / xu_agent_sdk-0.1.1.tar.gz
| Download URL | xu_agent_sdk-0.1.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a87e46ceba1c7f8ce93562613ea69feb4c26a37c5625f096d64e76608ba70934
|
|
BLAKE2b-256 checksum How to use checksums |
a1e05819fb097033dec273249f20f9884f7b2775eb47bde58e5db83009315f90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / xu_agent_sdk-0.1.1-py3-none-any.whl
| Download URL | xu_agent_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a0253d312a75c97fe644bbf11d0d107e90ffad6b0de611d7b7b624fd6dfc3be
|
|
BLAKE2b-256 checksum How to use checksums |
a81e5e59c4b98fa120bbd2355f2aa929aead8010c200b9220c85929bc2451675
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for xu-agent-sdk 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.