I’ve been trying to get the live OHLC market data (basically market starts at 9:30 am to 3:30 pm, time: Asia/Kolkata (Region – India)). I tried smartAPI
which provides us an API for algo trading such as HistoricalData
getLtpData
, but when I tried getLtpData
the live candle data was wrong (plus always same values, not changing at all) when I compared to zerodha/NSE website. The library/API which I’m currently using: https://smartapi.angelbroking.com/docs
Issue: https://github.com/angelbroking-github/smartapi-javascript/issues/13
https://smartapi.angelbroking.com/docs/Orders#ltp
var axios = require('axios');
var data = JSON.stringify({
"exchange":"NSE",
"tradingsymbol":"SBIN-EQ",
"symboltoken":"3045"
});
var config = {
method: 'post',
url: 'https://apiconnect.angelbroking.com/
rest/secure/angelbroking/order/
v1/getLtpData',
headers: {
'Authorization': 'Bearer AUTHORIZATION_TOKEN',
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-UserType': 'USER',
'X-SourceID': 'WEB',
'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
'X-MACAddress': 'MAC_ADDRESS',
'X-PrivateKey': 'API_KEY'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
So, how can I fetch live OHLC data when the market starts?
Are there any other alternatives to this?
I’m in desperate need of help!