diff --git a/api/blueprints/finstitutions/trading/oauth/request.py b/api/blueprints/finstitutions/trading/oauth/request.py index 5569de4..73ac98a 100644 --- a/api/blueprints/finstitutions/trading/oauth/request.py +++ b/api/blueprints/finstitutions/trading/oauth/request.py @@ -189,6 +189,8 @@ async def request_oauth_authorization_url( "username": inbound_data.auth.username, "perTrade": inbound_data.get("perTrade", 0), "perCrore": inbound_data.get("perCrore", 0), + "perCroreEq": inbound_data.get("perCroreEq", 0), + "perCroreFut": inbound_data.get("perCroreFut", 0), "perLot": inbound_data.get("perLot", 0) }, auth = inbound_data.auth.model_dump(), diff --git a/models/finstitutions/trading/oauth.py b/models/finstitutions/trading/oauth.py index c65f460..0ab9a1e 100644 --- a/models/finstitutions/trading/oauth.py +++ b/models/finstitutions/trading/oauth.py @@ -86,6 +86,36 @@ class PaperTradingAuth(BaseModel): frozen = True ) + perTrade: int | float = Field( + description = "??", + default = 0, + frozen = True + ) + + perLot: int | float = Field( + description = "??", + default = 0, + frozen = True + ) + + perCrore: int | float = Field( + description = "??", + default = 0, + frozen = True + ) + + perCroreEq: int | float = Field( + description = "??", + default = 0, + frozen = True + ) + + perCroreFut: int | float = Field( + description = "??", + default = 0, + frozen = True + ) + # ┏┓ ┏• # ┃ ┏┓┏┓╋┓┏┓ # ┗┛┗┛┛┗┛┗┗┫ @@ -94,6 +124,17 @@ class PaperTradingAuth(BaseModel): class Config: extra = "forbid" + # ┏┓ ┏┓ + # ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏ + # ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛ + + @field_validator("perTrade", "perLot", "perCrore", "perCroreEq", "perCroreFut", mode = "before") + @classmethod + def ensure_number(cls, value): + if value is None: value = 0 + if isinstance(value, str): value = float(value) + return value + # --------------------------------------------------------------------------------------------------------------------- @@ -222,4 +263,12 @@ class TradingOAuthCallbackResponse(BaseModel): if __name__ == "__main__": - pass + my_obj = PaperTradingAuth( + username = "Yatmesh", + password = "yatmesh123", + perTrade = 10.25, + perCrore = "100.12345", + perCroreEq = "0.12345", + perLot = None + ) + print(my_obj) diff --git a/utils_v2/database/async_mongo_v2.py b/utils_v2/database/async_mongo_v2.py index 78071b4..396d961 100644 --- a/utils_v2/database/async_mongo_v2.py +++ b/utils_v2/database/async_mongo_v2.py @@ -163,7 +163,8 @@ class AsyncMongoBase: self._host_name, self._port, maxPoolSize = self._max_connections, - minPoolSize = self._max_connections + minPoolSize = self._max_connections, + # w = 1, ) # In the absense of a connection string, @@ -172,7 +173,8 @@ class AsyncMongoBase: self._client = AsyncIOMotorClient( self._connection_string, maxPoolSize = self._max_connections, - minPoolSize = self._max_connections + minPoolSize = self._max_connections, + # w = 1, ) # Debugging print: