price history request minutes level

I am looking for a way to request price history data in Python locally (not in the refinitiv codebook environment) on a minutes level to get Close, Open, Low, High, Volume, Bid, Ask for a given stock ticker . If I request the data manually in Refinitiv the output looks as follows:
Now, I want to get the same automatically using python. I have used
get_timeseries and get_data
function but was not successfull in getting to the exact same output.
Best Answer
-
That error does look odd - as the os.environ line is pointing it to a Configuration folder several folders upstream from the location of your notebook - so not sure why it is looking in your users Eikon folder.
One thing to try is to comment out the os.environ line i.e.
import os
# os.environ["RD_LIB_CONFIG_PATH"] = "../../../Configuration"
import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
rd.open_session()This will rely on the default behaviour and try and use a default app-key for a desktop connection. It will mean you cant enable logging etc for now - but at least we can get past this point for now and let you try out the code.
0
Answers
-
You can use the get_timeseries method to retrieve minute intervals of historical data.
df = ek.get_timeseries(['ADSGn.DE'], interval="minute")
However, the output contains only the HIGH, LOW, OPEN, CLOSE, COUNT, and VOLUME fields.
You can run help(ek.get_timeseries) to see all parameters of the get_timeseries method.
To get other fields, you can use the Refinitiv Data Library for Python. The examples are available on GitHub.
First, configure the Refntiiv Data Library (refinitiv-data.config.json) to use the Desktop session.
"sessions": {
"default": "desktop.workspace",
"platform": {
"rdp": {
"app-key": "YOUR APP KEY GOES HERE!",
"username": "YOUR RDP LOGIN OR MACHINE GOES HERE!",
"password": "YOUR RDP PASSWORD GOES HERE!"
},
"deployed": {
"app-key": "YOUR APP KEY GOES HERE!",
"realtime-distribution-system": {
"url" : "YOUR DEPLOYED HOST:PORT GOES HERE!",
"dacs" : {
"username" : "YOUR DACS ID GOES HERE!",
"application-id" : 256,
"position" : ""
}
}
}
},
"desktop": {
"workspace": {
"app-key": "YOUR APP KEY GOES HERE!"
}
}
}Then, run the EX-2.01.01-HistoricalPricing.ipynb example.
The code looks like this:
response = historical_pricing.summaries.Definition(
"ADSGn.DE",
interval=Intervals.ONE_MINUTE,
fields=["HIGH_1", "LOW_1", "OPEN_PRC", "TRDPRC_1", "BID", "ASK"]
).get_data()
response.data.dfThe output is:
You can also run help(historical_pricing.summaries.Definition) to see all parameters of this method.
0 -
Thanks for your quick response. However, I dont know which url I need to plug into "YOUR DEPLOYED HOST:PORT GOES HERE! ". Additionally, I have problems getting my DACS username/ ID, could you help me where I get this DACS ID?
Many thanks!
0 -
You are asking about Deployed host and DACS username - these are only required if connecting to a local ADS server.
To connect to your Eikon - you only need to fill in the desktop workspace app-key section
"desktop": {
"workspace": {
"app-key": "YOUR APP KEY GOES HERE!"
}
}You can generate an App-Key at http://amers1-apps.platform.refinitiv.com/apps/appkeygenerator or inside Eikon by searching for AppKey - as described here Quick Start | Refinitiv Developers
0 -
My refinitiv-data.config.json configuration file now looks as follows:
"desktop": {
"workspace": {
"app-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}However, when running the code:
import os
os.environ["RD_LIB_CONFIG_PATH"] = "../../../Configuration"
import refinitiv.data as rd
from refinitiv.data.content import historical_pricing
rd.open_session()
response = historical_pricing.events.Definition("LSEG.L").get_data()
response.data.dfI get the following error:
raise RDError(0, f"Error happened during config file {path} read") from exc
refinitiv.data._errors.RDError: Error code 0 | Error happened during config file C:\Users\Basilio\PycharmProjects\EIKON\refinitiv-data.config.json read
I checked the path, and its correct, I have also tried other versions of the refinitiv-data.config.json configuration file like:
"sessions": {
"default": "desktop.workspace",
"desktop": {
"workspace": {
"app-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
}
}leading to the same error message.
0 -
Can you also confirm you are using the latest version
pip install refinitiv-data==1.0.0b16
Thanks.
0 -
Thank you very much, with the latest version it works!
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
- 689 Datastream
- 1.4K DSS
- 629 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
- 559 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
- 24 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 279 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 713 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
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛