Python SDK
The Swarm Python SDK (swarm-collection) is a unified suite of client libraries for trading Real World Assets (RWAs) on Swarm's infrastructure. It provides three SDKs — each suited to different trading scenarios — alongside a smart-routing layer that automatically selects the best platform for each trade.
Install: pip install swarm-collection
GitHub: SwarmMarkets/python-swarm-sdks
Examples: SwarmMarkets/python-swarm-sdks-examples
License: Apache 2.0 | Python: 3.8+
The three SDKs
| SDK | What it does | Availability |
|---|---|---|
| Trading SDK | Unified interface with smart routing and automatic price optimisation across both platforms | 24/7 |
| Market Maker SDK | Decentralised P2P OTC trading via smart contracts | 24/7 |
| Cross-Chain Access SDK | Centralised stock market trading with real US exchange pricing | Market hours only (14:30–21:00 UTC, Mon–Fri) |
Architecture
The SDKs are layered. The Trading SDK orchestrates the two lower-level SDKs; both share common infrastructure for Web3 operations and authentication:
┌──────────────────────────────────────────────────────────────┐
│ Trading SDK │
│ (Smart routing, price comparison, auto-fallback) │
└───────────────┬──────────────────────────┬───────────────────┘
│ │
┌─────────▼──────────┐ ┌─────────▼──────────────┐
│ Market Maker SDK │ │ Cross-Chain Access SDK │
│ (P2P OTC, 24/7) │ │ (Stock market) │
└─────────┬──────────┘ └─────────┬───────────────┘
│ │
└──────────────┬───────────┘
│
┌────────▼─────────┐
│ Shared module │
│ (Web3, Auth...) │
└──────────────────┘
You can use any layer independently. If you only need P2P OTC trading, import the Market Maker SDK directly. If you want automatic routing and fallback across both platforms, use the Trading SDK.
Which SDK should I use?
Do you need to CREATE liquidity offers?
├─ YES → Market Maker SDK
Do you only want stock market pricing during market hours?
├─ YES → Cross-Chain Access SDK
Do you want automatic best-price routing with fallback?
└─ YES → Trading SDK ✅ (recommended for most applications)
Installation & prerequisites
pip install swarm-collection
You will need:
- Python 3.8 or higher
- A wallet with a private key
- Gas tokens (MATIC, ETH, etc.) for transaction fees
- An RPQ API Key — required for Market Maker SDK access (contact the Swarm team)
- A user email — required for Cross-Chain Access SDK
For Cross-Chain Access specifically:
- KYC verification completed at https://dotc.eth.limo/
- Awareness of market hours (14:30–21:00 UTC, weekdays only)
Optional environment variable:
export SWARM_COLLECTION_MODE=prod # defaults to dev
Supported networks
| Network | Chain ID | Market Maker | Cross-Chain Access |
|---|---|---|---|
| Polygon | 137 | ✅ | ✅ |
| Ethereum | 1 | ✅ | ✅ |
| Base | 8453 | ✅ | ✅ |
| Arbitrum | 42161 | ✅ | ❌ |
| Optimism | 10 | ✅ | ❌ |
| BSC | 56 | ❌ | ✅ |
SDK guides
→ Trading SDK — Smart routing across both platforms
→ Market Maker SDK — Decentralised P2P OTC trading
→ Cross-Chain Access SDK — Stock market integration
Each SDK guide has a companion API Reference with full method signatures, parameters, return types, and exceptions.
.png)