(20241221) Zerodha Auth Ready. Users can now integrate Kite.

This commit is contained in:
2024-12-21 15:22:55 +05:30
parent 8904ea394d
commit 1249841b05
15 changed files with 568 additions and 464 deletions
@@ -40,7 +40,7 @@ from utils_v2.database.async_mongo_v2 import AsyncMongo
from utils_v2.cache.async_redis_cache_v2 import AsyncRedisCache
# Controllers:
from controllers_v2.core.auth_token import CoreAuthTokenController
from controllers_v2.finstitutions.trading.base import TradingController
# Models:
from models.core.auth_token import CoreAuthTokenModel
@@ -89,7 +89,7 @@ import httpx
# *****************************************************************************************************************
class TradingController(CoreAuthTokenController):
class AllTradingController(TradingController):
# ┏┓
# ┃ ┏┓┏┓┏╋┏┓┓┏┏╋┏┓┏┓
@@ -100,37 +100,28 @@ class TradingController(CoreAuthTokenController):
cache: AsyncRedisCache = None,
http_client: httpx.AsyncClient = None,
alert_url: str = None,
base_filter: dict = None,
debug: bool = True,
debug_prefix: str = "Trading (C) | ",
debug_prefix: str = "All Trading (C) | ",
debug_only_errors: bool = True
):
"""
This is the foundational controller for all SMS services. This is built on top of the core message controller,
and, in turn, all individual SMS client controllers must be built on top of this.
This is the foundational controller for all trading services. Use this for any smaller common tasks where you
may not know the exact client beforehand.
:param cache: The object to use for caching results from database calls.
:param http_client: The HTTP client
:param base_filter: The basic filter that will be applied to all fetching/updating queries. WARNING: THE BASE
FILTER WILL ALWAYS BE APPLIED AUTOMATICALLY. SET THIS UP WISELY.
:param debug: Whether, or not, you would like to print debugging messages:
:param debug_prefix: The prefix to print with the debugging messages.
:param debug_only_errors: Whether you would like to print only error messages or all messages.
:return: None.
"""
# Prepare the combined base filter:
this_filter = {}
for k, v in (base_filter or {}).items(): this_filter[k] = v
this_filter["serviceType"] = "stockTrading"
# Invoke the parent's constructor:
CoreAuthTokenController.__init__(
self,
super().__init__(
cache = cache,
alert_url = alert_url,
http_client = http_client,
base_filter = this_filter,
base_filter = None,
debug = debug,
debug_prefix = debug_prefix,
debug_only_errors = debug_only_errors
@@ -140,23 +131,7 @@ class TradingController(CoreAuthTokenController):
# ┣┫┓┏╋┣┓
# ┛┗┗┻┗┛┗
# async def login_url(
# self,
# mongo_data_conn: AsyncMongo,
# auth_token: CoreAuthTokenModel
# ) -> SMSSendOneResult:
#
# """
# To send one SMS message through the third-party client.
# :param mongo_data_conn: The database connection to use to perform this task.
# :param auth_token: The auth token that will be used to send this message.
# :param client: The third-party SMS client to use to send this message.
# :param message: The actual message that needs to be sent.
# :param tags: Any tags to attach with this SMS for filtering when querying in the listing service.
# :return: The structured result of sending one message.
# """
#
# pass
pass
# *****************************************************************************************************************