M
how does one get the list of all outstanding gtts in the account. the following is retuning no data while there are actually gtts outstanding in the account
smart_api = SmartConnect(api_key=api_key)
# Login
try:
data = smart_api.generateSession(client_code, pwd, totp)
print("Login response:", json.dumps(data, indent=2))
if data.get('status'):
print("Login successful")
auth_token = data['data']['jwtToken']
refresh_token = data['data']['refreshToken']
feed_token = smart_api.getfeedToken()
print("Feed token:", feed_token)
else:
print("Login failed:", data.get('message'))
return None
except Exception as e:
print(f"Login error: {str(e)}")
return None
# Get the list of GTTs
try:
# Use the correct method: gttLists
gtt_list = smart_api.gttLists(status=['ACTIVE'], page=1, count=10)
print("Raw GTT response:", json.dumps(gtt_list, indent=2))
if isinstance(gtt_list, dict):
if 'status' in gtt_list:
print(f"API Status: {gtt_list['status']}")
if 'message' in gtt_list:
print(f"API Message: {gtt_list['message']}")
if 'errorcode' in gtt_list:
print(f"API Error Code: {gtt_list['errorcode']}")
return gtt_list
except Exception as e:
print(f"An error occurred while fetching GTT orders: {str(e)}")
return None