Skip to content

PositionBook

Get all current open positions for the trading day.

Endpoint URL

http
Local Host   :  POST http://127.0.0.1:5000/api/v1/positionbook
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/positionbook
Custom Domain:  POST https://<your-custom-domain>/api/v1/positionbook

Sample API Request

json
{
  "apikey": "<your_app_apikey>"
}

Sample cURL Request

bash
curl -X POST http://127.0.0.1:5000/api/v1/positionbook \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>"
}'

Sample API Response

json
{
  "status": "success",
  "data": [
    {
      "symbol": "NHPC",
      "exchange": "NSE",
      "product": "MIS",
      "quantity": "-1",
      "average_price": "83.74",
      "ltp": "83.72",
      "pnl": "0.02"
    },
    {
      "symbol": "RELIANCE",
      "exchange": "NSE",
      "product": "MIS",
      "quantity": "0",
      "average_price": "0.0",
      "ltp": "1189.9",
      "pnl": "5.90"
    },
    {
      "symbol": "YESBANK",
      "exchange": "NSE",
      "product": "MIS",
      "quantity": "-104",
      "average_price": "17.2",
      "ltp": "17.31",
      "pnl": "-10.44"
    }
  ]
}

Request Body

ParameterDescriptionMandatory/OptionalDefault Value
apikeyYour Tradeboard API keyMandatory-

PositionbookSchema declares only apikey. Any other field returns HTTP 400.

Response Fields

FieldTypeDescription
statusstring"success" or "error"
dataarrayArray of position objects

Position Object Fields

FieldTypeDescription
symbolstringTrading symbol
exchangestringExchange code
productstringMIS, CNC, NRML
quantitystringNet position quantity
average_pricestringAverage entry price
ltpstringLast traded price
pnlstringProfit/Loss

Understanding Position Quantity

QuantityMeaning
Positive (+ve)Long position
Negative (-ve)Short position
Zero (0)Closed position (still shows today's P&L)

Notes

  • Returns all positions including closed ones (quantity = 0)
  • Closed positions show the realized P&L for the day
  • average_price is the weighted average entry price
  • ltp is the current market price
  • pnl = (LTP - Average Price) × Quantity (for long), reverse for short
  • For F&O positions, ensure lot size alignment

Use Cases

  • Position monitoring: Track all open positions
  • P&L tracking: View real-time profit/loss
  • Risk management: Monitor position sizes

Back to: API Documentation