getcandledata throwing error
-
When accessing candle data from api following error occurs. Please suggest a work around
script : https://github.com/vhatkar/Algo_Test/blob/main/ema_indicator_query.py
ERROR:
[E 250131 13:04:14 smartConnect:243] Error occurred while making a POST request to https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData. Error: Invalid Token. URL: https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData, Headers: {'Content-type': 'application/json', 'X-ClientLocalIP': '127.0.0.1', 'X-ClientPublicIP': '106.193.147.98', 'X-MACAddress': 'bf:14:c0:80:c3:3a', 'Accept': 'application/json', 'X-PrivateKey': 'liiHdetf', 'X-UserType': 'USER', 'X-SourceID': 'WEB'}, Request: {'exchange': 'NSE', 'symboltoken': 'SBIN-EQ', 'interval': '15min', 'fromdate': '2025-01-01 09:15', 'todate': '2025-01-27 15:30'}, Response: {'success': False, 'message': 'Invalid Token', 'errorCode': 'AG8001', 'data': ''}
+++ after getcandle data {'success': False, 'message': 'Invalid Token', 'errorCode': 'AG8001', 'data': ''} -
@MMN5468 the symbol token is the numeric token that you can find through the instrument master.
eg. for SBIN-EQ on NSE, it is 3045.
Link is here - https://margincalculator.angelone.in/OpenAPI_File/files/OpenAPIScripMaster.json