Return Time Series Result as a List instead of one FullyPandas DataFrame
When I query data for an American company (e.g. Google; `GOOG.O`) and a British (e.g. RaspberryPi; `RPI.L`) the data frame returned is a full merge of American and British trading days resulting in NAs in the respective time series if e.g. American markets have a non trading day as of `2024-06-19` (see example below). Is that default behavior adjustable to returning a list with a time series per ticker in order to avoid having NAs in the time series when pulling a mixed/international universe?
>>> res=rd.get_history(
... ['GOOG.O', 'RPI.L'],
... start = '2023-01-01',
... end = datetime.today().strftime('%Y-%m-%d'),
... # end = pd.to_datetime('today').strftime('%Y-%m-%d'),
... interval='daily',
... # fields = ['CLOSE', 'OPEN', 'HIGH', 'LOW']
... fields = [
... 'TR.OPENPRICE',
... 'TR.HIGHPRICE',
... 'TR.LOWPRICE' ,
... 'TR.CLOSEPRICE'
... ]
... )
>>> res
GOOG.O ... RPI.L
Open Price High Price Low Price ... High Price Low Price Close Price
Date ...
2023-01-03 89.83 91.55 89.02 ... <NA> <NA> <NA>
2023-01-04 91.01 91.24 87.8 ... <NA> <NA> <NA>
2023-01-05 88.07 88.21 86.56 ... <NA> <NA> <NA>
2023-01-06 87.36 88.47 85.57 ... <NA> <NA> <NA>
2023-01-09 89.195 90.83 88.58 ... <NA> <NA> <NA>
... ... ... ... ... ... ... ...
2024-06-18 178.79 178.91 175.62 ... 465.0 422.05 425.0
2024-06-19 <NA> <NA> <NA> ... 435.0 400.0 415.0
2024-06-20 176.71 178.74 176.46 ... 415.0 370.0 372.0
2024-06-21 178.49 182.5117 178.06 ... 389.5 365.0 373.5
2024-06-24 181.28 182.08 180.23 ... 399.0 362.0 390.0
[379 rows x 8 columns]
Tagged:
0
Best Answer
-
Thank you for reaching out to us.
For the TR.xxx fields, you can try the get_data method instead.
df = rd.get_data(['GOOG.O', 'RPI.L'],
["TR.OpenPrice.Date","TR.OpenPrice", "TR.HighPrice", "TR.LowPrice","TR.ClosePrice"],
{'SDate':'2023-01-01', 'EDate':'2024-06-24'})
df.dropna()The output is:
0
Answers
-
Cool, that does it! So `get_data` is the "better" function to use instead of `get_history`?!
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 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
- 367 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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛