Search for contacts, projects,
courses and publications

Programming in Finance I


Gruber P.

Course director


Introduction to programming with R, for example Informatica I or an online introduction (see requested material)


Many interesting problems in economics and finance can only be solved with the help of the computer, as no analytical solution exists or large amounts of data are involved. This course teaches how to solve quantitative problems in finance with the help of R, a powerful and widely used open source programming environment.

The course has the following goals:

  • Learn the most important elements of the R language
  • Understand the differences between analytical and numerical problem solving
  • Learn how to translate mathematical or statistical algorithms into the R language
  • Learn how to organize data efficiently with the help of R
  • Learn how to write efficient and durable R programs

After this course, students should be able to use R in courses such as numerical methods as well as for their master thesis.

Description / Program

The course is structured along computational concepts, not applications.

The topics include

  • How computers calculate: floating point numbers
  • Variables, types and operators
  • The R language: commands and functions
  • User-defined functions and modular programming
  • Flow control: if, for and while
  • An introduction to working with data in R
  • Data sources and data APIs
  • A short introduction to numerical algorithms
  • Random number generation and simple simulations
  • Optimization
  • Finding and installing R packages
  • How to write a successful R program
  • Finding errors and improving R programs
  • Report generation in R

Learning Method / Style of Lessons

The course is organized in seven blocks of four hours. It takes part in the first half of the semester, to leave sufficient time for the programming projects. Each block introduces a new concept and employs learning-by-doing to move from theory to practice. Students start with short tutorial before each class (flipped classroom). The course block itself starts with a presentation of a new concept. Next, we study a sample R program that illustrates this concept and try to understand the underlying ideas. Students will then solve a few simple programming exercises to be submitted online by the next class.

Exam Style

50% individual programming exercises during the course phase

50% programming project in small groups, due at the end of the semester

Requested Material

Students should bring a laptop with R and Rstudio installed to all classes

Students having no experience with R, should follow this tutorial before the course starts: (free, registration required)


All slides and sample programs will be published on iCorsi.

Additional material about the R programming language

Venables et al: An introduction to R,

Additional material about the Rstudio IDE (choose “Programming part I”)

Additional resources will be discussed in the first lecture.