Specifying a list of instruments for Market Prices for Historical Price Summaries

response = rdp.get_historical_price_summaries(
universe= ccy_pair,
interval=rdp.Intervals.DAILY,
# Supported intervals: ONE_MINUTE, FIVE_MINUTES, TEN_MINUTES, THIRTY_MINUTES, ONE_HOUR
#fields = ['BID','ASK'],
start=start_date_ts,
end=end_date_ts
)
I want to specify a list of ccy pairs instead of one ccy pair. Do you have an example of this in Python.
Best Answer
-
Hello @navtej.riyait
Did you try the new Data Library - Python yet? The RD historical_pricing.summaries.Definition object support list of string as follows:
Code:
response = historical_pricing.summaries.Definition(
universe = ['HUF=', 'EUR=', 'GBP=', 'CNH='],
interval=Intervals.ONE_MINUTE,
fields = ['BID','ASK'],
start = '2023-08-01 01:00:00',
end = '2023-08-02 01:00:00 '
).get_data()
response.data.dfResult:
0
Answers
-
Hi @navtej.riyait ,
Could you please try using the list of instrument, for example, ['RIC1','RIC2','RIC3']
In addition, I
would recommend you look at the newer and strategic RD Library for PythonFor a position statement on the older
RDP Library please see the overview page.0 -
start_date = '2023-10-02 00:00:00.000'
end_date = '2023-10-03 00:00:00.000'
ccy_pair1 = ['HUF=', 'EUR=', 'GBP=', 'CNH=']
response = rdp.get_historical_price_summaries(
universe= ccy_pair1,
interval=rdp.Intervals.DAILY,
start=start_date,
end=end_date
)I get an error when using an instrument list. See below
Traceback (most recent call last):
File "C:\FX Surveillance\FX Options\get_market_prices_options_underlying.py", line 134, in <module>
get_market_prices()
File "C:\FX Surveillance\FX Options\get_market_prices_options_underlying.py", line 116, in get_market_prices
historical_mkt_prices = get_historical_prices(ccy_pair, start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\FX Surveillance\FX Options\get_market_prices_options_underlying.py", line 70, in get_historical_prices
response = rdp.get_historical_price_summaries(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\factory\content_factory.py", line 646, in get_historical_price_summaries
return ContentFactory._get_historical_price_summaries(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\factory\content_factory.py", line 252, in _get_historical_price_summaries
historic_summaries = historical_pricing.get_summaries(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\content\data\historical_pricing.py", line 302, in get_summaries
result = historical_pricing._get_summaries(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\content\data\historical_pricing.py", line 327, in _get_summaries
return self._endpoint.session._loop.run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\nest_asyncio.py", line 59, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 267, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\content\data\historical_pricing.py", line 523, in _get_summaries_async
_result = await self._get_historicalpricing(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\content\data\historical_pricing.py", line 665, in _get_historicalpricing
_result = await self._endpoint.send_request_async(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\delivery\data\endpoint.py", line 518, in send_request_async
_url = self._update_url(
^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\dataplatform\delivery\data\endpoint.py", line 410, in _update_url
value = urllib.parse.quote(value)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\urllib\parse.py", line 893, in quote
return quote_from_bytes(string, safe)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\U6082634\AppData\Local\Programs\Python\Python311\Lib\urllib\parse.py", line 923, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
0 -
Hi Wasin,
I haven't had time to try yet.
One question: Do I need to have Eikon running to use the RD libraries ?
Regards
Navtej
,Hi Wasin,
I haven't had time to try yet.
One question: Do I need to have Eikon running to use the RD libraries ?
Regards
Navtej
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 688 Datastream
- 1.4K DSS
- 625 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 558 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 277 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 1.9K Refinitiv Data Platform
- 695 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 92 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛