5Paisa API Commodity Position Problem

5Paisa’s end URL in the API for checking positions in their documentation is

https://openapi.5paisa.com/VendorsAPI/Service1.svc/V1/NetPositionNetWise

When there is a commodity position that is carryforward. It starts to act strangely. You can see the response below.


 {'BodQty': 9,
  'BookedPL': 0,
  'BuyAvgRate': 0,
  'BuyQty': 2250,
  'BuyValue': 0,
  'Exch': 'M',
  'ExchType': 'D',
  'LTP': 194.7,
  'MTOM': 109518750,
  'Multiplier': 250,
  'NetQty': 2250,
  'OrderFor': 'D',
  'PreviousClose': 197.8,
  'ScripCode': 254229,
  'ScripName': 'NATGASMINI 25 Apr 2023',
  'SellAvgRate': 0,
  'SellQty': 0,
  'SellValue': 0},

It shows an absurd MTM which disbalances everything.

But it is getting the data for its own application from another API EndPoint https://swaraj.5paisa.com/Mob/Service1.svc/V2/NetPositionNetWise

That gives correct data.

And companies like Sensibull decided to skip MCX because of this issue.

I am following the same. Pinakin System is maintaining the order_data from internal orderbook while other systems who does not store past data will show about this error and link to this page and completely omit MCX trades from the results.

try:
  positions_data = positions_data[positions_data["Exch"]!="M"]
  #Excluding the Commmodity Data. Because - 
except:
  pass

The dataframe is constructed with the trades which is “not MCX”.

So previously it used to look like this weird-

This looks like this -

Although the MTM is totally wrong.

Wait the MTM is totally wrong. The entire BankNIFTY trades are intraday. Let me disable the MTM field if the broken is 5paisa!

But I think I will do that in JS in the frontend of my system as it is temporary. The report() function from the backend is interconnected with too many things.