Note: The help system has been updated - click here to go to the most recent version
 

Python API

Home  Previous  Next

The Infront Python API is an easy way to analyse data with your own Python scripts. It provides finished wrapped data in data frames, and you can use it with a Command Line nterface (CLI). Using Infront’s Python API, you can conduct portfolio analyses, simulate extreme events and their effect on prices, and create visualizations and indicators to better understand the market dynamics and much more. Python, as your daily companio with your Infront Professional Terminal, provides you with over 114,000 open-source packages covering thousands of use cases.

 

In order to access the full functionality of the Python API, you will need:

Infront Professional Terminal

EOD Module

Access to relevant market data

If you do not have access, please contact Infront.

 

How to open the Python API

 

You will need to install Python. You can find the installation for Python here, →  Click on Download Python and install Python on your computer →  

A new window will pop up, click on Customize installation →  Next window will show Optional features. We recommend you to install all features.

To do so, tick of:

Documentation,

pip,

tcl/tk and DLE”,

Python test suite”,

py launcher and for all users

→  Click on Next which will forward you to a window with overview of Advanced Options →  Tick Associate files with Python,

Create shortcuts for installed applications, Add Python to environment variables →  Then click on Install and the installation will start.

 

Once you have installed Python you can follow the instructions under the Infront Connect Installation. You can find this on our website here.

 

How to use the Python API

 

To find a symbol: The Feed and Ticker fields are required to find a match for an instrument. These can be found in the Overview window for the instrument in the Infront Professional Terminal. It is also possible to find this information in a Watchlist.To do so,  open up a Watchlist, add the preferable instrument and add the columns Ticker and Feed.

 

An example, Feed = “OSS” and Ticker = “DNB”. In Python code it will look like this: [“OSS:DNB”]

 

To send an API request: You can use the documentation to send an API request here. There are a few variables you can change. These are

Tickers- You should change FEED and TICKER to the feed and ticker that you want to export history from. If you want to export data DNB from Oslo Stock Exchange you put in OSS instead of FEED and DNB instead of TICKER. e.g [“OSS:DNB”]

Fields- The fields that are supported in the Python API are

open

high

low

last (last value from the day before)

turnover

volume

bid

ask

 

Start date: Here you can set the date from when you would like to get the historical data. The date format is “YYYY-MM-DD” e.g “2019-01-01”.

End date: This date has the same format as Start_Date and you can set the last date in the period you want to export history from. If you set this to                                                                                                                                                    a future date, for instance “2099-01-01” you will get all the data from the start date until yesterday’s date.

 

Example of an API request without information inserted

MySymbol = infront.GetHistory(tickers = [“FEED:TICKER”], fields = [“open”, “high”, “low”, “last”, “turnover”, “volume”, “bid”, “ask”], start_date = “YYYY-MM-DD”, end_date = “YYYY-MM-DD”)

 

Example of an API request with information inserted

(Ticker= DNB, Feed= OSS. Start_date= 2019-01-01, End_date= 2099-01-01: MySymbol = infront.GetHistory(tickers = [“OSS:DNB”], fields = [“open”, “high”, “low”, “last”, “turnover”, “volume”, “bid”, “ask”], start_date = “2019-01-01”, end_date = “2099-01-31”)

 

The data that can be retrieved with Python API includes;

Historical Data

Stocks, bonds, futures, forex, warrants

Fields- open, high, low, last, turnover, volume, bid, ask