Order Acknowledgement
Websocket TouchLine order Acknowledgement will provide the status of websocket connection to the server.
Request Details
Parameter | Description |
---|---|
t | ok ‘o’ represents order update subscription |
k | One or more scriplist for subscription. Example NSE 22#BSE |
Code
from typing import Any
from thefirstock.firstockModules import firstockWebSockets
from thefirstock.pyClient.websocket import WsClient
from thefirstock.pyClient.websocket.enums import MessageTopic
client = firstockWebSockets.webSocketLogin()
ws = client.ws
@ws.on_connect
def connected(client, message):
if message.get('s') == 'OK':
client.subscribe_order('actid')
@ws.on_message(MessageTopic.ORDER_SUB_ACK)
def msg_handler(client: WsClient, message: Any):
print(message)
ws.connect(uid='actid', actid='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.subscribeOrderAcknowledgement())
});
var exitEvent = new ManualResetEvent(false);
using (var client = firstock.initializeWebSocket())
{
client.MessageReceived.Subscribe(msg =>
{
Console.WriteLine("Message received: " + msg);
client.Send(firstock.subscribeOrderAcknowledgement("NSE|22"));
});
client.Start();
client.Send(firstock.startWebsockets());
exitEvent.WaitOne();
}
Order subscription Acknowledgement
Parameter | Description |
---|---|
t | ‘ok’ represents order update subscription acknowledgement |
Sample Response
{
't': 'ok',
}