As per one of the posts F&O was a feature to be published in the api. Has it been done yet or is my code not working properly. Thanks
from smartapi import SmartConnect
from constants import *
obj = SmartConnect(api_key=historicalApiKey)
data = obj.generateSession(userName, password)
print(data)
try:
historicParam = {
"exchange": "NSE",
"symboltoken": "constants.niftyToken",
"interval": "ONE_MINUTE",
"fromdate": "2022-05-31 09:00",
"todate": "2022-05-31 15:30"
}
resp = obj.getCandleData(historicParam)
except Exception as e:
print("Historic Api failed: {}".format(e.message))
print(resp)
# logout
try:
logout = obj.terminateSession('Your Client Id')
print("Logout Successfull")
except Exception as e:
print("Logout failed: {}".format(e.message))
Response:
{'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': None}
Logout Successfull
Any help would be much appreciated. @admin