(20241226) Date-time management for Zerodha's instrument list.

This commit is contained in:
2024-12-26 14:27:11 +05:30
parent e31857d0f1
commit bfd02bf74a
3 changed files with 46 additions and 17 deletions
+6 -4
View File
@@ -89,7 +89,7 @@ def create_config(
cert_file: str | None = None,
key_file: str | None = None,
client_id: str | None = None,
buffer_size: int = 32
buffer_memory: int = None
) -> dict:
"""
@@ -101,7 +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.
:param buffer_memory: The size of the local message buffer in bytes (only for producers).
:return: The dictionary that needs to be passed as the 'conf' param when creating the producer/consumer.
"""
@@ -109,8 +109,7 @@ def create_config(
if not isinstance(bootstrap_servers, list): bootstrap_servers = [bootstrap_servers]
config = {
"bootstrap.servers": ",".join(bootstrap_servers),
"security.protocol": security_protocol,
# "buffer.memory": buffer_size
"security.protocol": security_protocol
}
# Add the SSL security details:
@@ -122,6 +121,9 @@ def create_config(
# Specific to consumers:
if group_id: config["group.id"] = group_id
# Specific to producers:
if buffer_memory: config["buffer.memory"] = buffer_memory
# Add an identifier for debugging:
if client_id: config["client.id"] = client_id