Skip to content

Unsubscribe Order Update

Request Details: Parameter

Parameter Description
t uo
‘uo’ represents Unsubscribe Order update

Code

from typing import Any
from thefirstock import thefirstock
from thefirstock.pyClient.websocket import WsClient
from thefirstock.pyClient.websocket.enums import MessageTopic


client = thefirstock.webSocketLogin()
 ws = client.ws


@ws.on_connect
def connected(client, message):
    if message.get('s') == 'OK':
        client.unsubscribe_order('NSE', '22')


@ws.on_message(MessageTopic.ORDER_UNSUB)
def msg_handler(client: WsClient, message: Any):
    print(message)


ws.connect(uid='uid' #Replace with the uid, actid='actid' #Replace with the actid)
ws.run_forever()
const Firstock = require('thefirstock');
const firstock = new Firstock();


const ws = firstock.initializeWebSocket();

ws.on('open', function open() {
    firstock.getWebSocketDetails((err, result) => {
        if (!err) {
            ws.send(result)
        }
    })
});

ws.on("error", function error(error) {
    console.log(`WebSocket error: ${error}`)
})

ws.on('message', function message(data) {
    const result = firstock.receiveWebSocketDetails(data)
    console.log('Result: ', result)
    ws.send(firstock.unsubscribeOrderUpdate())
});

Response Details

Parameter Description
t uok
‘uok’ represents Unsubscribe Order update acknowledgement