Daily OHLCV (with closing prices)#

This is part of the OQD offering. Available in OneTick Cloud. Can be configured on prem.

We can retrieve daily OHLCV data for specific tickers using various symbologies.

import onetick.py as otp
src = otp.oqd.sources.OHLCV(exch='USCOMP')
otp.run(src, symbols=['BTKR::::AAPL US'], start=otp.dt(2022, 10, 1), end=otp.dt(2022, 10, 7), symbol_date=otp.dt(2022, 10, 1))
Time OID EXCH CURRENCY OPEN HIGH LOW CLOSE VOLUME
0 2022-10-03 9706 USCOMP USD 138.210 143.07 137.685 142.45 114311700.0
1 2022-10-04 9706 USCOMP USD 145.030 146.22 144.260 146.10 87830060.0
2 2022-10-05 9706 USCOMP USD 144.075 147.38 143.010 146.40 79470970.0
3 2022-10-06 9706 USCOMP USD 145.810 147.54 145.220 145.43 68402170.0
4 2022-10-07 9706 USCOMP USD 142.540 143.10 139.445 140.09 85925560.0

Examples of other supported symbologies include: TDEQ::::AAPL SED::::2046251 FGV::::BBG000B9XRY4 ISN::::US0378331005 TKR::::ALSPW.FRXPAR.

The most efficient way of retrieving data for a large number of symbols is via OneTick’s native OID symbology. We can create a map from the databases’s symbology to the OID using the code below or between any two symbologies using the method described in the Symbologies guide.

oid = otp.Symbols('NYSE_TAQ', symbology='OID', show_original_symbols=True)
oid, _ = oid[oid['SYMBOL_NAME']!='']
otp.run(oid, start=otp.dt(2022, 10, 1), end=otp.dt(2022, 10, 7))
Time SYMBOL_NAME ORIGINAL_SYMBOL_NAME
0 2022-10-01 3751 NYSE_TAQ::A
1 2022-10-01 647321 NYSE_TAQ::AA
2 2022-10-01 695581 NYSE_TAQ::AAA
3 2022-10-01 673522 NYSE_TAQ::AAAU
4 2022-10-01 703090 NYSE_TAQ::AAC
... ... ... ...
12182 2022-10-01 273584 NYSE_TAQ::ZWS
12183 2022-10-01 704054 NYSE_TAQ::ZY
12184 2022-10-01 655470 NYSE_TAQ::ZYME
12185 2022-10-01 633589 NYSE_TAQ::ZYNE
12186 2022-10-01 208375 NYSE_TAQ::ZYXI

12187 rows × 3 columns

We can now query OHLCV using OIDs. The code below retrieves OHLCV for all US equities for 5 days.

ohlcv = otp.oqd.sources.OHLCV(exch='USCOMP')
ohlcv['ticker'] = ohlcv.Symbol.ORIGINAL_SYMBOL_NAME
ohlcv = otp.merge([ohlcv], symbols=oid)
otp.run(ohlcv, start=otp.dt(2022, 10, 1), end=otp.dt(2022, 10, 7))
Time OID EXCH CURRENCY OPEN HIGH LOW CLOSE VOLUME ticker
0 2022-10-03 3751 USCOMP USD 122.730 127.300 121.6800 126.3800 1343211.0 NYSE_TAQ::A
1 2022-10-03 647321 USCOMP USD 34.350 37.940 34.0000 37.3900 9731361.0 NYSE_TAQ::AA
2 2022-10-03 695581 USCOMP USD 24.075 24.075 24.0750 24.0750 9.0 NYSE_TAQ::AAA
3 2022-10-03 673522 USCOMP USD 16.560 16.890 16.5500 16.8750 585071.0 NYSE_TAQ::AAAU
4 2022-10-03 703090 USCOMP USD 9.930 9.940 9.9300 9.9400 294860.0 NYSE_TAQ::AAC
... ... ... ... ... ... ... ... ... ... ...
60752 2022-10-07 273584 USCOMP USD 24.920 25.250 24.5000 24.5800 574758.0 NYSE_TAQ::ZWS
60753 2022-10-07 704054 USCOMP USD 2.830 2.910 2.7500 2.7800 755683.0 NYSE_TAQ::ZY
60754 2022-10-07 655470 USCOMP USD 6.060 6.170 5.7400 5.9000 1057437.0 NYSE_TAQ::ZYME
60755 2022-10-07 633589 USCOMP USD 0.769 0.820 0.7411 0.7411 242326.0 NYSE_TAQ::ZYNE
60756 2022-10-07 208375 USCOMP USD 9.270 9.400 8.7500 8.8000 141339.0 NYSE_TAQ::ZYXI

60757 rows × 10 columns