added
Added Market Positions WS Channel
10 days ago by ReadMe API
Added market_positions
WebSocket channel for real-time position updates.
Overview
The market_positions
channel provides real-time updates of user positions in markets. This channel is essential for portfolio tracking, position monitoring, and P&L calculations.
Features
- Authentication required: This is a private channel that requires user authentication
- Flexible subscription modes:
- Subscribe to specific markets by providing a list of market tickers
- Subscribe to all markets by omitting the market_tickers parameter
- Real-time updates: Receive position updates whenever your position changes due to trades, settlements, or other events
- Comprehensive position data: Each update includes current position, cost basis, and cumulative trading statistics
Subscription Examples
Subscribe to specific markets
{
"id": 2,
"cmd": "subscribe",
"params": {
"channels": ["market_positions"],
"market_tickers": ["FED-23DEC-T3.00", "HIGHNY-22DEC23-B53.5"]
}
}
Subscribe to all markets
{
"id": 2,
"cmd": "subscribe",
"params": {
"channels": ["market_positions"]
}
}
Message Format
{
"type": "market_position",
"sid": 14,
"msg": {
"user_id": "user123",
"market_ticker": "FED-23DEC-T3.00",
"position": 100,
"position_cost": 500000,
"realized_pnl": 100000,
"fees_paid": 10000,
"volume": 15
}
}
Field Descriptions
user_id
: Your user IDmarket_ticker
: The market identifierposition
: Current net position (positive for long/YES, negative for short/NO)position_cost
: Current cost basis of the position in centi-cents (1/10,000th of a dollar)realized_pnl
: Realized profit/loss in centi-cents (1/10,000th of a dollar)fees_paid
: Total fees paid in centi-cents (1/10,000th of a dollar)volume
: Total volume traded
Important Note: All monetary values (position_cost
, realized_pnl
, fees_paid
) are returned in centi-cents. To convert to dollars, divide by 10,000. For example, a position_cost
of 500000 represents $50.00.
API Version
2.0.7