Market Data#
A series of simple examples are provided showing how to retrieve different types of market data from OneTick Cloud.
Symbol Universe#
All collected symbols are centrally stored in the SYMBOL_UNIVERSE
database, with reference information such as Name, Security Type, Currency, MIC, etc,
and importantly which DB_NAME
and DB_SYMBOL
stores the historic market data.
The SYMBOL_UNIVERSE
database is partitioned by Date, Database and Security Type, allowing fast filtering on these terms.
Common Security Types include: Equity
, Future
, `` Futures Spread``, Option
, Option Spread
, Index
, and ETF
.
When executing the graph using the run
method, the symbol should be set to: SYMBOL_UNIVERSE::[DATABASE] [Security Type]
e.g. SYMBOL_UNIVERSE::LSE Equity
.
def symbol_universe():
pt = otq.Passthrough().tick_type('STAT')
graph = otq.Graph(pt)
return graph
result = otq.run(symbol_universe(),
http_address=http_address,
access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3),
end = datetime(2024,1,4),
timezone='UTC',
symbols='SYMBOL_UNIVERSE::LSE Equity'
)
Time |
STRIKE_PRICE |
CONTRACT_SIZE |
DB_NAME |
NAME |
EXCH_SYMBOL |
DB_SYMBOL |
OID |
BSYM |
ISIN |
TRADING_CODE |
MIC |
OPERATING_MIC |
SEC_TYPE |
CFI_CODE |
MKT_SEGMENT |
CURRENCY |
EXPIRATION_DATE |
CALL_PUT_IND |
PRODUCT_CODE |
STRATEGY_TYPE |
UNDERLYING_SYMBOL |
SIP_SYMBOL |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 04:00:00 |
LSE |
Groupe Parot |
0A04 |
0A04 |
1015725922 |
0A04 LN Equity |
FR0013204070 |
151949 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
124 |
|||||||||
1 |
2024-01-03 04:00:00 |
LSE |
Medacta Group SA |
0A05 |
0A05 |
1015743877 |
0A05 LN Equity |
CH0468525222 |
151987 |
XLOM |
XLON |
Equity |
SSX4 |
CHF |
125 |
|||||||||
2 |
2024-01-03 04:00:00 |
LSE |
Stadler Rail AG |
0A0C |
0A0C |
1015747442 |
0A0C LN Equity |
CH0002178181 |
151996 |
XLOM |
XLON |
Equity |
SSX4 |
CHF |
132 |
|||||||||
3 |
2024-01-03 04:00:00 |
LSE |
Societa Editoriale Il Fatto Spa |
0A0G |
0A0G |
1015758539 |
0A0G LN Equity |
IT0005353484 |
152040 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
133 |
|||||||||
4 |
2024-01-03 04:00:00 |
LSE |
Twenty First Century Fox A Inc |
0A0X |
0A0X |
1015762601 |
0A0X LN Equity |
US35137L1052 |
152064 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
135 |
|||||||||
5 |
2024-01-03 04:00:00 |
LSE |
Fox Corporation |
0A0Y |
0A0Y |
1015762585 |
0A0Y LN Equity |
US35137L2043 |
152046 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
136 |
|||||||||
6 |
2024-01-03 04:00:00 |
LSE |
Golden Entertainment Inc |
0A10 |
0A10 |
1015762588 |
0A10 LN Equity |
US3810131017 |
152049 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
138 |
|||||||||
7 |
2024-01-03 04:00:00 |
LSE |
Levi Strauss & Co |
0A14 |
0A14 |
1015762602 |
0A14 LN Equity |
US52736R1023 |
152065 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
141 |
|||||||||
8 |
2024-01-03 04:00:00 |
LSE |
CGI Inc |
0A18 |
0A18 |
1015788078 |
0A18 LN Equity |
CA12532H1047 |
152149 |
XLOM |
XLON |
Equity |
SSX4 |
CAD |
144 |
|||||||||
9 |
2024-01-03 04:00:00 |
LSE |
CareTrust REIT Inc |
0A1C |
0A1C |
1015788080 |
0A1C LN Equity |
US14174T1079 |
152151 |
XLOM |
XLON |
Equity |
SSX4 |
EUR |
145 |
def symbol_universe():
pt = otq.Passthrough().tick_type('STAT')
f = otq.WhereClause(where='NAME LIKE "Voda%" and CURRENCY LIKE "GBX"')
graph = otq.Graph(pt > f)
return graph
result = otq.run(symbol_universe(),
http_address=http_address,
access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3),
end = datetime(2024,1,4),
timezone='UTC',
symbols='SYMBOL_UNIVERSE::LSE Equity'
)
Trade Events#
Trade events are retrieved by specifying the TRD
table, along with the specified database, symbol and time range.
Trades are represented with PRICE
, SIZE
, and other fields.
def trades():
pt = otq.Passthrough().tick_type('TRD')
graph = otq.Graph(pt)
return graph
result = otq.run(trades(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,9,30,0),
end = datetime(2024,1,3,9,31,0),
timezone='America/New_York',
symbols='US_COMP_SAMPLE::CSCO'
)
Time |
PRICE |
SIZE |
EXCHANGE |
COND |
PARTICIPANT_TIME |
TRF_TIME |
STOP_STOCK |
SOURCE |
TRF |
TTE |
TICKER |
CORR |
SEQ_NUM |
TRADE_ID |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 09:30:00.065443591 |
50.02 |
2 |
Z |
@ I |
2024-01-03 09:30:00.065250000 |
1969-12-31 19:00:00.000000000 |
N |
0 |
CSCO |
0 |
169103 |
42 |
1969-12-31 19:00:00 |
0 |
0 |
||
1 |
2024-01-03 09:30:00.111130049 |
50.16 |
3 |
Z |
@ I |
2024-01-03 09:30:00.110938000 |
1969-12-31 19:00:00.000000000 |
N |
0 |
CSCO |
0 |
169148 |
43 |
1969-12-31 19:00:00 |
0 |
0 |
||
2 |
2024-01-03 09:30:00.127459523 |
50.17 |
100 |
V |
@ |
2024-01-03 09:30:00.065044730 |
1969-12-31 19:00:00.000000000 |
N |
0 |
CSCO |
0 |
169181 |
13 |
1969-12-31 19:00:00 |
0 |
0 |
||
3 |
2024-01-03 09:30:00.128498068 |
50.17 |
5 |
Z |
@F I |
2024-01-03 09:30:00.128306000 |
1969-12-31 19:00:00.000000000 |
N |
1 |
CSCO |
0 |
169182 |
44 |
1969-12-31 19:00:00 |
0 |
0 |
||
4 |
2024-01-03 09:30:00.135190071 |
50.13 |
46 |
Q |
@FTI |
2024-01-03 09:30:00.135173836 |
1969-12-31 19:00:00.000000000 |
N |
1 |
CSCO |
0 |
169193 |
349 |
1969-12-31 19:00:00 |
0 |
0 |
||
5 |
2024-01-03 09:30:00.232554141 |
50.13 |
117 |
Q |
@FT |
2024-01-03 09:30:00.232536880 |
1969-12-31 19:00:00.000000000 |
N |
1 |
CSCO |
0 |
169258 |
350 |
1969-12-31 19:00:00 |
0 |
0 |
||
6 |
2024-01-03 09:30:00.232556132 |
50.05 |
83 |
Q |
@FTI |
2024-01-03 09:30:00.232536880 |
1969-12-31 19:00:00.000000000 |
N |
1 |
CSCO |
0 |
169259 |
351 |
1969-12-31 19:00:00 |
0 |
1 |
||
7 |
2024-01-03 09:30:00.280877749 |
50.002 |
200 |
D |
@ |
2024-01-03 09:30:00.280542269 |
2024-01-03 09:30:00.280841375 |
N |
Q |
0 |
CSCO |
0 |
169295 |
94 |
1969-12-31 19:00:00 |
0 |
0 |
|
8 |
2024-01-03 09:30:00.321495830 |
50.002 |
9 |
D |
@ I |
2024-01-03 09:30:00.321093887 |
2024-01-03 09:30:00.321467557 |
N |
Q |
0 |
CSCO |
0 |
169317 |
95 |
1969-12-31 19:00:00 |
0 |
0 |
|
9 |
2024-01-03 09:30:00.372805563 |
50.085 |
1 |
D |
@ I |
2024-01-03 09:30:00.101273000 |
2024-01-03 09:30:00.372781538 |
N |
Q |
0 |
CSCO |
0 |
169398 |
96 |
1969-12-31 19:00:00 |
0 |
0 |
Quote Events#
Quote events are retrieved by specifying the QTE
table, along with the specified database, symbol and time range.
Quotes are represented with BID_PRICE
, BID_SIZE
, ASK_PRICE
, ASK_SIZE
and other fields.
def quotes():
pt = otq.Passthrough().tick_type('QTE')
graph = otq.Graph(pt)
return graph
result = otq.run(quotes(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,9,30,0),
end = datetime(2024,1,3,9,31,0),
timezone='America/New_York',
symbols='US_COMP_SAMPLE::CSCO'
)
Time |
BID_PRICE |
BID_SIZE |
ASK_PRICE |
ASK_SIZE |
EXCHANGE |
COND |
PARTICIPANT_TIME |
FINRA_ADF_TIME |
NBBO_IND |
FINRA_BBO_IND |
FINRA_ADF_MPID_IND |
SOURCE |
RPI |
RESTRICTION_IND |
LULD_BBO_IND |
SIP_MSG_ID |
NBBO_LULD_IND |
FINRA_ADF_IND |
TICKER |
CORR |
SEQ_NUM |
SECURITY_STATUS_IND |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 09:30:00.001830617 |
50.0 |
9 |
50.18 |
2 |
Z |
R |
2024-01-03 09:30:00.001336000 |
1969-12-31 19:00:00 |
4 |
N |
0 |
CSCO |
760290 |
1969-12-31 19:00:00 |
0 |
0 |
|||||||||
1 |
2024-01-03 09:30:00.002078349 |
49.8 |
1 |
50.37 |
1 |
K |
R |
2024-01-03 09:30:00.001881000 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760345 |
1969-12-31 19:00:00 |
0 |
0 |
|||||||||
2 |
2024-01-03 09:30:00.002215206 |
50.0 |
6 |
50.2 |
7 |
Q |
R |
2024-01-03 09:30:00.002199928 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760370 |
1969-12-31 19:00:00 |
0 |
1 |
|||||||||
3 |
2024-01-03 09:30:00.002341904 |
49.8 |
1 |
50.37 |
1 |
K |
R |
2024-01-03 09:30:00.002147000 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760434 |
1969-12-31 19:00:00 |
0 |
2 |
|||||||||
4 |
2024-01-03 09:30:00.002524728 |
50.0 |
9 |
50.18 |
3 |
Z |
R |
2024-01-03 09:30:00.002344000 |
1969-12-31 19:00:00 |
4 |
N |
0 |
CSCO |
760445 |
1969-12-31 19:00:00 |
0 |
3 |
|||||||||
5 |
2024-01-03 09:30:00.002857475 |
0.0 |
0 |
0.0 |
0 |
H |
R |
2024-01-03 09:30:00.002550899 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760452 |
1969-12-31 19:00:00 |
0 |
4 |
|||||||||
6 |
2024-01-03 09:30:00.003295288 |
50.0 |
10 |
50.18 |
3 |
Z |
R |
2024-01-03 09:30:00.002561000 |
1969-12-31 19:00:00 |
4 |
N |
0 |
CSCO |
760462 |
1969-12-31 19:00:00 |
0 |
0 |
|||||||||
7 |
2024-01-03 09:30:00.003751324 |
49.8 |
1 |
50.21 |
2 |
K |
R |
2024-01-03 09:30:00.003568000 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760551 |
1969-12-31 19:00:00 |
0 |
1 |
|||||||||
8 |
2024-01-03 09:30:00.005117010 |
49.92 |
10 |
50.21 |
2 |
P |
R |
2024-01-03 09:30:00.004774739 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760732 |
1969-12-31 19:00:00 |
0 |
0 |
|||||||||
9 |
2024-01-03 09:30:00.006821601 |
50.0 |
10 |
50.18 |
3 |
Z |
R |
2024-01-03 09:30:00.006635000 |
1969-12-31 19:00:00 |
0 |
N |
0 |
CSCO |
760843 |
1969-12-31 19:00:00 |
0 |
0 |
Market Phase Events#
Market Phase events are retrieved by specifying the MKT
table, along with the specified database, symbol and time range. This table is only available for a subset of databases.
Phases are represented with OMD_STATUS
and other fields.
OMD_STATUS
has the following enumeration.
“A” - Auction
“B” - Break / Pause
“C” - Closing auction
“D” - Delisted / Pending deletion
“H” - Halted
“I” - Scheduled intraday auction
“M” - Mandatory quoting period
“N” - New instrument / Pre-listing
“O” - Opening auction
“P” - Pre-market
“Q” - Indicative quoting period
“R” - Off-book trade reporting
“S” - Suspended
“T” - Continuous trading
“U” - Unscheduled auction
“c” - Closed
“i” - IPO / Public offering auction
“n” - No market phase / Unspecified
“o” - Order management
“p” - Post-market
“t” - Trading at last price
def mkt():
pt = otq.Passthrough().tick_type('MKT')
graph = otq.Graph(pt)
return graph
result = otq.run(mkt(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='Europe/London',
symbols='LSE_SAMPLE::VOD'
)
Time |
MKT_PHASE |
QUOTE_BOOK_STATUS |
OFF_BOOK_STATUS |
OMD_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|
0 |
2024-01-03 07:15:00.037 |
T |
R |
77 |
||
1 |
2024-01-03 07:50:00.067 |
a |
T |
O |
134 |
|
2 |
2024-01-03 08:00:06.226 |
T |
T |
T |
26 |
|
3 |
2024-01-03 16:30:00.107 |
d |
T |
C |
91 |
|
4 |
2024-01-03 16:35:07.331 |
u |
T |
t |
0 |
|
5 |
2024-01-03 16:40:00.025 |
b |
T |
p |
34 |
|
6 |
2024-01-03 17:15:00.080 |
x |
T |
p |
106 |
|
7 |
2024-01-03 17:30:00.041 |
c |
T |
c |
34 |
|
8 |
2024-01-03 17:30:00.041 |
c |
c |
c |
0 |
End of Day Record#
End of Day Records are retrieved by specifying the DAY
table, along with the specified database, symbol and time range. This table is only available for a subset of databases.
def daily_bars():
pt = otq.Passthrough().tick_type('DAY')
graph = otq.Graph(pt)
return graph
result = otq.run(daily_bars(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,10,0,0,0),
timezone='Europe/London',
symbols='LSE_SAMPLE_DAILY::VOD'
)
Time |
OPEN |
HIGH |
LOW |
CLOSE |
VOLUME |
ON_BOOK_VOLUME |
OFF_BOOK_VOLUME |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 19:30:00 |
70.0 |
70.75 |
69.38 |
69.51 |
90161664 |
31819135 |
58342529 |
0 |
1 |
2024-01-04 19:30:00 |
70.33 |
70.79 |
69.49 |
70.45 |
37454241 |
27454933 |
9999308 |
0 |
2 |
2024-01-05 19:30:00 |
70.2 |
70.61 |
69.88 |
70.4 |
78330404 |
18362301 |
59968103 |
0 |
3 |
2024-01-08 19:30:00 |
70.35 |
70.46 |
69.18 |
69.98 |
173500261 |
23151733 |
150348528 |
0 |
4 |
2024-01-09 19:30:00 |
70.0 |
70.36 |
69.74 |
70.01 |
61329132 |
24403987 |
36925145 |
0 |
NBBO Events#
National Best Bid & Offer (NBBO) events are retrieved by specifying the NBBO
table, along with the specified database, symbol and time range.
This table is only available for databases that host composite exchanges, and has a similar schema to QTE
tables, with BID_PRICE
, ASK_PRICE
, BID_SIZE
, ASK_SIZE
.
Additionally it also includes BID_EXCHANGE
and ASK_EXCHANGE
.
def nbbo():
pt = otq.Passthrough().tick_type('NBBO')
graph = otq.Graph(pt)
return graph
result = otq.run(nbbo(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,9,30,0),
end = datetime(2024,1,3,9,31,0),
timezone='America/New_York',
symbols='US_COMP_SAMPLE::AAPL'
)
Time |
BID_PRICE |
BID_SIZE |
BID_SIZE_TOTAL |
BID_EXCHANGE |
ASK_PRICE |
ASK_SIZE |
ASK_SIZE_TOTAL |
ASK_EXCHANGE |
IS_PRE_OPEN |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 09:30:00.000602712 |
184.19 |
5 |
5 |
P |
184.3 |
8 |
8 |
P |
0 |
0 |
1 |
2024-01-03 09:30:00.004636610 |
184.2 |
1 |
1 |
P |
184.3 |
8 |
8 |
P |
0 |
0 |
2 |
2024-01-03 09:30:00.018177750 |
184.2 |
1 |
1 |
P |
184.3 |
8 |
10 |
P |
0 |
0 |
3 |
2024-01-03 09:30:00.035895269 |
184.2 |
1 |
1 |
P |
184.29 |
1 |
1 |
K |
0 |
0 |
4 |
2024-01-03 09:30:00.045998724 |
184.2 |
1 |
1 |
P |
184.29 |
1 |
2 |
K |
0 |
0 |
5 |
2024-01-03 09:30:00.046103017 |
184.2 |
1 |
1 |
P |
184.29 |
1 |
1 |
Q |
0 |
0 |
6 |
2024-01-03 09:30:00.058873826 |
184.21 |
1 |
1 |
Z |
184.29 |
1 |
1 |
Q |
0 |
0 |
7 |
2024-01-03 09:30:00.058914405 |
184.21 |
1 |
2 |
Z |
184.29 |
1 |
1 |
Q |
0 |
1 |
8 |
2024-01-03 09:30:00.059014543 |
184.21 |
1 |
2 |
Z |
184.3 |
8 |
10 |
P |
0 |
0 |
9 |
2024-01-03 09:30:00.059296124 |
184.21 |
1 |
2 |
Z |
184.29 |
3 |
3 |
N |
0 |
1 |
Book Depth Events#
Book depth events are retrieved by specifying either the PRL
or PRL_FULL
table, depending on whether Market by Level (MBL) or Market by Order (MBO) data is available.
Typically book depth data is analysed using orderbook processing.
def book_depth_events():
pt = otq.Passthrough().tick_type('PRL_FULL')
graph = otq.Graph(pt)
return graph
result = otq.run(book_depth_events(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,3,9,30,0),
timezone='Europe/London',
symbols='LSE_SAMPLE::VOD'
)
Time |
UPDATE_TYPE |
ORDER_ID |
PART_ID |
ORDER_TYPE |
BUY_SELL_FLAG |
PRICE |
SIZE |
RECORD_TYPE |
TICK_STATUS |
DELETED_TIME |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 05:00:07.876 |
0 |
0.0 |
0 |
Z |
0 |
1970-01-01 01:00:00 |
0 |
||||
1 |
2024-01-03 05:00:07.876 |
A |
233244094926020495 |
L |
0 |
69.0 |
600 |
R |
0 |
1970-01-01 01:00:00 |
0 |
|
2 |
2024-01-03 05:00:07.876 |
A |
233244094926209592 |
L |
0 |
69.0 |
5800 |
R |
0 |
1970-01-01 01:00:00 |
1 |
|
3 |
2024-01-03 05:00:07.876 |
A |
232452446553925487 |
L |
0 |
67.2 |
50000 |
R |
0 |
1970-01-01 01:00:00 |
2 |
|
4 |
2024-01-03 05:00:07.876 |
A |
233244094925636785 |
L |
0 |
67.0 |
10000 |
R |
0 |
1970-01-01 01:00:00 |
3 |
|
5 |
2024-01-03 05:00:07.876 |
A |
233244094925636407 |
L |
0 |
66.94 |
7300 |
R |
0 |
1970-01-01 01:00:00 |
4 |
|
6 |
2024-01-03 05:00:07.876 |
A |
233244094925845524 |
L |
0 |
66.66 |
20000 |
R |
0 |
1970-01-01 01:00:00 |
5 |
|
7 |
2024-01-03 05:00:07.876 |
A |
233244094925636400 |
L |
0 |
66.34 |
7360 |
R |
0 |
1970-01-01 01:00:00 |
6 |
|
8 |
2024-01-03 05:00:07.876 |
A |
233244094925636417 |
L |
0 |
66.0 |
3000 |
R |
0 |
1970-01-01 01:00:00 |
7 |
|
9 |
2024-01-03 05:00:07.876 |
A |
233244094925636406 |
L |
0 |
65.0 |
70000 |
R |
0 |
1970-01-01 01:00:00 |
8 |
Auction Imbalance Events#
Auction Imbalance events are retrieved by specifying the IND
table, , along with the specified database, symbol and time range.
Events are represented with PRICE
, SIZE
, IMB_SIDE
, IMB_VOLUME
and other fields.
def ind():
pt = otq.Passthrough().tick_type('IND')
graph = otq.Graph(pt)
return graph
result = otq.run(ind(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='Europe/London',
symbols='LSE_SAMPLE::VOD'
)
Time |
EXCH_TIME |
PRICE |
SIZE |
IMB_SIDE |
IMB_VOLUME |
AUCTION_TYPE |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 07:50:00.075 |
2024-01-03 07:50:00.074938266 |
69.0 |
6000 |
B |
2900 |
O |
28 |
1 |
2024-01-03 07:50:00.076 |
2024-01-03 07:50:00.075324726 |
69.0 |
6880 |
B |
2020 |
O |
5 |
2 |
2024-01-03 07:50:00.085 |
2024-01-03 07:50:00.085221086 |
69.0 |
7370 |
B |
1530 |
O |
8 |
3 |
2024-01-03 07:50:00.088 |
2024-01-03 07:50:00.087546226 |
69.0 |
8870 |
B |
30 |
O |
1 |
4 |
2024-01-03 07:50:00.090 |
2024-01-03 07:50:00.089537586 |
68.28 |
9505 |
B |
1945 |
O |
8 |
5 |
2024-01-03 07:50:00.102 |
2024-01-03 07:50:00.101007326 |
68.28 |
9847 |
B |
1603 |
O |
1 |
6 |
2024-01-03 07:50:00.116 |
2024-01-03 07:50:00.116153726 |
68.28 |
10006 |
B |
1444 |
O |
0 |
7 |
2024-01-03 07:50:00.459 |
2024-01-03 07:50:00.458532226 |
68.28 |
10006 |
B |
1534 |
O |
1 |
8 |
2024-01-03 07:50:00.476 |
2024-01-03 07:50:00.475473766 |
68.28 |
10006 |
B |
1634 |
O |
1 |
9 |
2024-01-03 07:50:00.482 |
2024-01-03 07:50:00.482214626 |
68.28 |
10006 |
B |
2234 |
O |
3 |
Static Reference Data Record#
The Symbol Universe database holds a standardized schema across all collected venues. Additional fields may be available by querying the STAT
table in a specific database.
def stat():
pt = otq.Passthrough().tick_type('STAT')
graph = otq.Graph(pt)
return graph
result = otq.run(stat(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='Europe/London',
symbols='LSE_SAMPLE::VOD'
)
Time |
NAME |
ISIN |
SEDOL |
EXCH_SYMBOL |
TRADING_CODE |
MIC |
OPERATING_MIC |
SEC_TYPE |
MKT_SEGMENT |
MKT_SECTOR |
COUNTRY_REG |
CURRENCY |
LOT_SIZE |
EXCH_MKT_SIZE |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 04:00:00 |
Vodafone Group plc |
GB00BH4HKS39 |
BH4HKS3 |
VOD |
133215 |
XLON |
XLON |
Equity |
SET1 |
FE10 |
GB |
GBX |
1.0 |
30000 |
24595 |
1 |
2024-01-03 04:00:00 |
Vodafone Group plc |
GB00BH4HKS39 |
BH4HKS3 |
VOD |
133215 |
XLON |
XLON |
Equity |
SET1 |
FE10 |
GB |
GBX |
1.0 |
30000 |
50834 |
2 |
2024-01-03 04:00:00 |
Vodafone Group plc |
GB00BH4HKS39 |
BH4HKS3 |
VOD |
133215 |
XLON |
XLON |
Equity |
SET1 |
FE10 |
GB |
GBX |
1.0 |
30000 |
77076 |
Trade Bar Retrieval#
Pre-calculated 1 minute Trade bars are retrieved by specifying the TRD_1M
table, along with the specified bar database, symbol and time range.
Trade Bars are represented with fields:
FIRST_TIME
, FIRST
, FIRST_SIZE
, HIGH_TIME
, HIGH
, HIGH_SIZE
, LOW_TIME
,
LOW
, LOW_SIZE
, LAST_TIME
, LAST
, LAST_SIZE
, VWAP
, TWAP
, VOLUME
,
TRADE_TICK_COUNT
, TRADE_CURRENCY
def trade_bars():
pt = otq.Passthrough().tick_type('TRD_1M')
graph = otq.Graph(pt)
return graph
result = otq.run(trade_bars(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,9,30,0),
end = datetime(2024,1,3,16,0,0),
timezone='America/New_York',
symbols='US_COMP_SAMPLE_BARS::CSCO'
)
Time |
FIRST_TIME |
FIRST |
FIRST_SIZE |
HIGH_TIME |
HIGH |
HIGH_SIZE |
LOW_TIME |
LOW |
LOW_SIZE |
LAST_TIME |
LAST |
LAST_SIZE |
VWAP |
TWAP |
VOLUME |
TRADE_CURRENCY |
TRADE_TICK_COUNT |
CLOUD_DB |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 09:31:00 |
2024-01-03 09:30:00.127459523 |
50.17 |
100 |
2024-01-03 09:30:04.203519590 |
50.22 |
100 |
2024-01-03 09:30:00.280877749 |
50.002 |
200 |
2024-01-03 09:30:59.206785096 |
50.16 |
100 |
50.141275676529276 |
50.14702879094543 |
69657 |
USD |
418 |
NYSE_TAQ |
0 |
1 |
2024-01-03 09:32:00 |
2024-01-03 09:31:04.039361452 |
50.1501 |
210 |
2024-01-03 09:31:04.532601592 |
50.175 |
100 |
2024-01-03 09:31:46.066142387 |
50.08 |
100 |
2024-01-03 09:31:59.457678670 |
50.09 |
228 |
50.12440588811821 |
50.114364366084445 |
39792 |
USD |
244 |
NYSE_TAQ |
0 |
2 |
2024-01-03 09:33:00 |
2024-01-03 09:32:01.135031886 |
50.09 |
100 |
2024-01-03 09:32:01.135031886 |
50.09 |
100 |
2024-01-03 09:32:58.010510866 |
50.0301 |
267 |
2024-01-03 09:32:59.301339757 |
50.04 |
100 |
50.070230698037484 |
50.066960539431356 |
26904 |
USD |
187 |
NYSE_TAQ |
0 |
3 |
2024-01-03 09:34:00 |
2024-01-03 09:33:01.573754500 |
50.04 |
100 |
2024-01-03 09:33:06.244990351 |
50.06 |
100 |
2024-01-03 09:33:53.740006921 |
50.0 |
200 |
2024-01-03 09:33:56.264120820 |
50.025 |
100 |
50.030940348299815 |
50.031960933556654 |
32673 |
USD |
149 |
NYSE_TAQ |
0 |
4 |
2024-01-03 09:35:00 |
2024-01-03 09:34:00.147786878 |
50.02 |
100 |
2024-01-03 09:34:45.686497272 |
50.04 |
100 |
2024-01-03 09:34:33.162152409 |
50.0 |
100 |
2024-01-03 09:34:59.152722398 |
50.02 |
100 |
50.0221968489766 |
50.022725508399226 |
32783 |
USD |
173 |
NYSE_TAQ |
0 |
5 |
2024-01-03 09:36:00 |
2024-01-03 09:35:00.095924736 |
50.01 |
100 |
2024-01-03 09:35:00.473208988 |
50.0158 |
179 |
2024-01-03 09:35:59.282149482 |
49.975 |
267 |
2024-01-03 09:35:59.282149482 |
49.975 |
267 |
49.996329572554984 |
49.997956855344505 |
36145 |
USD |
180 |
NYSE_TAQ |
0 |
6 |
2024-01-03 09:37:00 |
2024-01-03 09:36:00.068802383 |
49.975 |
350 |
2024-01-03 09:36:49.172087934 |
50.03 |
113 |
2024-01-03 09:36:06.779089127 |
49.941 |
100 |
2024-01-03 09:36:59.670064021 |
50.0037 |
218 |
49.99156810147756 |
49.98349487649964 |
17935 |
USD |
112 |
NYSE_TAQ |
0 |
7 |
2024-01-03 09:38:00 |
2024-01-03 09:37:00.617013627 |
50.01 |
100 |
2024-01-03 09:37:36.006487175 |
50.09 |
100 |
2024-01-03 09:37:00.617013627 |
50.01 |
100 |
2024-01-03 09:37:58.232677278 |
50.09 |
100 |
50.06196197319215 |
50.0626407755625 |
23799 |
USD |
169 |
NYSE_TAQ |
0 |
8 |
2024-01-03 09:39:00 |
2024-01-03 09:38:02.956333624 |
50.09 |
100 |
2024-01-03 09:38:15.309845340 |
50.11 |
100 |
2024-01-03 09:38:19.616040524 |
50.06 |
100 |
2024-01-03 09:38:56.222050698 |
50.095 |
299 |
50.08484982746721 |
50.087088145404735 |
24633 |
USD |
158 |
NYSE_TAQ |
0 |
9 |
2024-01-03 09:40:00 |
2024-01-03 09:39:01.145613061 |
50.1 |
100 |
2024-01-03 09:39:22.550263405 |
50.11 |
100 |
2024-01-03 09:39:03.215387601 |
50.075 |
100 |
2024-01-03 09:39:59.079500891 |
50.08 |
100 |
50.087628326535814 |
50.0888495326284 |
15692 |
USD |
101 |
NYSE_TAQ |
0 |
Quote Bar Retrieval#
Pre-calculated 1 minute Quote bars are retrieved by specifying the QTE_1M
table, along with the specified bar database, symbol and time range.
Bars databases have the suffix _BAR
.
Quote Bars are represented with fields:
FIRST_BID_TIME
, FIRST_BID_PRICE
, FIRST_BID_SIZE
, FIRST_ASK_TIME
, FIRST_ASK_PRICE
, FIRST_ASK_SIZE
,
HIGH_BID_TIME
, HIGH_BID
, HIGH_BID_SIZE
, ASK_PRICE_AT_HIGH_BID
, ASK_SIZE_AT_HIGH_BID
,
LOW_ASK_TIME
, LOW_ASK
, LOW_ASK_SIZE
, BID_PRICE_AT_LOW_ASK
, BID_SIZE_LOW_ASK
,
LAST_BID_TIME
, LAST_BID_PRICE
, LAST_BID_SIZE
, LAST_ASK_TIME
, LAST_ASK_PRICE
, LAST_ASK_SIZE
,
MID_TWAP
, MID_MEDIAN
, MID_LAST
,
SPREAD_MIN
, SPREAD_MAX
, SPREAD_TWAP
, SPREAD_MEDIAN
, SPREAD_LAST
,
QUOTE_CURRENCY
, QUOTE_TICK_COUNT
def quote_bars():
pt = otq.Passthrough().tick_type('QTE_1M')
graph = otq.Graph(pt)
return graph
result = otq.run( quote_bars(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,9,30,0),
end = datetime(2024,1,3,16,0,0),
timezone='America/New_York',
symbols='US_COMP_SAMPLE_BARS::CSCO'
)
Time |
FIRST_BID_TIME |
FIRST_BID_PRICE |
FIRST_BID_SIZE |
FIRST_ASK_TIME |
FIRST_ASK_PRICE |
FIRST_ASK_SIZE |
HIGH_BID_TIME |
HIGH_BID |
HIGH_BID_SIZE |
ASK_PRICE_AT_HIGH_BID |
ASK_SIZE_AT_HIGH_BID |
LOW_ASK_TIME |
LOW_ASK |
LOW_ASK_SIZE |
BID_PRICE_AT_LOW_ASK |
BID_SIZE_LOW_ASK |
LAST_BID_TIME |
LAST_BID_PRICE |
LAST_BID_SIZE |
LAST_ASK_TIME |
LAST_ASK_PRICE |
LAST_ASK_SIZE |
MID_TWAP |
MID_MEDIAN |
MID_LAST |
SPREAD_MIN |
SPREAD_MAX |
SPREAD_TWAP |
SPREAD_MEDIAN |
SPREAD_LAST |
QUOTE_CURRENCY |
QUOTE_TICK_COUNT |
CLOUD_DB |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-03 09:31:00 |
2024-01-03 09:30:00.001830617 |
50.0 |
9 |
2024-01-03 09:30:00.001830617 |
50.18 |
2 |
2024-01-03 09:30:04.009983752 |
50.22 |
1 |
50.23 |
2 |
2024-01-03 09:30:00.901222507 |
50.06 |
1 |
50.05 |
2 |
2024-01-03 09:30:59.770331041 |
50.15 |
5 |
2024-01-03 09:30:59.770331041 |
50.17 |
7 |
50.148087196476304 |
50.144999999999996 |
50.16 |
0.0 |
0.17999999999999972 |
0.01817734975225771 |
0.01999999999999602 |
0.020000000000003126 |
USD |
10370 |
NYSE_TAQ |
0 |
1 |
2024-01-03 09:32:00 |
2024-01-03 09:31:00.001237971 |
50.15 |
5 |
2024-01-03 09:31:00.001237971 |
50.17 |
7 |
2024-01-03 09:31:04.425141902 |
50.17 |
1 |
50.18 |
5 |
2024-01-03 09:31:50.029307600 |
50.09 |
4 |
50.08 |
6 |
2024-01-03 09:31:59.612966216 |
50.08 |
4 |
2024-01-03 09:31:59.612966216 |
50.1 |
5 |
50.11692895454622 |
50.125 |
50.09 |
0.0 |
0.020000000000003126 |
0.014062886532761701 |
0.00999999999999801 |
0.020000000000003126 |
USD |
6711 |
NYSE_TAQ |
0 |
2 |
2024-01-03 09:33:00 |
2024-01-03 09:32:00.005627484 |
50.08 |
4 |
2024-01-03 09:32:00.005627484 |
50.1 |
5 |
2024-01-03 09:32:00.005627484 |
50.08 |
4 |
50.1 |
5 |
2024-01-03 09:32:57.686438468 |
50.04 |
1 |
50.03 |
7 |
2024-01-03 09:32:59.987364942 |
50.03 |
5 |
2024-01-03 09:32:59.987364942 |
50.05 |
7 |
50.0685847534864 |
50.065 |
50.04 |
0.0 |
0.020000000000003126 |
0.01419704896809801 |
0.00999999999999801 |
0.01999999999999602 |
USD |
4338 |
NYSE_TAQ |
0 |
3 |
2024-01-03 09:34:00 |
2024-01-03 09:33:00.000548600 |
50.03 |
5 |
2024-01-03 09:33:00.000548600 |
50.05 |
7 |
2024-01-03 09:33:06.134568404 |
50.06 |
1 |
50.07 |
7 |
2024-01-03 09:33:51.492604922 |
50.01 |
2 |
50.0 |
37 |
2024-01-03 09:33:59.763115198 |
50.02 |
7 |
2024-01-03 09:33:59.763115198 |
50.03 |
1 |
50.0328443527008 |
50.035 |
50.025000000000006 |
0.0 |
0.020000000000003126 |
0.012602865686367424 |
0.00999999999999801 |
0.00999999999999801 |
USD |
2813 |
NYSE_TAQ |
0 |
4 |
2024-01-03 09:35:00 |
2024-01-03 09:34:00.003041083 |
50.02 |
7 |
2024-01-03 09:34:00.003041083 |
50.03 |
1 |
2024-01-03 09:34:55.666761587 |
50.04 |
2 |
50.05 |
7 |
2024-01-03 09:34:05.272632028 |
50.01 |
2 |
50.01 |
1 |
2024-01-03 09:34:59.646788708 |
50.01 |
10 |
2024-01-03 09:34:59.646788708 |
50.02 |
10 |
50.0233620677214 |
50.019999999999996 |
50.015 |
0.0 |
0.020000000000003126 |
0.012165672760011825 |
0.00999999999999801 |
0.010000000000005116 |
USD |
3545 |
NYSE_TAQ |
0 |
5 |
2024-01-03 09:36:00 |
2024-01-03 09:35:00.017051433 |
50.01 |
10 |
2024-01-03 09:35:00.017051433 |
50.02 |
10 |
2024-01-03 09:35:00.017051433 |
50.01 |
10 |
50.02 |
10 |
2024-01-03 09:35:19.496694529 |
49.98 |
1 |
49.97 |
8 |
2024-01-03 09:35:59.814981126 |
49.97 |
1 |
2024-01-03 09:35:59.814981126 |
49.98 |
9 |
49.99628621851424 |
49.995000000000005 |
49.974999999999994 |
0.0 |
0.020000000000003126 |
0.010192058416352925 |
0.00999999999999801 |
0.00999999999999801 |
USD |
4182 |
NYSE_TAQ |
0 |
6 |
2024-01-03 09:37:00 |
2024-01-03 09:36:00.052621600 |
49.97 |
1 |
2024-01-03 09:36:00.052621600 |
49.98 |
9 |
2024-01-03 09:36:49.365835639 |
50.03 |
2 |
50.04 |
10 |
2024-01-03 09:36:06.703468065 |
49.95 |
1 |
49.94 |
7 |
2024-01-03 09:36:59.710312454 |
50.0 |
6 |
2024-01-03 09:36:59.710312454 |
50.01 |
4 |
49.98293959178026 |
49.985 |
50.004999999999995 |
0.0 |
0.020000000000003126 |
0.010938544250337084 |
0.00999999999999801 |
0.00999999999999801 |
USD |
6870 |
NYSE_TAQ |
0 |
7 |
2024-01-03 09:38:00 |
2024-01-03 09:37:00.027411119 |
50.0 |
6 |
2024-01-03 09:37:00.027411119 |
50.01 |
3 |
2024-01-03 09:37:36.006385235 |
50.09 |
1 |
50.1 |
11 |
2024-01-03 09:37:00.027411119 |
50.01 |
3 |
50.0 |
6 |
2024-01-03 09:37:58.873440310 |
50.09 |
1 |
2024-01-03 09:37:58.873440310 |
50.09 |
1 |
50.061558729825606 |
50.045 |
50.09 |
0.0 |
0.020000000000003126 |
0.00827198739784957 |
0.00999999999999801 |
0.0 |
USD |
6051 |
NYSE_TAQ |
0 |
8 |
2024-01-03 09:39:00 |
2024-01-03 09:38:02.956274113 |
50.09 |
1 |
2024-01-03 09:38:02.956274113 |
50.09 |
1 |
2024-01-03 09:38:04.443450459 |
50.1 |
1 |
50.1 |
1 |
2024-01-03 09:38:19.455809161 |
50.07 |
1 |
50.07 |
1 |
2024-01-03 09:38:59.552886138 |
50.09 |
3 |
2024-01-03 09:38:59.552886138 |
50.1 |
7 |
50.08626271618843 |
50.085 |
50.095 |
0.0 |
0.020000000000003126 |
0.009999385281914706 |
0.00999999999999801 |
0.00999999999999801 |
USD |
7853 |
NYSE_TAQ |
0 |
9 |
2024-01-03 09:40:00 |
2024-01-03 09:39:00.122593364 |
50.09 |
3 |
2024-01-03 09:39:00.122593364 |
50.1 |
7 |
2024-01-03 09:39:22.549671903 |
50.1 |
1 |
50.1 |
2 |
2024-01-03 09:39:01.945840384 |
50.08 |
2 |
50.07 |
11 |
2024-01-03 09:39:59.798415631 |
50.08 |
3 |
2024-01-03 09:39:59.798415631 |
50.09 |
6 |
50.088113042522686 |
50.085 |
50.085 |
0.0 |
0.020000000000003126 |
0.00996946482149637 |
0.00999999999999801 |
0.010000000000005116 |
USD |
8048 |
NYSE_TAQ |
0 |
Futures Continuous Contracts#
Trades for futures contract can be retrieved like any other instrument.
def trade_bars():
pt = otq.Passthrough().tick_type('TRD_1M')
graph = otq.Graph(pt)
return graph
result = otq.run(trade_bars(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='America/New_York',
symbols='TDI_FUT_SAMPLE_BARS::ESZ24'
)
Continuous Contracts can be retrieved by changing the SYMBOL_NAME
to the Continuous Contract. This is specified as [Product]_r_tdi
.
Additionally the symbol_date
must also be specified in the run
method.
def trade_bars():
pt = otq.Passthrough().tick_type('TRD_1M')
graph = otq.Graph(pt)
return graph
result = otq.run(trade_bars(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='America/New_York',
symbols='TDI_FUT_SAMPLE_BARS::ES_r_tdi',
symbol_date=datetime(2024,1,4)
)