nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.7k stars 398 forks source link

Futures data from databento doesn't load correctly with nautilus loader #1737

Closed faysou closed 6 days ago

faysou commented 6 days ago

Bug Report

Expected Behavior

The futures price values from bars should have the correct scale when loaded with a databento nautilus loader.

Actual Behavior

They are divided by 100

Steps to Reproduce the Problem

  1. Load bars from databento and save them
import databento as db

client = db.Historical()
data_file = 'test.dbn.zst'
data = client.timeseries.get_range(
            dataset='GLBX.MDP3',
            schema='ohlcv-1m',
            symbols=['ESM4'],
            start='2024-05-09T10:00',
            end='2024-05-09T10:05',
            path=data_file
        )

list(data)

[OhlcvMsg { hd: RecordHeader { length: 14, rtype: Ohlcv1M, publisher_id: GlbxMdp3Glbx, instrument_id: 5602, ts_event: 1715248800000000000 }, open: 5199.750000000, high: 5200.000000000, low: 5199.250000000, close: 5199.500000000, volume: 170 }, ...]

  1. Load the saved file with Nautilus
    
    from nautilus_trader.adapters.databento.loaders import DatabentoDataLoader

loader = DatabentoDataLoader() future_data = loader.from_dbn_file(path=data_file)

future_data



`[Bar(ESM4.GLBX-1-MINUTE-LAST-EXTERNAL,52.00,52.00,51.99,51.99,170,1715248800000000000), ...]`

### Specifications

- OS platform: macos
- Python version: 3.11
- `nautilus_trader` version: latest develop commit
cjdsellers commented 6 days ago

Hi @faysou

Thanks for the report.

The loader was accounting for the display factor for some instruments, I'll remove the divide by 100 work around.

faysou commented 6 days ago

Thanks @cjdsellers

cjdsellers commented 6 days ago

Now fixed on develop branch from e607de581662d5b2f3122b17d24d7fe7db916256. I credited your report in the release notes.