(20241230) Paper Trading auth added.

This commit is contained in:
2024-12-30 11:43:15 +05:30
parent e3d71965bb
commit e2976f0dfc
5 changed files with 298 additions and 6 deletions
+28 -3
View File
@@ -75,6 +75,30 @@ 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):
apiKey: str = Field(
@@ -131,8 +155,8 @@ class TradingAuthRequestHeaders(BaseModel):
class TradingAuthRequestData(BaseModel):
client: Literal["zerodhaKite"] = Field(alias = "client")
auth: Union[ZerodhaKiteAuth]
client: Literal["zerodhaKite", "paperTrading"] = Field(alias = "client")
auth: Union[ZerodhaKiteAuth, PaperTradingAuth]
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
@@ -151,7 +175,8 @@ class TradingAuthRequestData(BaseModel):
client = values.client
auth = values.auth
harmony_map = {
"zerodhaKite": ZerodhaKiteAuth
"zerodhaKite": ZerodhaKiteAuth,
"paperTrading": PaperTradingAuth
}
if not isinstance(auth, harmony_map[client]):
raise ValueError(f"incorrect 'auth' for selected client '{client}'")
+1 -1
View File
@@ -109,7 +109,7 @@ class CoreAuthTokenModel(BaseModel):
"telegram", "whatsapp", # .................. Chat Clients
"nimbusSmsIndia", "savvyBulkSmsKenya", # ... SMS Clients
"razorpay", "safaricomMPesaExpress", # ..... Payment Gateways
"zerodhaKite", # ........................... Stock Brokers
"zerodhaKite", "paperTrading", # ........... Stock Brokers
"theCaOfficeAi" # .......................... Software
] = Field(
description = "the third-part client that was used",