Get Historical Data
-
My Login ID is A734010
I am able to Login and get different type of data like
Funds and Margins, Generate Tokens and Get Profile to name a few. However when I try to access the GetCandleData I get an error saying Invalid Token. The response code is 400 and the error is AG8001.
Here is the code:
var axios = require('axios');
var data = JSON.stringify({"exchange":"NSE","symboltoken":"2885",
"interval":"FIVE_MINUTE","fromdate":"2021-11-08 09:00",
"todate":"2021-11-08 09:20"});var config = {
method: 'post',
url: 'https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData',
headers: {
'X-PrivateKey': 'XXXXXXXX',
'Accept': 'application/json, application/json',
'X-SourceID': 'WEB, WEB',
'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
'X-MACAddress': 'MAC_ADDRESS',
'X-UserType': 'USER',
'Authorization': 'Bearer XXXXXXXXX',
'Content-Type': 'application/json'
},
data : data
};axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});Could you kindly let me know where I am going wrong
-
I am able to access the data. I was sending the headers wrong. The X_SOURCEID and Accept parameters were send twice per say:
'X-SourceID': 'WEB, WEB' has to be 'X-SourceID': 'WEB'Thank You very Much.
Much appreciated. -
I have emailed the respective EMAILID that you have provided but I did not get a response.
Can you kindly check.
Thanks,
Akey Venkat -
HI @RK Kinldy connect us at api@anglebroking.com as it is hard to debug looking at your code.