Infinn API Documentation
Order and Trades

Positions Book

POST/NorenWClientAPI/PositionBook

Authorization token is required. Enter your access_token from GenAcsTok above.

jData fields

Values are sent as a JSON string in the jData form field.

Logged in User Id

Account Id of logged in user

Authorization Token

Required for all API calls. Use the access_token from the GenAcsTok response as a Bearer token.

Request to be POSTed to url : /NorenWClientAPI/PositionBook

Request Details

Parameter NamePossible valueDescription
jData*Should send json object with fields in below list
Authorization*Bearer <access_token>access_token from GenAcsTok response. Required for all API calls.
Json FieldsPossible valueDescription
uid*Logged in User Id
actid*Account Id of logged in user

Example

curl https://apitest.kambala.co.in/NorenWClientAPI/PositionBook \
    -d "jData={\"uid\":\"VIDYA\", \"actid\":\"ACCT_1\"}" \
    -d "jKey=GHUDWU53H32MTHPA536Q32WR"

Response Details

Response data will be in json format with Array of Objects with below fields in case of success:

Json FieldsPossible valueDescription
statOk or Not_OkPosition book success or failure indication.
exchExchange segment
tsymTrading symbol / contract.
tokenContract token
uidUser Id
actidAccount Id
prdProduct name to be shown.
s_prdt_aliProduct display name
netqtyNet Position quantity
netavgprcNet position average price
dayavgprcDay average price
daybuyqtyDay Buy Quantity
daysellqtyDay Sell Quantity
daybuyavgprcDay Buy average price
daysellavgprcDay buy average price
daybuyamtDay Buy Amount
daysellamtDay Sell Amount
cfbuyqtyCarry Forward Buy Quantity
cforgavgprcOriginal Avg Price
cfsellqtyCarry Forward Sell Quantity
cfbuyavgprcCarry Forward Buy average price
cfsellavgprcCarry Forward Buy average price
cfbuyamtCarry Forward Buy Amount
cfsellamtCarry Forward Sell Amount
totbuyamtTotal Buy Amount
totsellamtTotal Sell Amount
totbuyavgprcTotal Buy Avg Price
totsellavgprcTotal Sell Avg Price
lpLTP
rpnlRealizedPNL
urmtomUnrealizedMTOM. Can be recalculated in LTP update = netqty * (lp from web socket - netavgprc) * prcftr
bepBreak even price
openbuyqtyOpen Buy Quantity
opensellqtyOpen Sell Quantity
openbuyamtOpen Buy Amount
opensellamtOpen Sell Amount
openbuyavgprcOpen Buy Average Price
opensellavgprcOpen Sell Average Price
multContract price multiplier, (used for order value calculation)
ppPrice precision
prcftrgnpn/(gdpd).
tiTick size
lsLot size
instnameInstrument Name
upldprcUpload price
netupldprcNet Upload Price
dnameBroker specific contract display name, present only if applicable.
cnameCompany Name.
request_timeThis will be present only in a failure response.

Note: Calculation of MTM and PnL

  1. ActualUnrealizedMtoM = netqty(in weights) * prcftr * mult * (LTP - avgprc)

    • For MTM, avgprc = netavgprc
    • For PnL, avgprc = netupldprc; if netupldprc = 0 then avgprc = netavgprc
  2. NetBuyQty = daybuyqty + cfbuyqty

  3. NetSellQty = daysellqty + cfsellqty

  4. ActualSellAvgPrice

    • if (NetSellQty != 0):
      ActualSellAvgPrice = ((daysellamt / mult) + (upldprc * prcftr * cfsellqty)) / NetSellQty
    • else:
      ActualSellAvgPrice = 0.0
  5. ActualBuyAvgPrice

    • if (NetBuyQty != 0):
      ActualBuyAvgPrice = ((daybuyamt / mult) + (upldprc * prcftr * cfbuyqty)) / NetBuyQty
    • else:
      ActualBuyAvgPrice = 0.0
  6. ActualBookedPNL

    • if (netqty(in weights) > 0):
      ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetSellQty * mult
    • else:
      ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetBuyQty * mult
  7. MTM = rpnl + ActualUnrealizedMtoM

  8. PnL = ActualBookedPNL + ActualUnrealizedMtoM

Sample Success Response

[
    {
        "stat":"Ok",
        "uid":"POORNA",
        "actid":"POORNA",
        "exch":"NSE",
        "tsym":"ACC-EQ",
        "prarr":"C",
        "pp":"2",
        "ls":"1",
        "ti":"5.00",
        "mult":"1",
        "prcftr":"1.000000",
        "daybuyqty":"2",
        "daysellqty":"2",
        "daybuyamt":"2610.00",
        "daybuyavgprc":"1305.00",
        "daysellamt":"2610.00",
        "daysellavgprc":"1305.00",
        "cfbuyqty":"0",
        "cfsellqty":"0",
        "cfbuyamt":"0.00",
        "cfbuyavgprc":"0.00",
        "cfsellamt":"0.00",
        "cfsellavgprc":"0.00",
        "openbuyqty":"0",
        "opensellqty":"23",
        "openbuyamt":"0.00",
        "openbuyavgprc":"0.00",
        "opensellamt":"30015.00",
        "opensellavgprc":"1305.00",
        "netqty":"0",
        "netavgprc":"0.00",
        "lp":"0.00",
        "urmtom":"0.00",
        "rpnl":"0.00",
        "cforgavgprc":"0.00"
    }
]

Sample Failure Response

{
    "stat":"Not_Ok",
    "request_time":"14:14:11 26-05-2020",
    "emsg":"Error Occurred : 5 \"no data\""
}
curl --request POST \
  --url 'https://api.infinn.in/NorenWClientAPI/PositionBook' \
  --header 'Content-Type: text/plain' \
  --data 'jData={}'
Response will appear here after sending a request