(20241224) Live Feed From Kafka (to test).
This commit is contained in:
@@ -156,6 +156,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
mongo_data_conn: AsyncMongo,
|
||||
auth_token: CoreAuthTokenModel,
|
||||
token_notes: dict,
|
||||
display_name: str = None,
|
||||
display_picture: str = None,
|
||||
session_token: str = None,
|
||||
) -> ObjectId:
|
||||
|
||||
@@ -166,6 +168,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
:param mongo_data_conn: The database connection (MongoDB) to use to perform the action.
|
||||
:param auth_token: An instance of the core auth-token model that holds data in the database.
|
||||
:param token_notes: Any notes to feed into MariaDB with the token identifier.
|
||||
:param display_name: The name of the user to user as their display name.
|
||||
:param display_picture: The URL at which you will find a display picture of the user.
|
||||
:param session_token: The session token of the user who requested this service.
|
||||
:return: An ObjectId to later store the granted tokens.
|
||||
"""
|
||||
@@ -230,8 +234,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
auth_token.client, # ............................................ 'p_provider'
|
||||
auth_token.status, # ............................................ 'p_current_status'
|
||||
"Auth Requested", # ............................................. 'p_last_action'
|
||||
None, # ......................................................... 'p_display_name'
|
||||
None, # ......................................................... 'p_display_picture'
|
||||
display_name, # ................................................. 'p_display_name'
|
||||
display_picture, # .............................................. 'p_display_picture'
|
||||
mongo_json["key"], # ............................................ 'p_token_id'
|
||||
json.to_string(python_data = token_notes, no_space = True), # ... 'p_notes'
|
||||
auth_token.user.userId # ........................................ 'p_created_by'
|
||||
@@ -249,6 +253,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
token_key: ObjectId | str,
|
||||
auth_token: CoreAuthTokenModel,
|
||||
token_notes: dict,
|
||||
display_name: str = None,
|
||||
display_picture: str = None,
|
||||
session_token: str = None
|
||||
) -> bool:
|
||||
|
||||
@@ -261,6 +267,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
:param token_key: The identifier granted by the 'generate_token_key' method.
|
||||
:param auth_token: The actual auth/token data to be saved to the database.
|
||||
:param token_notes: Any notes to feed into MariaDB with the token identifier.
|
||||
:param display_name: The name of the user to user as their display name.
|
||||
:param display_picture: The URL at which you will find a display picture of the user.
|
||||
:param session_token: The session token of the user who requested this service.
|
||||
:return: True if saved, False if failed.
|
||||
"""
|
||||
@@ -320,8 +328,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
mongo_json["client"], # ......................................... 'p_provider'
|
||||
auth_token.status, # ............................................ 'p_current_status'
|
||||
"Auth Granted", # ............................................... 'p_last_action'
|
||||
auth_token.token.get("displayName"), # .......................... 'p_display_name'
|
||||
auth_token.token.get("displayPictureUrl"), # .................... 'p_display_picture'
|
||||
display_name, # ................................................. 'p_display_name'
|
||||
display_picture, # .............................................. 'p_display_picture'
|
||||
token_key, # .................................................... 'p_token_id'
|
||||
json.to_string(python_data = token_notes, no_space = True), # ... 'p_notes'
|
||||
auth_token.user.userId # ........................................ 'p_created_by'
|
||||
@@ -339,6 +347,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
mongo_data_conn: AsyncMongo,
|
||||
auth_token: CoreAuthTokenModel,
|
||||
token_notes: dict,
|
||||
display_name: str = None,
|
||||
display_picture: str = None,
|
||||
session_token: str = None
|
||||
) -> bool:
|
||||
|
||||
@@ -349,6 +359,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
:param mongo_data_conn: The database connection (MongoDB) to use to perform the action.
|
||||
:param auth_token: The actual auth/token data to be saved to the database.
|
||||
:param token_notes: Any notes to feed into MariaDB with the token identifier.
|
||||
:param display_name: The name of the user to user as their display name.
|
||||
:param display_picture: The URL at which you will find a display picture of the user.
|
||||
:param session_token: The session token of the user who requested this service.
|
||||
:return: True if saved, False if failed.
|
||||
"""
|
||||
@@ -358,11 +370,13 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
|
||||
# Get a token id (and receive its key):
|
||||
token_key = await self.generate_token_key(
|
||||
sql_conn = sql_conn,
|
||||
mongo_data_conn = mongo_data_conn,
|
||||
auth_token = auth_token,
|
||||
token_notes = token_notes,
|
||||
session_token = session_token
|
||||
sql_conn = sql_conn,
|
||||
mongo_data_conn = mongo_data_conn,
|
||||
auth_token = auth_token,
|
||||
token_notes = token_notes,
|
||||
display_name = display_name,
|
||||
display_picture = display_picture,
|
||||
session_token = session_token
|
||||
)
|
||||
|
||||
# Immediately save the details against that token id:
|
||||
@@ -372,6 +386,8 @@ class CoreAuthTokenController(CoreBaseModel):
|
||||
token_key = token_key,
|
||||
auth_token = auth_token,
|
||||
token_notes = token_notes,
|
||||
display_name = display_name,
|
||||
display_picture = display_picture,
|
||||
session_token = session_token
|
||||
)
|
||||
|
||||
|
||||
@@ -234,7 +234,9 @@ class ZerodhaKiteTradingController(TradingController):
|
||||
token_notes = {
|
||||
"apiKey": auth_token.auth["apiKey"],
|
||||
"authUrl": auth_url
|
||||
}
|
||||
},
|
||||
display_name = zerodha_auth_token.userId,
|
||||
display_picture = zerodha_auth_token.displayPictureUrl
|
||||
)
|
||||
|
||||
# Done here:
|
||||
@@ -278,6 +280,8 @@ class ZerodhaKiteTradingController(TradingController):
|
||||
symbols_subset = kite.instruments(exchange = exchange)
|
||||
symbols_subset = [TradingSymbol.from_zerodha_kite(s) for s in symbols_subset]
|
||||
symbol_list.data += symbols_subset
|
||||
print("LEN(EXC):", len(symbols_subset))
|
||||
print("LEN(SYM):", len(symbol_list.data))
|
||||
symbol_list.success = True
|
||||
symbol_list.message = "Symbol list retrieved successfully."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user