Current positions data through web socket


Please provide current positions and pnl of current position provide through web socket.

I am trying to fetch current positions for every second and trying to check pnl but its getting delayed result and that too data is not consistent sometimes getting empty data of current positions.

To check pnl of current positions needs to check mobile app or website this not good. For next version please provide pnl realized and unrealized pnl and other info through websocket so that no need to check mobile.

Hey @Chaitanya_Kalyani

Sorry for the trouble - yes we’re aware that the P&L result on REST comes with slightly delayed market data. We’re working on getting the P&L data on the REST call to reflect with the latest market data. Aiming to get this improvement done by this month.

Hello @shrini

Instead of REST please update position data with web socket for consist and reliable data.

Dont provide too many parameters as well like buy qty and sell qty as different parameters provide like 50 for buy and -50 for sell because of that getting lot of problems for extracting data and getting required things.

Make api simple as much as possible which can be understood by very beginner as well.

If you want check for fyers v3 they have done very good job in this but due to trust factors i am looking for Upstox.

Make api free for lifetime almost all brokers providing api as free.

I hope you will take this feedback and you will improve this thing.

Hi @Chaitanya_Kalyani

Noted your feedback. Will take a look and get back on this. Thanks for your suggestions.

Hi @Chaitanya_Kalyani

Just to keep you posted. Not just position update but also holdings update events would be useful. The good news is we already support both of these events in our WebSockets for our platforms so extending to API won’t be super difficult.

What we need to double check are whether it will break existing users of WS and how to handle it gracefully.

Today we’re releasing an update to send all order updates to WebSocket (whether placed on API or not). Following that up with updating the P&L numbers sent on getPositions call to be more recent (instead of 1 min). After that, we’ll take this up and find a way to deploy it in a way that it doesn’t break existing implementations.

Also - API is and will remain free! What we are promoting right now is zero brokerage on API until end of Feb :slight_smile:

Hello @shrini ,

Thanks a lot for taking feedback in positive way and implementing on high priority.

If API will remain free then my efforts will not be wasted and this will help to each and everyone.

Hoping that whatever you told will come soon into implementation.

1 Like

Hello @shrini ,

Thanks a lot for quick response.

How much time I can expect for position update through web socket?

If its short then I can hold my software update regarding that?

Haven’t fully scoped it yet to give you a timeline right now. Whatever changes will come through - we are going to see that it doesn’t break existing implementations

Hello @shrini ,

Is there any update about this?

I am not big fan of writing too much complicated code.

Eagerly waiting for this update. Please release new update as soon as possible.

Hi @Chaitanya_Kalyani

Understood. It’ll take a month to get this out so would recommend you wait or use the code you have right now.

Hello @shrini ,

I have implemented my own logic for fetching Realtime but now facing issue with websocket.

After implementation facing frequent websocket disconnection. Before implementation I was not observed this behaviour.

How to handle this scenario? I am not much expert in python.

I am suspecting because one common variable is updated in web socket code which is async and reading the same variable in thread at the interval of100ms.

Is it correct or any other method can i use for implementation.

There should be no relation between websocket and REST calls. Both are independent and using one doesn’t impact the other.

I’m not sure what your code looks like, might be helpful to post it or have someone else look at it.