Skip to content

Instantly share code, notes, and snippets.

@databento-bot
Created June 8, 2024 17:42
Show Gist options
  • Save databento-bot/b59e66599bc21bfe25a1b7fc28885df3 to your computer and use it in GitHub Desktop.
Save databento-bot/b59e66599bc21bfe25a1b7fc28885df3 to your computer and use it in GitHub Desktop.
Extracts 1 day of OHLCV-1h data for XNAS.ITCH
# Extracts 1 day of OHLCV-1h data for XNAS.ITCH
import databento as db
client = db.Historical()
data = client.timeseries.get_range(
dataset='XNAS.ITCH',
schema='ohlcv-1h',
symbols='ALL_SYMBOLS',
start='2024-05-01',
end='2024-05-02',
)
symbology = data.request_symbology(client)
data.insert_symbology_json(symbology)
df = data.to_df(tz='US/Eastern')
print(df)
"""
rtype publisher_id instrument_id open high low close volume symbol
ts_event
2024-05-01 04:00:00-04:00 34 2 15239 70.510 70.570 70.5100 70.5400 2806 SSO
2024-05-01 04:00:00-04:00 34 2 600 0.388 0.388 0.3758 0.3762 21411 AKLI
2024-05-01 04:00:00-04:00 34 2 19034 32.070 32.100 31.3700 31.3700 384 RBRK
2024-05-01 04:00:00-04:00 34 2 18431 21.090 21.090 21.0900 21.0900 1 BYON
2024-05-01 04:00:00-04:00 34 2 16253 134.850 134.960 134.1300 134.5900 4453 TSM
... ... ... ... ... ... ... ... ... ...
2024-05-01 19:00:00-04:00 34 2 16490 24.500 24.500 24.5000 24.5000 1504 UGI
2024-05-01 19:00:00-04:00 34 2 1287 2.380 2.380 2.3800 2.3800 199 ATER
2024-05-01 19:00:00-04:00 34 2 12609 154.460 154.460 154.4600 154.4600 1 PI
2024-05-01 19:00:00-04:00 34 2 5204 120.000 120.000 120.0000 120.0000 1 ENSG
2024-05-01 19:00:00-04:00 34 2 12039 0.409 0.409 0.4090 0.4090 236 OPGN
[62062 rows x 9 columns]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment