Coined in 1933, the first 100 days is sometimes used to measure the successes and accomplishments of a first-term president during the time that the their power and influences are at their greatest. Approval rates are largely taken from polls and surveys where the results are typically measured based on their performance. Criteria such as the decisions made, changes based on campaign promises, etc., are expected but also general perception, and overall popularity can be very influential. In addition to public opinion, how the financial markets respond during this time can be an interesting guide or measuring-stick when grading the first 100 days.
Using the power of Python and the Thomson Reuters Eikon Scripting API, the following Jupyter notebook application provides a simple mechanism to create a number of "what-if" scenarios to measure the performances of presidents to see how the market has responded to the first 100 days.
Details and concepts are further explained in the U.S. Presidents - The first 100 Days article published on the Thomson Reuters Developer Community portal.
The source code presented in this project has been written by Thomson Reuters only for the purpose of illustrating the concepts of creating the "what-if" scenarios using Python and the Eikon Scripting API. It has not been tested for a usage in production environments.
Note: To be able to ask questions and to benefit from the full content available on the TR Developer Community portal we recommend you to register here or login here.
Software components used:
- Eikon Web and Scripting API - Thomson Reuters interface to access Eikon data on the desktop
- Python (3.6.1)- Python Development Environment - version 3
- Jupyter notebooks - Browser-based development environment to create equations, visualization and explanatory text.
- ipywidgets (7.0.0) - Interactive HTML widgets for jupyter notebooks
- One time initialization:
- With pip: jupyter nbextension enable --py --sys-prefix widgetsnbextension
- With conda: conda install -c conda-forge ipywidgets
- One time initialization:
- Pandas (0.20.3) - Python Data Analysis Library
- Cufflinks (0.12.0) - Library that greatly simplifies Plotly charting
The application package includes the following:
-
USPresidents_100Days.ipynb
The Jupiter Notebook document represents the example containing the core Python instructions to execute our application. All the input data is driven from simple text files allowing the user to easily add additional values.
-
presidents.csv
The presidents file is a collection of (
name,date) pairs where the date value represents the inauguration date of their first term:Donald J Trump, 2017-01-20 Barack Obama, 2009-01-20 George W. Bush, 2001-01-20 -
industries.csv
The industries file contains a collection of (
name,ric) pairs where thericis the Reuters Instrument Code representing the market of interest:Equity: Dow Jones, .DJI Equity: Mkt Volatility, .VIX Currency: USD $, =USD
The application is executed within the Jupyter notebooks web-based environment. Prior to running the application, ensure you have launched your Eikon API Proxy - a component packaged with the Eikon Web and Scripting API bundle.
To run the application, let's load up Notebook:
> cd <directory of the downloaded package>
> jupyter notebook
Within your browser, load up the USPresidents_100Days.ipynb application:
Once loaded, you can start by stepping through the code segments to reach the point where the UI is presented for your input selection.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Nick Zincone - Release 1.0. Initial version
This project is licensed under the MIT License - see the LICENSE.md file for details
