(20241223) Zerodha auth now returns views.

This commit is contained in:
2024-12-23 16:27:52 +05:30
parent 3296fec639
commit 58e91fb15f
16 changed files with 112 additions and 294 deletions
+29 -18
View File
@@ -52,6 +52,13 @@ import asyncio
# for debugging:
from icecream import IceCreamDebugger
# To work with date and time:
import time
import datetime
# To work with Zerodha's Kite platform:
from kiteconnect import KiteConnect, KiteTicker
# *****************************************************************************************************************
# ***** ****
@@ -60,7 +67,23 @@ from icecream import IceCreamDebugger
# *****************************************************************************************************************
# --- Nothing Yet
INSTRUMENT_MAP = {
256265: "NIFTY 50",
260617: "NIFTY 100",
259849: "NIFTY IT",
341249: "HDFCBANK",
738561: "RELIANCE",
408065: "INFY",
2953217: "TCS",
356865: "HINDUNILVR",
1270529: "ICICIBANK",
492033: "KOTAKBANK",
110630919: "GOLD25JAN75800CE",
110050823: "SILVER25FEB76000CE",
10670594: "NIFTY24DEC23650PE",
17167874: "BANKNIFTY24DEC45000PE",
}
INSTRUMENT_TOKENS = list(INSTRUMENT_MAP.keys())
# *****************************************************************************************************************
@@ -99,19 +122,6 @@ async def disconnect(sid):
printer(sid)
# ---------------------------------------------------------------------------------------------------------------------
async def init():
"""
Initialize stuff here.
:return: ?
"""
pass
# *****************************************************************************************************************
# ***** ****
# *** MAIN PROGRAM ***
@@ -121,20 +131,21 @@ async def init():
if __name__ == "__main__":
# Import the needed events:
from wsocket.finstitutions.trading import live_feed
async def main():
# Start receiving live market data in the background:
# asyncio.create_task(start_live_feed())
# register all the events:
sio.on("subscribe", live_feed.subscribe)
# Run the web server:
runner = web.AppRunner(app)
await runner.setup()
site = web.TCPSite(runner, "0.0.0.0", 5214)
printer("Server running.")
await site.start()
# Keep the server running:
while True: await asyncio.sleep(3_600)
# Let's go:
asyncio.run(main())