Depth Acknowledgement
Websocket Depth Acknowledgement API will provide the status of websocket connection to the server.
Request Details
| Parameter | Description |
|---|---|
| t | d ādā represents touchline task |
| 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_touchline('NFO', '59051')
@ws.on_message(MessageTopic.DEPTH_SUB_ACK)
def msg_handler(client: WsClient, message: Any):
print(message)
ws.connect(uid='uid', 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.subscribeDepthAcknowledgement("NSE|26000"))
});
using thefirstock;
var exitEvent = new ManualResetEvent(false);
using (var client = firstock.initializeWebSocket())
{
client.MessageReceived.Subscribe(msg =>
{
Console.WriteLine("Message received: " + msg);
client.Send(firstock.subscribeDepthAcknowledgement("NSE|26000"));
});
client.Start();
client.Send(firstock.startWebsockets());
exitEvent.WaitOne();
}
Subscription Depth Acknowledgement
| Parameter | Description |
|---|---|
| t | represents touchline acknowledgement |
| e | NSE, BSE, NFO .. Exchane name |
| tk | 22 Script token |
| lp | LTP |
| tk | 22 Script token |
| pp | Price precision |
| ts | Trading Symbol |
| ti | Tick size |
| ls | Lot size |
| lp | LTP |
| pc | Percentage change |
| v | volume |
| o | Open price |
| h | High price |
| l | Low price |
| c | Close price |
| ap | Average trade Price |
| ltt | Last trade time |
| oi | Open interest |
| poi | Previous day closing Open Interest |
| toi | Total open interest for underlying |
| bq1 | Best Buy Quantity 1 |
| bp1 | Best Buy Price 1 |
| sq1 | Best Sell Quantity 1 |
| sp1 | Best Sell Price 1 |
| ft | Feed time |
| bq2 | Best Buy Quantity 2 |
| bq3 | Best Buy Quantity 3 |
| bq4 | Best Buy Quantity 4 |
| bq5 | Best Buy Quantity 5 |
| bp2 | Best Buy Price 2 |
| bp3 | Best Buy Price 3 |
| bp4 | Best Buy Price 4 |
| bp5 | Best Buy Price 5 |
| bo1 | Best Buy Orders 1 |
| bo2 | Best Buy Orders 2 |
| bo3 | Best Buy Orders 3 |
| bo4 | Best Buy Orders 4 |
| bo5 | Best Buy Orders 5 |
| sq2 | Best Sell Quantity 2 |
| sq3 | Best Sell Quantity 3 |
| sq4 | Best Sell Quantity 4 |
| sq5 | Best Sell Quantity 5 |
| sp1 | Best Sell Price 1 |
| sp2 | Best Sell Price 2 |
| sp3 | Best Sell Price 3 |
| sp4 | Best Sell Price 4 |
| sp5 | Best Sell Price 5 |
| so1 | Best Sell Orders 1 |
| so2 | Best Sell Orders 2 |
| so3 | Best Sell Orders 3 |
| so4 | Best Sell Orders 4 |
| so5 | Best Sell Orders 5 |
| lc | Lower Circuit Limit |
| uc | Upper Circuit Limit |
| 52h | 52 week high low in other exchanges, Life time high low in mcx |
| 52l | 52 week high low in other exchanges, Life time high low in mcx |