Hi All,
I am trying to fetch MCX:CRUDEOIL22DECFUT using the websocket connection.
I get an empty response : res {"s":"ok","d":{"7202":[],"7208":[],"31038":[]}}
I am able to get the quotes for the same symbol but it somehow does not work on the websocket
Below is my code
USING WEBSOCKET:const reqBody = {
symbol: ["MCX:CRUDEOIL22DECFUT"],
dataType: "symbolUpdate",
};
fyers.fyers_connect(reqBody, function (result) {
console.log("res", result);
});
Response: res {"s":"ok","d":{"7202":[],"7208":[],"31038":[]}
USING REST API TO GET QUOTES:async function getQuotes() {
const quotes = new fyers.quotes();
const result = await quotes.setSymbol("MCX:CRUDEOIL22DECFUT").getQuotes();
console.log(result.d[0].v);
}
getQuotes();
Response: {
ch: -286,
chp: -4.26,
lp: 6434,
spread: 1,
ask: 6436,
bid: 6435,
open_price: 6673,
high_price: 6734,