Skip to content

Positions

Positions

Net Position

NetPosition()

Net position usually is referred to in context of trades placed during the day in case of Equity, or can refer to carry forward positions in case of Derivatives, Currency and Commodity. It indicates the net obligation (either buy or sell) for the given day in a given symbol. Usually you monitor the net positions screen to track the profit or loss made from the given trades and will have options to square off your entire position and book the entire profit and loss.

This method will retrieve the Net position. Typical trade book response will be a nested JSON containing below fields - Symbol - Product Type - Order type - Quantity - Price - Validity - Trade ID - Trade Status

{
  "eq": {
    "appID": "663051cfbac7d699a1c59b96048b50e7",
    "config": {},
    "data": {
      "type": "netPositionsDao",
      "cls": "0",
      "npos": "2",
      "ntMTM": "14.50",
      "opn": "2",
      "pos": [
        {
          "asTyp": "EQUITY",
          "dpInsTyp": "",
          "dpName": "ITC",
          "exc": "NSE",
          "ltSz": "1",
          "ltp": "204.55",
          "sym": "1660_NSE",
          "tkSz": "0.05",
          "trdSym": "ITCLTD",
          "dpExpDt": "",
          "opTyp": "",
          "stkPrc": "",
          "GD": "1",
          "GN": "1",
          "PD": "1",
          "PN": "1",
          "avgByPrc": "190.00",
          "avgSlPrc": "0.00",
          "byAmt": "190.00",
          "byQty": "1",
          "cpName": "Itc Ltd",
          "mtm": "14.55",
          "mul": "1",
          "ntAmt": "-190.00",
          "ntPL": "14.55",
          "ntQty": "1",
          "prc": "190.00",
          "prdCode": "CNC",
          "rlzPL": "0.00",
          "slAmt": "0.00",
          "slQty": "0",
          "sqOff": "true",
          "trsTyp": "B",
          "urlzPL": "14.55",
          "brkEvnPrc": "190.00",
          "cfAvgByPrc": "190.00",
          "cfAvgSlPrc": "0.00",
          "cfByAmt": "0.00",
          "cfByQty": "0",
          "cfSlAmt": "0.00",
          "cfSlQty": "0",
          "ntByAmt": "190.00",
          "ntByQty": "1",
          "ntSlAmt": "0.00",
          "ntSlQty": "0"
        }
      ],
      "tdyMtm": "0.00",
      "urlMtm": "14.50"
    },
    "msgID": "4ffb924c-f796-4511-be41-71cfec5efa05",
    "srvTm": 1619771390052
  },
  "comm": ""
}

Position Square Off

PositionSquareOff(OrderList)

Square off is a term used in intraday and simply means closing all open positions by the end of the trading day

OrderList : List of orders to be Squared Off. Refer Order class.

{
  "eq": {
    "appID": "663051cfbac7d699a1c59b96048b50e7",
    "config": {},
    "data": {
      "type": "positionSquareOffResponseDto",
      "posSqrOffs": [
        {
          "msg": "Your order has been placed successfully!.",
          "oid": "2105030000XXXXX"
        }
      ]
    },
    "msgID": "fc0e01a1-249b-4305-a27c-4dda02f2f589",
    "srvTm": 1620038124354
  },
  "comm": ""
}

Position Conversion

ConvertPosition(Order_Id, Fill_Id, New_Product_Code, Old_Product_Code, Exchange, orderType)

Convert Position : converts your holding position from MIS to CNC and vice-versa

Parameter
OrderId Parent order Id
Fill_Id Fill Id of the trade obtained from TradeBook API
New_Product_Code New Product code of the trade
Old_Product_Code Existing Product Code of the trade
Exchange Name of the exchange, BSE/NSE etc
orderType Order type, LIMIT/MARKET/STOP_LIMIT/STOP_MARKET
{
  "appID": "663051cfbac7d699a1c59b96048b50e7",
  "config": {},
  "data": {
    "type": "eqConvertPositionDao",
    "msg": "PositionConversion Successful"
  },
  "msgID": "d9a51e1c-ff4c-46a0-8eb9-c5d4e2e83087",
  "srvTm": 1620040408431
}