Historical prices not working
-
@admin hi,
tried the code from below link not working for me:
https://smartapi.angelbroking.com/docs/Historicalplease can you share a working example of code, will help a lot
thanks
Sukhwant -
HI @Sukhwant280 find the sample code below:
historicParam={
"exchange": "NSE",
"symboltoken": "14977",
"interval": "FIFTEEN_MINUTE",
"fromdate": '2021-07-01 09:41',
"todate": '2021-07-29 10:41'
}
df = obj.getCandleData(historicParam)
print (df) -
@admin thanks a lot for the below code, but its not complete. so i tried at my end using your code and in rest api. and i am getting error. below is my code, Please let me know where i am going wrong.
error message: TypeError: can't concat str to bytes
FYI - new to python
thnaks
Sukhwantimport http.client conn = http.client.HTTPSConnection("apiconnect.angelbroking.com") historicParam={ "exchange": "NSE", "symboltoken": "14977", "interval": "FIFTEEN_MINUTE", "fromdate": '2021-07-01 09:41', "todate": '2021-07-29 10:41' } headers = { 'X-PrivateKey': 'API_KEY', '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", historicParam, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
-
@admin - any update mate
-
HI @Sukhwant280 we will update you soon.
-
i got the solution from this link of yours:
https://smartapi.angelbroking.com/topic/1194/basic-smartapi-integration-using-pythonthanks a lot. consider this thread as closed from my side.