Last update | January 2019 |
Interpreter | Pythom 2.x/3.x |
Python is currently one of the most popular programming languages and is also considered a great language to start programming with.
There are a great number of Python beginners guides online, but I would like to save you a little time by helping you create a designated Eikon development environment. It will consist of:
Anaconda from Continuum Analytics is universally praised by the Python community as possibly the simplest way to install libraries for numerical operations.
The 'conda' command is a package installer, so you can add the most popular packages with it easily, however, you can see that pip, wheel and setuptools are also installed.
Let's install our first package: jupyter notebook, that allows creating and running interactive notebooks inside a browser:
Note, that we installed jupyter to the default environment. It itself supports multiple environments, and you can easily switch it back and forth. But keeping your project specific packages is vital. If you are just starting, you will play with the language a lot and it is essential to be able to undo the effects of your experiments. For this purpose, we are going to create a separate development environment.
Now let's activate our environment and list the packages:
C:\Users\zhenyakovalyov>activate refinitiv
(refinitiv) C:\Users\zhenyakovalyov>conda list
# packages in environment at C:\Users\zhenyakovalyov\Miniconda3\envs\refinitiv:
#
pip 9.0.1 py36_1
python 3.6.1 0
setuptools 27.2.0 py36_1
vs2015_runtime 14.0.25123 0
wheel 0.29.0 py36_0
et's install the packages that we will require for our work in this environment: numpy, pandas and matplotlib.
Once we are done working here, we can easily deactivate the environment with deactivate refinitivcommand.
I use Visual Code for anything these days (including this guide), however, you can always check out its free alternatives like Sublime Text or Atom, or use a designated python integrated development environment like PyCharm.
Depending on your Eikon version and your Operating System (Windows or Mac OS) you may need to run the Eikon Data API Proxy or just Eikon. Please refer to the Quick Start guide for Windows if you use Windows with TR Eikon 4.0.36 (or higher). Refers to the Quick Start guide for Mac OS if you use Mac OS or a version of TR Eikon prior to 4.0.36.
Ok, you are all done!
Now, let's practice some command line commands.
Let's run Eikon:
Now, Let's go back to our notebook. In the first cell, input the following commands:
import eikon as tr
import pandas as pd
tr.set_app_key('your_app_key')
ratings_data, err = tr.get_data(instruments=['0#.SPX'],
fields=['TR.CommonName',
'TR.IssuerRating(IssuerRatingSrc=SPI)',
'TR.IssuerRating(IssuerRatingSrc=SPI,Sdate=-10Y)'])
ratings_data.head()
The result should look like this:
Instrument | Company Common Name | Issuer Rating | Issuer Rating | |
---|---|---|---|---|
0 | MMM.N | 3M Co | AA- | AA |
1 | ABT.N | Abbott Laboratories | BBB | AA |
2 | ABBV.N | AbbVie Inc | A- | |
3 | ACN.N | Accenture PLC | A+ | A+ |
4 | ATVI.OQ | Activision Blizzard Inc | BBB- | BB- |