(20241226) Change and Percent Change bug fixed for Zerodha's ticks.

This commit is contained in:
2024-12-26 11:53:47 +05:30
parent a8449ebaef
commit 8e89575032
3 changed files with 53 additions and 28 deletions
+15 -2
View File
@@ -88,7 +88,8 @@ def create_config(
ca_file: str | None = None,
cert_file: str | None = None,
key_file: str | None = None,
client_id: str | None = None
client_id: str | None = None,
buffer_size: int = 32
) -> dict:
"""
@@ -100,6 +101,7 @@ def create_config(
:param cert_file: Needed for 'SSL' security protocol.
:param key_file: Needed for 'SSL' security protocol.
:param client_id: An identifier for one producer/consumer. Useful for debugging later.
:param buffer_size: The size of the local message buffer in MBs.
:return: The dictionary that needs to be passed as the 'conf' param when creating the producer/consumer.
"""
@@ -107,7 +109,8 @@ def create_config(
if not isinstance(bootstrap_servers, list): bootstrap_servers = [bootstrap_servers]
config = {
"bootstrap.servers": ",".join(bootstrap_servers),
"security.protocol": security_protocol
"security.protocol": security_protocol,
# "buffer.memory": buffer_size
}
# Add the SSL security details:
@@ -194,6 +197,16 @@ class ProducerKafka:
if not self.__connected: self.connect()
return self.__connected
def flush(self):
"""
Flushes the buffer entirely.
:return: None
"""
self.__producer.flush()
self.__printer("Producer flushed.")
def close(self):
"""