From c967075521a16437f2b211d168e38b247cb55e48 Mon Sep 17 00:00:00 2001 From: khushal Date: Thu, 26 Dec 2024 14:36:48 +0530 Subject: [PATCH] (20241226) Timestamp handling bug fixed for instruments that don't have any expiry. --- api/blueprints/finstitutions/trading/symbols/list.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/blueprints/finstitutions/trading/symbols/list.py b/api/blueprints/finstitutions/trading/symbols/list.py index b3315cc..3b52a30 100644 --- a/api/blueprints/finstitutions/trading/symbols/list.py +++ b/api/blueprints/finstitutions/trading/symbols/list.py @@ -25,8 +25,7 @@ N/A """ - - +import datetime # ***************************************************************************************************************** # ***** **** # *** IMPORT *** @@ -195,7 +194,10 @@ async def request_oauth_authorization_url( # Handle time data: data = [s.model_dump() for s in symbol_list.data] if symbol_list.data is not None else symbol_list.data - for d in data: d["expiryTs"] = d["expiryTs"].timestamp() + for d in data: + expiry_ts = d["expiryTs"] + if isinstance(expiry_ts, datetime.datetime): + d["expiryTs"] = expiry_ts.timestamp() # Done here: return ResponseModel(