Low-latency New Data Notification

Low-latency notification when Calcbench processes new filings from the SEC and publishes data.

Calcbench pushes messages onto a queue when we publish new data. Your process listens on the queue. When you recieve a message you call the Calcbench API to retrieve data then add the data to your pipeline.

Implement the listener as below in a script that runs in an always on daemon managed by something like systemd.

If your system is down, messages will remain in the queue for 7 days. If you process throws an exception prior to completion the messages will be put back on the queue.


This requires Calcbench to create a subscription for you.

Requires the azure-servicebus package:

$  pip install azure-servicebus
calcbench.handle_filings(handler, connection_string, subscription_name, filter_expression='1=1')

Listen for new filings from Calcbench

Pass in a function that process each filing.

>>> def filing_handler(filing):
>>>     if filing["filing_type"] != "annualQuarterlyReport":
>>>         return
>>>     accession_id = filing['calcbench_id']
>>>     data = point_in_time(
>>>             accession_id=accession_id
>>>             all_face=True,
>>>             all_footnotes=True,
>>>             )
>>>    print(data)
>>> handle_filings(
>>>     filing_handler,
>>>     connection_string=connection_string,
>>>     subscription_name=subscription,
>>> )