@Moderator_2
Should i use API key or secret key?
Posts made by NileshJak
-
RE: Invalid token Unable to retreive historical data
-
Invalid token Unable to retreive historical data
I am new to Angel API, I used Below link to refer code to retreive historical data api
https://smartapi.angelbroking.com/docs/HistoricalBelow is my code
import http.client
conn = http.client.HTTPSConnection("apiconnect.angelbroking.com")
payload = "{\r\n "exchange": "NSE",\r\n "symboltoken": "99926002",\r\n "interval": "FIVE_MINUTE",\r\n "fromdate": "2024-01-16 09:20",\r\n "todate": "2024-01-16 12:00"\r\n}"headers = {
'X-PrivateKey': '763f0fda-29c4-4a32-9bd6-a42b1d511895',
'Accept': 'application/json',
'X-SourceID': 'WEB',
'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
'X-MACAddress': 'MAC_ADDRESS',
'X-UserType': 'USER',
'Authorization': 'Bearer AUTHORIZATION_TOKEN',
'Accept': 'application/json',
'X-SourceID': 'WEB',
'Content-Type': 'application/json/'
}
conn.request("POST", "/rest/secure/angelbroking/historical/v1/getCandleData/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))below is error:
{"success":false,"message":"Invalid Token","errorCode":"AG8001","data":""}