How to unsubscribe and subscribe symbols for web socket.
Any code is available for unsubscribe symbols for getting real time positions?
How to unsubscribe and subscribe symbols for web socket.
Any code is available for unsubscribe symbols for getting real time positions?
You need to use the method attribute, which can be set to ‘sub’ or ‘unsub’.
To unsubscribe:
json
{
"guid": "someguid",
"method": "unsub",
"data": {
"mode": "full",
"instrumentKeys": ["NSE_INDEX|Nifty Bank"]
}
}
To subscribe:
json
{
"guid": "someguid",
"method": "sub",
"data": {
"mode": "full",
"instrumentKeys": ["NSE_INDEX|Nifty Bank"]
}
}
Here is a Python example for reference: Upstox Python WebSocket Market Data Example