From 64ec3aa399ced363c9594c59d461f95aee1b2aca Mon Sep 17 00:00:00 2001 From: Adam Overton Date: Tue, 30 Dec 2025 14:10:06 -0800 Subject: [PATCH] Fix OHLCV price scaling in DataBentoDataDownloader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Databento returns OHLCV prices as fixed-point integers scaled by 10^9. The DatabentoBar class was parsing these as raw decimals, resulting in prices like 6707750000000 instead of 6707.75. - Change OHLCV fields from decimal to long (OpenRaw, HighRaw, etc.) - Apply PriceScaleFactor (1e-9) to get actual prices - Volume remains as long (not scaled) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../DataBentoDataDownloader.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/QuantConnect.DataBento/DataBentoDataDownloader.cs b/QuantConnect.DataBento/DataBentoDataDownloader.cs index 2a44e55..6e70d1f 100644 --- a/QuantConnect.DataBento/DataBentoDataDownloader.cs +++ b/QuantConnect.DataBento/DataBentoDataDownloader.cs @@ -236,8 +236,8 @@ private string MapSymbolToDataBento(Symbol symbol) return symbol.Value; } - /// Class for parsing trade data from Databento - /// Really used as a map from the http request to then get it in QC data structures + /// Class for parsing OHLCV bar data from Databento + /// Databento returns prices as fixed-point integers scaled by 10^9 private class DatabentoBar { [Name("ts_event")] @@ -247,19 +247,23 @@ private class DatabentoBar .AddTicks((TimestampNanos % 1_000_000_000) / 100).UtcDateTime; [Name("open")] - public decimal Open { get; set; } + public long OpenRaw { get; set; } + public decimal Open => OpenRaw * PriceScaleFactor; [Name("high")] - public decimal High { get; set; } + public long HighRaw { get; set; } + public decimal High => HighRaw * PriceScaleFactor; [Name("low")] - public decimal Low { get; set; } + public long LowRaw { get; set; } + public decimal Low => LowRaw * PriceScaleFactor; [Name("close")] - public decimal Close { get; set; } + public long CloseRaw { get; set; } + public decimal Close => CloseRaw * PriceScaleFactor; [Name("volume")] - public decimal Volume { get; set; } + public long Volume { get; set; } } private class DatabentoTrade