Asset Classes

Free investment financial education

Language

Multilingual content from IBKR

Close Navigation
Learn more about IBKR accounts

Introduction to R and RStudio

Lesson 1 of 8
Duration 3:25
Level Intermediate
Close Navigation
Contributed By: QuantInsti

Congratulations for enrolling in this course on Trading using R! We are sure that the course videos and the study material will be of great help in your goal for trading using R on Interactive Brokers platform. The course study notes have been divided into a number of lessons and have been designed in an easyto-understand language. Let’s get rolling and start off with the first lesson on introduction to R and RStudio.

In this lesson, you would:

• Get introduced to R and RStudio

• Know the difference between R and RStudio

• Learn the benefits of using R for automated trading

What is R?

R is a programming language used for scientific computing and graphics. The roots of R language can be found in the S programming language which was developed at Bell laboratories in the 1970s, mainly by John Chambers. The R language was conceived in the early 1990s by Ross Ihaka and Robert Gentleman. R also refers to the software environment which is used to run the programs written in R. The R environment is free and open-source software. R as a programming language has gained wide popularity in recent years and it ranks among the top programming languages for data science. This popularity has resulted on account of various factors like ease-to-learn, excellent data manipulation and visualization tools, thousands of contributed packages on CRAN (Comprehensive R Archive Network), ability to create your own packages, and a large developer community.

What is RStudio?

RStudio is an integrated development environment (IDE) that helps you develop programs in R. An integrated development environment (IDE) is a software application that provides a facility to programmers for easy software development. An IDE normally consists of a source code editor, build automation tools and a debugger. There are other IDEs for R like Visual Studio and Eclipse, however, RStudio is considered to be the best available IDE for R programming.

Difference between R and RStudio

It is important that you understand the difference between R and RStudio. You can use R without using RStudio IDE, but you cannot use RStudio without using R. In the RStudio configuration, an R version is required to be set which is usually auto-set by RStudio when it is installed. RStudio makes it easy for writing programs in R but it is not a must to use R.

Benefits of using R for Automated Trading

R has found application in numerous fields like Finance, Marketing, Manufacturing, Retail, Bio Science etc. Given its excellent data manipulation and visualization tools, it has also been successfully used for automated trading in financial markets. Following are the benefits of using R:

  • Free and Open-source software
  • Excellent built-in functions
  • Thousands of Contributed packages
  • Ability to create your own packages
  • Availability of packages like Quantstrat, QuantTools and PerformanceAnalytics for backtesting and analyzing trading strategies
  • Quick prototyping of back-tested strategies, thus requiring minimal code changes
  • Ability to figure out the difference between real life and back-tested data

Summary

In this introductory lesson, we talked about R, RStudio, and listed the benefits of using R for automated trading. In the next lesson, we will explain the installation guidelines for R and RStudio.

Additional Resources

List of Contributed Packages on CRAN, sorted by name

List of Contributed Packages on CRAN, sorted by data of publication

Note – The IBrokers package provides native R access to Interactive Brokers Trader Workstation API

Join The Conversation

If you have a general question, it may already be covered in our FAQs. If you have an account-specific question or concern, please reach out to Client Services.

Leave a Reply

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

Disclosure: R API Disclosure

This software is in no way affiliated, endorsed, or approved by Interactive Brokers or any of its affiliates. It comes with absolutely no warranty and should not be used in actual trading unless the user can read and understand the source. IBrokers is a pure R implementation of the TWS API.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.