Databento livedata - Looking for complete code example

Hello Questdb, I came across an excellent post on using Databento provided live-data with Questdb, at Analyzing multi-stream market data with Databento, Grafana and QuestDB. I would like to try the techniques presented locally in my setup. Is there a complete code or github repo available? The post has only a few snippets of the important sections.
Thank you,
SG

He @suhasghorp

Glad you liked the tutorial.

We’ll check into this and get back to you!

Hello, please let me know if the article does not come with complete code example. It won’t be easy but I will try to fill in the gaps with what’s available in the documentation.

Thanks!

Hey @suhasghorp – is this helpful?

import databento as db
from questdb.ingress import Sender
import numpy as np

questdb_conf = "http::addr=localhost:9000;username=admin;password=quest;"
db_client = db.historical(key="YOUR KEY")

db_client.timeseries.get_range(
    dataset="GLBX.MDP3",
    schema="mbp-1",
    stype_in="parent",
    symbols="ES.FUT",
    start="2024-02-16T13:00:00",
    end="2024-07-16T18:00:00"
)

factor = 0.000000001
instruments = {}


with Sender.from_conf(questdb_conf) as sender:
    for record in db_client:
        print(record)
        if isinstance(record, db.SymbolMappingMsg):
            instruments.update({record.hd.instrument_id: record.stype_out_symbol})

        elif isinstance(record, db.MBP10Msg):
            sender.row(
                'SP_FUTURES',
                symbols={'instrument': instruments[record.instrument_id]},
                columns={'bid_size_0': record.levels[0].bid_sz,
                         'ask_size_0': record.levels[0].ask_sz,
                         'bid_price_0': record.levels[0].bid_px * factor,
                         'ask_price_0': record.levels[0].ask_px * factor},
                at=np.datetime64(record.ts_event, 'ns').astype('datetime64[ms]').astype(object))