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 -
geometry dash unblocked I would recommend you look at the newer and strategic
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
- 6 AHS
- 39 Alpha
- 162 App Studio
- 4 Block Chain
- 5 Bot Platform
- 17 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 370 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛