(20250116) Started upgrading the mail module (to eventually work on cron).

This commit is contained in:
2025-01-16 16:39:23 +05:30
parent efd7dda9f0
commit ed1e86c5e9
71 changed files with 2423 additions and 464 deletions
+7 -98
View File
@@ -39,6 +39,13 @@ sys.path.append("..")
from pydantic import BaseModel, Field, field_validator, PastDatetime, model_validator
from typing import Optional, Literal, Union
# Models:
from models.finstitutions.trading.oauth import (
PaperTradingAuth,
ZerodhaKiteAuth,
ICICIBreezeAuth
)
# My utils:
from utils_v2.string import regex
from utils_v2.date_time import date_time
@@ -75,104 +82,6 @@ REGEX_SESSION_TOKEN = r"^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]
# *****************************************************************************************************************
class PaperTradingAuth(BaseModel):
username: str = Field(
description = "??",
frozen = True
)
password: str = Field(
description = "??",
frozen = True
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
# ---------------------------------------------------------------------------------------------------------------------
class ZerodhaKiteAuth(BaseModel):
userId: str = Field(
description = "How Zerodha's Kite platform identifies this user.",
frozen = True,
alias = "clientId"
)
apiKey: str = Field(
description = (
"The API key of your Kite app. "
"This remains constant throughout the life of the app."
),
frozen = True
)
apiSecret: str = Field(
description = (
"The API secret of your Kite app. "
"This can be changed if you think the security of your app has been compromised."
),
frozen = True
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
populate_by_name = True
# ---------------------------------------------------------------------------------------------------------------------
class ICICIBreezeAuth(BaseModel):
userId: str = Field(
description = "How ICICI's Breeze platform identifies this user.",
frozen = True,
alias = "clientId"
)
apiKey: str = Field(
description = (
"The API key of your Breeze app. "
"This remains constant throughout the life of the app."
),
frozen = True
)
apiSecret: str = Field(
description = (
"The API secret of your Breeze app. "
"This can be changed if you think the security of your app has been compromised."
),
frozen = True
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
populate_by_name = True
# ---------------------------------------------------------------------------------------------------------------------
class TradingAuthRequestHeaders(BaseModel):
sessionToken: str = Field(
@@ -79,45 +79,6 @@ REGEX_SESSION_TOKEN = r"^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]
# *****************************************************************************************************************
class TradingSymbolListBrokerResponse(BaseModel):
success: bool = Field(
description = "whether, or not, the symbol list request was successful",
default = False,
frozen = False
)
message: str = Field(
description = "a brief message to help debug in failed cases",
default = "",
frozen = False
)
data: List[TradingSymbol] | None = Field(
description = "the actual response from the broker with his list of tradeable symbols",
default = None,
frozen = False
)
exception: Exception | None = Field(
description = "if something goes wrong, the exception will be held here",
default = None,
frozen = False
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
arbitrary_types_allowed = True
# ---------------------------------------------------------------------------------------------------------------------
class TradingSymbolListRequestHeaders(BaseModel):
sessionToken: str = Field(