Portfolio

A user's portfolio consists of long term equity holdings and short term positions. The portfolio APIs return instruments in a portfolio with up-to-date profit and loss computations.

type endpoint  
GET /portfolio/holdings Retrieve the list of long term equity holdings
GET /portfolio/positions Retrieve the list of short term positions
PUT /portfolio/positions Convert the margin product of an open position

Holdings

Holdings contain the user's portfolio of long term equity delivery stocks. An instrument in a holdings portfolio remains there indefinitely until its sold or is delisted or changed by the exchanges. Underneath it all, instruments in the holdings reside in the user's DEMAT account, as settled by exchanges and clearing institutions.

curl "https://api.kite.trade/portfolio/holdings" \
    -H "X-Kite-Version: 3" \
    -H "Authorization: token api_key:access_token"
{
  "status": "success",
  "data": [{
    "tradingsymbol": "ABHICAP",
    "exchange": "BSE",
    "isin": "INE516F01016",
    "quantity": 1,
    "t1_quantity": 1,

    "average_price": 94.75,
    "last_price": 93.75,
    "pnl": -100.0,

    "product": "CNC",
    "collateral_quantity": 0,
    "collateral_type": null
  }, {
    "tradingsymbol": "AXISBANK",
    "exchange": "NSE",
    "isin": "INE238A01034",
    "quantity": 1,
    "t1_quantity": 0,

    "average_price": 475.0,
    "last_price": 432.55,
    "pnl": -42.50,

    "product": "CNC",
    "collateral_quantity": 0,
    "collateral_type": null
  }]
}

Response attributes

attribute  
tradingsymbolstring Exchange tradingsymbol of the instrument
exchangestring Exchange
isinstring The standard ISIN representing stocks listed on multiple exchanges
quantityint Quantity held
t1_quantityint Quanity on T+1 day after order execution. Stocks are usually delivered into DEMAT accounts on T+2 ?
average_pricefloat Average price at which the net holding quantity was acquired
last_pricefloat Last traded market price of the instrument
pnlfloat Net returns on the stock; Profit and loss
productstring Margin product applied to the holding
collateral_quantityint Quantity used as collateral
collateral_typenull,string Type of collateral

Positions

Positions contain the user's portfolio of short to medium term derivatives (futures and options contracts) and intraday equity stocks. Instruments in the positions portfolio remain there until they're sold, or until expiry, which, for derivatives, is typically three months. Equity positions carried overnight move to the holdings portfolio the next day.

The positions API returns two sets of positions, net and day. net is the actual, current net position portfolio, while day is a snapshot of the buying and selling activity for that particular day. This is useful for computing intraday profits and losses for trading strategies.

curl "https://api.kite.trade/portfolio/positions" \
    -H "X-Kite-Version: 3" \
    -H "Authorization: token api_key:access_token"
{
  "status": "success",
  "data": {
    "net": [{
      "tradingsymbol": "NIFTY15DEC9500CE",
      "exchange": "NFO",
      "instrument_token": 41453,
      "product": "NRML",

      "quantity": -100,
      "overnight_quantity": -100,
      "multiplier": 1,

      "average_price": 3.475,
      "close_price": 0.75,
      "last_price": 0.75,
      "value": 75.0,
      "pnl": 272.5,
      "m2m": 0.0,
      "unrealised": 0.0,
      "realised": 0.0,

      "buy_quantity": 0,
      "buy_price": 0,
      "buy_value": 0.0,
      "buy_m2m": 0.0,

      "day_buy_quantity": 0,
      "day_buy_price": 0,
      "day_buy_value": 0.0,

      "day_sell_quantity": 0,
      "day_sell_price": 0,
      "day_sell_value": 0.0,

      "sell_quantity": 100,
      "sell_price": 3.475,
      "sell_value": 347.5,
      "sell_m2m": 75.0
    }],
    "day": []
  }
}

Response attributes

attribute  
tradingsymbolstring Exchange tradingsymbol of the instrument
exchangestring Exchange
instrument_tokenstring The numerical identifier issued by the exchange representing the instrument. Used for subscribing to live market data over WebSocket
productstring Margin product applied to the position
quantityint Quantity held
overnight_quantityint Quantity held previously and carried forward over night
multiplierint The quantity/lot size multiplier used for calculating P&Ls.
average_pricefloat Average price at which the net position quantity was acquired
close_pricefloat Closing price of the instrument from the last trading day
last_pricefloat Last traded market price of the instrument
valuefloat Net value of the position
pnlfloat Net returns on the position; Profit and loss
m2mfloat Mark to market returns (computed based on the last close and the last traded price)
unrealisedfloat Unrelaised intraday returns
realisedfloat Realised intraday returns
buy_quantityint Quantity bought and added to the position
buy_pricefloat Average price at which quantities were bought
buy_valuefloat Net value of the bought quantities
buy_m2mfloat Mark to market returns on the bought quantities
day_buy_quantityint Quantity bought and added to the position during the day
day_buy_pricefloat Average price at which quantities were bought during the day
day_buy_valuefloat Net value of the quantities bought during the day
sell_quantityint Quantity sold off from the position
sell_pricefloat Average price at which quantities were sold
sell_valuefloat Net value of the sold quantities
sell_m2mfloat Mark to market returns on the sold quantities
sell_buy_quantityint Quantity sold off from the position during the day
sell_buy_pricefloat Average price at which quantities were sold during the day
sell_buy_valuefloat Net value of the quantities sold during the day

Position conversion

All positions held are of specific margin products such as NRML, MIS etc. A position can have one and only one margin product. These products affect how the user's margin usage and free cash values are computed, and a user may want to covert or change a position's margin product from time to time. More on margin policies.

curl --request PUT https://api.kite.trade/portfolio/positions
    -H "X-Kite-Version: 3" \
    -H "Authorization: token api_key:access_token" \
    -d "tradingsymbol=INFY" \
    -d "exchange=NSE" \
    -d "transaction_type=BUY" \
    -d "position_type=overnight" \
    -d "quantity=3" \
    -d "old_product=NRML" \
    -d "new_product=MIS"
{
  "status": "success",
  "data": true
}

Request parameters

parameter  
tradingsymbol Tradingsymbol of the instrument
exchange Name of the exchange
transaction_type BUY or SELL
position_type overnight or day
quantity Quantity to convert
old_product Existing margin product of the position
new_product Margin product to convert to

Exiting holdings and positions

There are no special API calls for exiting instruments from holdings and positions portfolios. The way to do it is to place an opposite BUY or SELL order depending on whether the position is a long or a short (MARKET order for an immediate exit). It is important to note that the exit order should carry the same product as the existing position. If the exit order is of a different margin product, it may be treated as a new position in the portfolio.