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 -
Which update are you talking about?
I have the same..
Error code 0 | Error happened during config file ../Configuration\refinitiv-data.config.json read
0 -
This is my config file:
{
"logs": {
"level": "debug",
"transports": {
"console": {
"enabled": true
},
"file": {
"enabled": false,
"name": "refinitiv-data-lib.log"
}
}
},
"sessions": {
"default": "platform.rdp",
"platform": {
"rdp": {
"app-key": "XXX",
"username": "XXX@XXX.com",
"password": "XXX"
},
},
"desktop": {
"workspace": {
"app-key": "XXX"
}
}
}
}
But when I run
import os
os.environ["RD_LIB_CONFIG_PATH"] = "../Configuration"
import refinitiv.data as rd
rd.open_session()
I keep getting
- Error code 0 | Error happened during config file ../Configuration\refinitiv-data.config.json read
0 -
All good now, I've found the issue.
0
Categories
- All Categories
- 6 AHS
- 39 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
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛