Skip to Content

General Socket - Position Events

This WebSocket allows you to receive live updates on your positions as your trades execute.

USE CASE

Track your net quantity, average prices and realised P&L live as trades execute.

Details

  • Subscribe with the positions action on the raw socket, or OnPositions in the Python SDK (callback on_positions). Nothing is delivered until you subscribe.
  • id is unique for each position, for example NSE:IDEA-EQ-INTRADAY. slNo is used to sort positions.
  • netQty is the net quantity and qty is its absolute value. A squared-off position is sent with netQty 0, as in the sample response.
  • dayBuyQty and daySellQty are today's quantities. cfBuyQty and cfSellQty are carry-forward quantities.
  • For cross-currency positions (crossCurrency is Y), use rbiRefRate to calculate P&L. For commodity positions, use qtyMulti_com.
  • The raw socket message uses different key names. The SDK renames them, for example pl_realized to realized_profit, tran_side to side, pl_total to pl and pl_unrealized to unrealized_profit.

Response Attributes - For position updates

AttributeData TypeDescription
symbolstringEg: NSE:SBIN-EQ
idstringThe unique value for each position
buyAvgfloatAverage buy price
buyQtyintTotal buy qty
sellAvgfloatAverage sell price
sellQtyintTotal sell qty
netAvgfloatnetAvg
netQtyintNet qty
sideint
  • The side shows whether the position is long / short
  • View Details
qtyintAbsolute value of net qty
productTypestring
realized_profitfloatThe realized p&l of the position
crossCurrencystring
  • Y => It is cross currency position
  • N => It is not a cross currency position
rbiRefRatefloatIncase of cross currency position, the rbi reference rate will be required to calculate the p&l
qtyMulti_comfloatIncase of commodity positions, this multiplier is required for p&l calculation
segmentint
exchangeint
slNointThis is used for sorting of positions
fytokenstring
  • Fytoken is a unique identifier for every symbol.
  • View Details
cfBuyQtyintCarry forward buy quantity
cfSellQtyintCarry forward sell quantity
dayBuyQtyintDay forward buy quantity
daySellQtyintDay forward sell quantity
exchangeint
buyValfloatTotal buy value of the position.
sellValfloatTotal sell value of the position.
Last updated on