Return Time Series Result as a List instead of one FullyPandas DataFrame

fabian.echterling
Newcomer
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
- 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
- 624 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
- 557 WebSocket API
- 38 FX Venues
- 14 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
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 692 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
- 105 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 10 Wealth Management Web Services
- 91 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛