(20241226) Making live feed available.
This commit is contained in:
@@ -42,6 +42,7 @@ import os
|
|||||||
|
|
||||||
# My utils:
|
# My utils:
|
||||||
from utils_v2.string import json
|
from utils_v2.string import json
|
||||||
|
from utils_v2.system import files
|
||||||
from utils_v2.queue.kafka import ProducerKafka, create_config
|
from utils_v2.queue.kafka import ProducerKafka, create_config
|
||||||
|
|
||||||
# To make HTTP calls:
|
# To make HTTP calls:
|
||||||
@@ -81,14 +82,19 @@ INSTRUMENT_TOKENS = []
|
|||||||
INSTRUMENT_LOOKUP = {}
|
INSTRUMENT_LOOKUP = {}
|
||||||
|
|
||||||
# For Kafka:
|
# For Kafka:
|
||||||
|
cwd = files.get_cwd()
|
||||||
|
parent_dir = cwd
|
||||||
kafka_producer = ProducerKafka(
|
kafka_producer = ProducerKafka(
|
||||||
topic = "tickers",
|
topic = "tickers",
|
||||||
config = create_config(
|
config = create_config(
|
||||||
bootstrap_servers = "del.ditscentre.in:9092",
|
bootstrap_servers = "del.ditscentre.in:9092",
|
||||||
security_protocol = "SSL",
|
security_protocol = "SSL",
|
||||||
ca_file = r"../../creds/kafka/cert_authority.pem",
|
# ca_file = r"../../creds/kafka/cert_authority.pem",
|
||||||
cert_file = r"../../creds/kafka/fullchain.pem",
|
# cert_file = r"../../creds/kafka/fullchain.pem",
|
||||||
key_file = r"../../creds/kafka/privkey.pem"
|
# key_file = r"../../creds/kafka/privkey.pem"
|
||||||
|
ca_file = os.path.join(parent_dir, "creds", "kafka", "cert_authority.pem"),
|
||||||
|
cert_file = os.path.join(parent_dir, "creds", "kafka", "fullchain.pem"),
|
||||||
|
key_file = os.path.join(parent_dir, "creds", "kafka", "privkey.pem")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -159,15 +165,11 @@ def main():
|
|||||||
instruments_csv = []
|
instruments_csv = []
|
||||||
instruments_csv += kite.instruments(exchange = "NSE")
|
instruments_csv += kite.instruments(exchange = "NSE")
|
||||||
instruments_csv += kite.instruments(exchange = "NFO")
|
instruments_csv += kite.instruments(exchange = "NFO")
|
||||||
instruments_csv += kite.instruments(exchange = "BSE")
|
# instruments_csv += kite.instruments(exchange = "BSE")
|
||||||
instruments_csv += kite.instruments(exchange = "BFO")
|
# instruments_csv += kite.instruments(exchange = "BFO")
|
||||||
instruments_csv += kite.instruments(exchange = "MCX")
|
# instruments_csv += kite.instruments(exchange = "MCX")
|
||||||
instruments_csv += kite.instruments(exchange = "CDS")
|
# instruments_csv += kite.instruments(exchange = "CDS")
|
||||||
instruments_csv += kite.instruments(exchange = "BCD")
|
# instruments_csv += kite.instruments(exchange = "BCD")
|
||||||
|
|
||||||
print("INSTRUMENTS:", len(instruments_csv))
|
|
||||||
json.to_file(r"/home/developer/Downloads/zerodha_kite_instruments.json", instruments_csv, default = str)
|
|
||||||
while True: pass
|
|
||||||
|
|
||||||
# Create the lookup:
|
# Create the lookup:
|
||||||
for i in instruments:
|
for i in instruments:
|
||||||
|
|||||||
Reference in New Issue
Block a user