The Economic Events Data API will help you get a faster handle on the data provided by EODHD Economic Events API. It provides past and future events like Retail Sails, Bond Auctions, PMI Releases, and many other economic events from countries around the world. Please note: this data is available historically starting with 2020.
Quick jump:
Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. You can get more details about the functions of the Economic Events Data API on our documentation web-page.
Accessing the EODHD API
To access the EODHD API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.
api = APIClient("demo")
You can also specify the API key in a configuration file or as an environment variable, as described in the library documentation here.
1. Use the “demo” API key to test our data from a limited set of the tickers without registering:
AAPL.US | TSLA.US | VTI.US | AMZN.US | BTC-USD | EUR-USD
Real-Time Data and most APIs can be tested this way without the limitations of API calls.
2. Register to get your free API key (limited by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange.
3. To unlock your API key for full use, we recommend to choose the subscription which covers your needs.
Retrieving Economic Events Data
After we are done with the API client, we can start requesting economic events data for specific countries.
events = api.get_economic_events_data ()
The API response will be a single JSON structure.
Converting JSON Response to DataFrame
To convert JSON to DataFrame it is possible to use:
ee = pd.DataFrame(events)
All data in the DataFrame will contain information such as: “type”, “comparison”, “period”, and “country”.
print(ee)
Extended functions of Economic Events Data API
For a more accurate research, it is possible to use parameters that lays in Economic Events Data API. It is possible to use range of dates from and to, which will help to get information for certain dates. Country, which will help you to get data for certain country. The country code is in ISO 3166 format, it means that code contains two symbols, for example US or FR. Comparison, helps to compare data for certain period, possible values: mom, qoq, yoy. Offset – the offset of the data. Limit is The number of results should be returned.
events_extended = api.get_economic_events_data (date_from = "2020-12-10", date_to = "2021-04-10", limit = "200", country = "US", comparison = "qoq")
The API response is a JSON array containing data for all the requested tickers. You can convert the resulting JSON array to a DataFrame for further analysis:
ee_m = pd.DataFrame(events_extended)
print (ee_m)
Conclusion
By using the Economic Events API, it is gets easier to control your Economic Calendar. The API makes it possible to stay up to date with financial events and indicators from all over the world.