Retrieval with Symbology#
A series of simple examples are provided showing how to retrieve data with a specified symbology.
Standard Retrieval#
Data is generally retrieved by specifying
Table (e.g.
TRD
).Symbol(s) using the field
SYMBOL_NAME
(including the Database in form[database]::[symbol]
Or:
Database & Table (Separated by
::
e.g.US_COMP_SAMPLE::TRD
).Symbol or Symbols using the field
SYMBOL_NAME
Where the Symbol typically represents the exchange ticker symbol for the instrument. e.g. AAPL for Apple Inc.
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' # Specifies the [Database]::[Symbol]
)
def trades():
pt = otq.Passthrough().tick_type('US_COMP_SAMPLE::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='CSCO' # Specifies the [Symbol]
)
Bloomberg Symbol Retrieval#
Symbols can be retrieved by Bloomberg Symbol with:
Prefixing the SYMBOL_NAME with
BSYM::
Specifying the
SYMBOL_NAME
as the full Bloomberg SymbolSpecifying the Date when the symbol is active (as symbols can change across time), using
SYMBOL_DATE
In this case the SYMBOL_NAME
is expanded to use the syntax [SYMBOLOGY]::[DATABASE]::[SYMBOL]
e.g. BSYM::US_COMP_SAMPLE::CSCO US Equity
def trades():
pt = otq.Passthrough().tick_type('TRD')
return otq.Graph(pt)
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='BSYM::US_COMP_SAMPLE::CSCO US Equity',
symbol_date = datetime.today()
When the Directed Graph defines the database
, the database component can be removed from the SYMBOL_NAME
, producing:
[SYMBOLOGY]::::[SYMBOL]
. e.g. BSYM::::CSCO US Equity
.
def trades():
pt = otq.Passthrough().tick_type('US_COMP_SAMPLE::TRD')
return otq.Graph(pt)
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='BSYM::::CSCO US Equity',
symbol_date = datetime.today()
FIGI Composite Symbol Retrieval#
Symbols can be retrieved by FGI Composite with:
Prefixing the SYMBOL_NAME with
FGC::
Specifying the
SYMBOL_NAME
as the FIGI Composite SymbolSpecifying the Date when the symbol is active (as symbols can change across time), using
SYMBOL_DATE
result = otq.run(query,
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='FGC::US_COMP_SAMPLE::BBG000B9XRY4',
symbol_date = datetime.today()
CUSIP Symbol Retrieval#
Symbols can be retrieved by CUSIP with:
Prefixing the SYMBOL_NAME with
CUS::
Specifying the
SYMBOL_NAME
as the CUSIPSpecifying the Date when the symbol is active (as symbols can change across time), using
SYMBOL_DATE
result = otq.run(query,
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='CUS::US_COMP_SAMPLE::037833100',
symbol_date = datetime.today()
ISIN Symbol Retrieval#
Symbols can be retrieved by ISIN with:
Prefixing the SYMBOL_NAME with
ISIN::
Specifying the
SYMBOL_NAME
as the ISINSpecifying the Date when the symbol is active (as symbols can change across time), using
SYMBOL_DATE
result = otq.run(query,
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3),
end = datetime(2024,1,4),
timezone='Europe/London',
symbols='ISN::LSE_SAMPLE::GB00BH4HKS39',
symbol_date = datetime.today()
SEDOL Symbol Retrieval#
Symbols can be retrieved by SEDOL with:
Prefixing the SYMBOL_NAME name with
SED::
Specifying the
SYMBOL_NAME
as the SEDOLSpecifying the Date when the symbol is active (as symbols can change across time), using
SYMBOL_DATE
result = otq.run(query,
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2024,1,3),
end = datetime(2024,1,4),
timezone='Europe/London',
symbols='ISN::LSE_SAMPLE::BH4HKS3',
symbol_date = datetime.today()