R API
The Infront R API makes it efficient to analyse data with the built in tools that R supports. You can easily create your own graphical charts like return histograms by using R's graphical user interface (GUI). Using Infront's Desktop API for R, you can conduct portfolio analyses, simulate extreme events and their effect on prices, create visualizations and indicators to better understand the market dynamics, and much more.
As your daily companion with your Infront Professional Terminal, R provides you with over 6,500 open-source packages covering thousands of use cases.
To access the full functionality of the Python API, you will need:
- Infront Professional Terminal
- EOD module
- Access to relevant market data
How to open the R API
You can use various types of software to access the R API. An example of software you can use is RStudio. Once you have decided on your software of choice you can follow the installation instructions here.
How to use the R API
To find a symbol: There are a few fields that are required to find a match for an instrument. That is, Feed and Ticker. This 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 to your Watchlist.
Example
Feed = "OSS" and Ticker = "DNB". In RStudio it will look like this:
["OSS:DNB"]
To get multiple symbols in the same request you can use a comma as a separator. Example:
["OSS:DNB", "SSE:VOLV A", "..."]
You can use the documentation to send an API request here. There are a few variables you can change. These are:
Variable | Description |
---|---|
Tickers | You should change FEED and TICKER to the feed and ticker you want to export history from. If you want to export data for DNB from Oslo Stock Exchange, you use OSS instead of FEED and DNB instead of TICKER, that is, c("OSS:DNB"). Fields The fields that are supported in the R API include:
|
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", for example "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
MySymbols = GetHistory(tickers = c("FEED:TICKER), fields = c("bid","ask","turnover","volume","last"),
start_date = "YYYY-MM-DD", end_date = "YYYY-MM-YY")
Example of an API request with information inserted (Ticker= DNB, Feed= OSS
Start_date= 2019-01-01, End_date= 2099-01-01):
MySymbols = GetHistory(tickers = c("OSS:DNB"), fields = c("bid","ask","turnover","volume","last"),
start_date = "2019-01-01", end_date = "2099-01-01")
The data that can be retrieved with R API includes:
- Historical Data
- Stock, bonds, futures, forex, warrants
- Fields: open, high, low, last, turnover, volume, bid, ask