""" AUTHOR: Khushal P Soonderji DATE: Monday, 6th Jan., 2024. OBJECTIVE: To provide a data model for describing the profile of a user of Zerodha Kite. REFERENCES: N/A DOWNLOADS: N/A """ # ***************************************************************************************************************** # ***** **** # *** IMPORT *** # ***** **** # ***************************************************************************************************************** # To make sibling directories accessible for imports: import sys sys.path.append(".") sys.path.append("..") # For making data behaviour_models: from pydantic import BaseModel, Field, field_validator, model_validator, AwareDatetime from typing import Optional, Literal, Union, Dict, List, Any # Related to Google: from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials # My utils: from utils_v2.string import json from utils_v2.string import regex from utils_v2.date_time import date_time # To work with date and time: import datetime import dateparser # To make API calls: import httpx # ***************************************************************************************************************** # ***** **** # *** MACROS / ONE-TIME INIT *** # ***** **** # ***************************************************************************************************************** # --- Nothing Yet # ***************************************************************************************************************** # ***** **** # *** VARIABLES *** # ***** **** # ***************************************************************************************************************** # --- Nothing Yet # ***************************************************************************************************************** # ***** **** # *** FUNCTIONS *** # ***** **** # ***************************************************************************************************************** class ZerodhaKiteUserProfile(BaseModel): userType: str | None = Field( description = "the type of the user", default = None, alias = "user_type", examples = ["individual/ind_with_nom"] ) userId: str = Field( description = "the id of the user as assigned by zerodha", alias = "user_id", examples = ["ABC123"] ) email: str | None = Field( description = "the email id of the user", default = None, alias = "email" ) name: str = Field( description = "the name of the user", alias = "user_name" ) displayName: str | None = Field( description = "the short display name of the user", default = None, alias = "user_shortname" ) displayPictureUrl: str | None = Field( description = "the display picture of the user", default = None, alias = "avatar_url" ) exchanges: List[str] = Field( description = "the list of exchanges this user can trade on", alias = "exchanges" ) products: List[str] = Field( description = "the list of products (offered by the broker) this user can avail", alias = "products" ) orderTypes: List[str] = Field( description = "the list of order types this user can place", alias = "order_types" ) # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ # ┛ class Config: extra = "ignore" populate_by_name = True # ┓┏ ┓• ┓ • # ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓ # ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗ pass # ┏┓ • # ┃┃┏┓┏┓┏┓┏┓┏┓╋┓┏┓┏ # ┣┛┛ ┗┛┣┛┗ ┛ ┗┗┗ ┛ # ┛ pass # ┏┓ ┏┓ # ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏ # ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛ pass # ***************************************************************************************************************** # ***** **** # *** MAIN PROGRAM *** # ***** **** # ***************************************************************************************************************** if __name__ == "__main__": pass