Hello team


  • How can I check either the particular order was exit at profit or loss by using the orderid ?

    thanks.


  • @Mr-Depp

    use

    'symboltoken':

    as well as

    'tradingsymbol': '

    from position extract to find the position of particular trade of a particular instrument (reliance in your case ) so that you can find its 'pnl'


  • @Mnagesh But there is no order id is available in the getposition.
    i want to manage everything based on order id because i want to calculate how each orders are executed rather than displaying the sum of all order. for example if i buy reliance and at 1000 and again i buy another qty after some time in the same script reliance than system will show the average price but that is not my concern. i want to separate entry by the order id not the over all average price.


  • @Mr-Depp by order Id it will not give profit or loss directly.

    Method 1:
    You need two order execution
    One for buy and one for sell

    After execution of byt and sell
    Or
    Sell and buy

    You will be having two order Ids

    Then you can fetch trade book

    From trade book you need to identify this particular two trades and process further to find pnl

    Method 2:
    The direct method is use position and you will be having clear picture at any point of time like realised gain , unrealised gain and as well as profit/loss pnl at the same time.


  • @Mr-Depp
    obj.position() function in python will give you 'realised': and 'unrealised': values

    so that you can know profit or lose
    it also gives 'pnl' field

    check the example given below which was trade done today by me using smartapi python and go through various fields and try to understand.

    position:

    {'status': True,
    'message': 'SUCCESS',
    'errorcode': '',
    'data': [{'symboltoken': '53735',
    'symbolname': 'NIFTY',
    'instrumenttype': 'FUTIDX',
    'priceden': '1.00',
    'pricenum': '1.00',
    'genden': '1.00',
    'gennum': '1.00',
    'precision': '2',
    'multiplier': '-1',
    'boardlotsize': '1',
    'exchange': 'NFO',
    'producttype': 'CARRYFORWARD',
    'tradingsymbol': 'NIFTY28JUL22FUT',
    'symbolgroup': 'XX',
    'strikeprice': '-1',
    'optiontype': 'XX',
    'expirydate': '28JUL2022',
    'lotsize': '50',
    'cfbuyqty': '0',
    'cfsellqty': '0',
    'cfbuyamount': '0.00',
    'cfsellamount': '0.00',
    'buyavgprice': '15782.05',
    'sellavgprice': '15798.78',
    'avgnetprice': '0.00',
    'netvalue': '1672.50',
    'netqty': '0',
    'totalbuyvalue': '1578205.00',
    'totalsellvalue': '1579877.50',
    'cfbuyavgprice': '0.00',
    'cfsellavgprice': '0.00',
    'totalbuyavgprice': '15782.05',
    'totalsellavgprice': '15798.78',
    'netprice': '0.00',
    'buyqty': '100',
    'sellqty': '100',
    'buyamount': '1578205.00',
    'sellamount': '1579877.50',
    'pnl': '1673.00',
    'realised': '1673.00',
    'unrealised': '-0.00',
    'ltp': '15819.85',
    'close': '15847.35'}]}