diff --git a/background/finstitutions/trading/to_kafka.py b/background/finstitutions/trading/to_kafka.py index cc267c3..ef2a688 100644 --- a/background/finstitutions/trading/to_kafka.py +++ b/background/finstitutions/trading/to_kafka.py @@ -6,7 +6,7 @@ DATE: - Tuesday, 24th Dec. 2024 + Monday, 30th Dec. 2024 OBJECTIVE: @@ -43,7 +43,7 @@ import os # My utils: 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, ConsumerKafka, create_config # To make HTTP calls: import httpx @@ -84,18 +84,33 @@ INSTRUMENT_LOOKUP = {} # For Kafka: cwd = files.get_cwd() parent_dir = cwd +kafka_consumer = ConsumerKafka( + topic = "tickers", + config = create_config( + bootstrap_servers = "del.ditscentre.in:9092", + # buffer_memory = 3_35_54_432, + security_protocol = "SSL", + # ca_file = r"../../creds/kafka/cert_authority.pem", + # cert_file = r"../../creds/kafka/fullchain.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") + ), + debug = False +) kafka_producer = ProducerKafka( topic = "tickers", config = create_config( bootstrap_servers = "del.ditscentre.in:9092", # buffer_memory = 3_35_54_432, security_protocol = "SSL", - ca_file = r"../../creds/kafka/cert_authority.pem", - cert_file = r"../../creds/kafka/fullchain.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") + # ca_file = r"../../creds/kafka/cert_authority.pem", + # cert_file = r"../../creds/kafka/fullchain.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") ), debug = False )