Fetching monthly economic indicators¶
Show code cell content
import refinitiv.data as rd
rd.open_session()
/home/runner/.local/share/virtualenvs/refinitiv-data-python-cookbook-I-HIyNf4/lib/python3.10/site-packages/refinitiv/data/_access_layer/session.py:71:FutureWarning:
You open a platform session using the default value of the signon_control parameter (signon_control=True).
In future library version v2.0, this default will be changed to False.
If you want to keep the same behavior as today, you will need to set the signon_control parameter to True either in the library configuration file
({'sessions':{'platform':{'your_session_name':{'signon_control':true}}}}) or in your code where you create the Platform Session.
These alternative options are already supported in the current version of the library.
<refinitiv.data.session.Definition object at 0x7f068c1a17e0 {name='rdp'}>
You can use the Refinitiv Data Library for Python to retrieve monthly economic indicators like inflation and unemployment by passing the relevent Refinitiv Instrument Code to the get_history
function with the interval
parameter set to "monthly"
.
Here’s how to retrieve the Consumer Price Index, a monthly inflation indicator released by the US Bureau of Labor Statistics:
rd.get_history(
"USCPI=ECI",
interval="monthly",
)
USCPI=ECI | VALUE |
---|---|
Date | |
2022-11-30 | 0.3 |
2022-12-31 | 0.1 |
2023-01-31 | 0.5 |
2023-02-28 | 0.4 |
2023-03-31 | 0.1 |
2023-04-30 | 0.4 |
2023-05-31 | 0.1 |
2023-06-30 | 0.2 |
2023-07-31 | 0.2 |
2023-08-31 | 0.5 |
2023-09-30 | 0.4 |
2023-10-31 | 0.1 |
2023-11-30 | 0.2 |
2023-12-31 | 0.2 |
2024-01-31 | 0.3 |
2024-02-29 | 0.4 |
2024-03-31 | 0.4 |
2024-04-30 | 0.3 |
2024-05-31 | 0.0 |
2024-06-30 | -0.1 |
Show code cell content
rd.close_session()