get quotes index in sensex
-
@swarup Hi, Some update I want to give. I again downloaded the script.json file.
From https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json
Then converted to csv file.
After opening it in Excel I found some tokens which are,[ {"NIFTY IT" : "26008"},{"NIFTY 100": "26012"},{"NIFTY MIDCAP 50": "26014"}]
I search a lot but can't find the correct tokens.
Intersecting thing is that nifty it and nifty 100 have symbols with CNXIT and CNX100 which is similar to yahoo finance symbol. But what about the other symbols. Mainly SENSEX.
Thank you in advance. -
@swarup I have another question also. As per the documentation I have to pass 'sfi' for index feed but when I pass 'sfi' task. I am unable to get values. As per my code, After 3 sec I get a message in console, 'socket closed'. I tried my many times but in vain
-
@admin I don't know what the tokens are. Please share the tokens for the indices
-
Hi @swarup You have not passed other tokens in websocket code.
-
@admin Yes. How can I do that....
-
let socket={}; soket.index=function (userid,feedtoken){ let { SmartAPI, WebSocket } = require("smartapi-javascript"); let web_socket = new WebSocket({ client_code: userid, feed_token: feedtoken }); web_socket.connect() .then(() => { web_socket.runScript("nse_cm|26000&nse_cm|26009", "mw") setTimeout(function () { web_socket.close() }, 3000) }) web_socket.on('tick', receiveTick); function receiveTick(data) { console.log("receiveTick:::::", data) } } //Now I am calling the function socket.index('my userid','feed token I get from login');
-
Hi @swarup post your websocket code here.
-
HI @swarup You want to subscribe to other tokens correct..?
-
@admin I find only nifty 50 and nifty bank. where are rest. Are they in another name.
I have used Nodejs SDK to subscribe websocket. I used filter method to filter out token. Here is my code :-function search(symbol){ let fs=require('fs'); let script=fs.readFileSync('path to the file'); let decoded_script=JSON.parse(script,''utf8); let filter=decoded_script.filter(i => i.symbol===symbol); console.log(filter); } search('SENSEX'); //It returns [{}]; //Where If I search nifty It returns [ { token: '26000', symbol: 'NIFTY', name: 'NIFTY', expiry: '', strike: '-1.000000', lotsize: '-1', instrumenttype: '', exch_seg: 'NSE',tick_size: '-1.000000' } ]
Is it wrong? Help me...........
-
HI @swarup You can subscribe to those token which are available in json file.