Endpoint Details
- URL:
wss://api.mobula.io - Event Type:
position
Subscription Format
Theposition endpoint allows you to subscribe to a specific wallet’s position for a particular token on a blockchain, providing real-time updates on balance changes, trades, and P&L metrics.
Subscribe to Wallet Position
Parameters
wallet(required): The wallet address to track. Addresses will be automatically checksummedtoken(required): The token contract address. Use0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEfor native tokens. Addresses will be automatically checksummedblockchain(optional, default:"evm:1"): Blockchain identifier (e.g.,"evm:1"for Ethereum,"evm:56"for BSC,"solana"for Solana)subscriptionId(optional): Custom identifier for your WebSocket connection. Auto-generated if not providedsubscriptionTracking(optional, default:false): Include subscription details in response logs for debuggingincludeFees(optional, default:false): Iftrue, deducts total fees paid (gas + platform + MEV) from the PnL calculationuseSwapRecipient(optional, default:false): Iftrue, uses swap recipient tracking mode instead of transaction sender. Useful for tracking wallets that receive tokens from other signers (e.g., trading bots, copy trading)tradeUpdatesOnly(optional, default:false): Controls update frequency. Whenfalse(default), the stream also emits live unrealized-PnL updates every time a held token’s price changes. Whentrue, an update is only emitted when this wallet trades
Native Token Tracking: To track native tokens (ETH, BNB, SOL, etc.), use the address
0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE (42 ‘E’s) as the token address.Real-Time Updates
After subscribing, you’ll receive instant updates whenever the wallet’s position changes, including:- Balance changes
- New trades (buys/sells)
- Updated P&L metrics
- Price movements
Position Update Response
Data Model
WalletPositionData
Each position update includes:TokenDetails
Use Cases
1. Copy Trading Bots
Monitor positions of successful traders (like Cupsey) and replicate their trades in real-time.2. Portfolio Tracking
Track your own positions across multiple wallets and tokens.3. Whale Watching
Monitor whale wallets for significant position changes.Implementation Example
TypeScript/JavaScript
Python
Connection Keepalive (Ping/Pong)
To maintain active WebSocket connections and prevent timeouts, you can use the ping/pong mechanism: Send ping:Unsubscribing from the Stream
Unsubscribe from All Position Streams
Unsubscribe from Specific Subscription
Unsubscribe from Specific Position
If you didn’t provide a
subscriptionId when subscribing, one is auto-generated. To retrieve it, set "subscriptionTracking": true in the subscription payload.Best Practices
1. Connection Management
- Implement automatic reconnection logic with exponential backoff
- Handle WebSocket close events gracefully
- Ping/pong to keep connection alive
2. Rate Limiting
- Subscribe to a reasonable number of positions per connection
- Use multiple connections for high-volume monitoring
- Batch subscriptions when possible
3. Error Handling
4. Data Validation
Always validate incoming data before processing:Example: Multi-Wallet Position Dashboard
Support
Can’t find what you’re looking for? Reach out to us, response times < 1h.Support
Telegram
Support
Slack
Need help?
Email