Tidy Finance
  • Chapters
  • Blog
  • Support

★ Open-source · R & Python · Reproducible

Empirical finance, reproducible in R and Python

Tidy Finance takes an opinionated, fully transparent approach to empirical research in financial economics. One open-source code base now covers R and Python, side by side in every chapter.

Start here Python Library R Package

download & plot prices
  • R
  • Python
library(tidyfinance)
library(ggplot2)

prices <- download_data(
  domain = "Stock Prices",
  symbols = "AAPL",
  start_date = "2000-01-01",
  end_date = "2024-12-31"
)

prices |>
  ggplot(aes(date, adjusted_close)) +
  geom_line()
import tidyfinance as tf
from plotnine import ggplot, aes, geom_line

prices = tf.download_data(
  domain="Stock Prices",
  symbols="AAPL",
  start_date="2000-01-01",
  end_date="2024-12-31"
)

(ggplot(prices, aes("date", "adjusted_close"))
  + geom_line())

20+ Hands-on chapters

2 Languages, one code base

100% Open source & reproducible

Everything you need for reproducible research in finance

A single, transparent code base takes you from raw data to publication-quality results, in R and Python.

One code base, two languages

Every chapter ships R and Python side by side from a single source. Switch with a tab. Your choice follows you through the book.

Fully transparent & reproducible

Open code you can run end to end, from raw data to every figure and table, with no black boxes.

Powered by tidyfinance

A companion package for R and Python that wraps data downloads and the routines we use throughout the book.

Real financial data

Work with the data professionals use, like CRSP, Compustat, and TRACE, through clean, documented access patterns.

From sorts to machine learning

Portfolio sorts, factor models, fixed effects, causal inference, and modern ML give you the full empirical toolkit.

A free, open book

Read the whole book online for free or dive into the blog all in the open.

Browse the book by topic

Five parts take you from your first stock return to constrained portfolio backtests.

PART 01

Getting Started

Stock returns, modern portfolio theory, the CAPM, and financial statement analysis.

Start here →
PART 02

Financial Data

Access and manage WRDS, CRSP, Compustat, TRACE, and FISD with documented workflows.

Explore data →
PART 03

Asset Pricing

Beta estimation, univariate and bivariate sorts, Fama-French factors, and Fama-MacBeth.

Price assets →
PART 04

Modeling & Machine Learning

Fixed effects, difference-in-differences, factor selection, and option pricing via ML.

Model it →
PART 05

Portfolio Optimization

Parametric portfolio policies and constrained optimization with realistic backtesting.

Optimize →

Praise

What experts say about Tidy Finance

A portrait of Harald Lohre

A clean coding environment is a prerequisite for building a relevant investment platform and conducting meaningful factor research. Tidy Finance is the name of the game, giving aspiring academics and finance practitioners just what they need to perform clean and reproducible research. Highly recommended.

Harald Lohre

Executive Director at Robeco

Honorary Researcher at Lancaster University Management School

A portrait of Albert J. Menkveld

From our crowd-sourced paper on non-standard errors, I learned how important clean coding is. Tidy Finance is a rich resource for empirical finance researchers, offering clean coding techniques that benefit both beginners and experts.

Albert J. Menkveld

Professor of Finance at Vrije Universiteit Amsterdam

Fellow at Tinbergen Institute

A portrait of Nikolaus Hautsch

A fantastic book bringing together financial theory, sound econometrics, thorough data processing and powerful programming techniques. An absolute must for every student and scholar in empirical finance.

Nikolaus Hautsch

Professor of Finance & Statistics at University of Vienna

A portrait of Björn Hagströmer

Tidy Finance is a fantastic resource that lowers the threshold for entry into empirical finance, all in the spirit of open and reproducible science.

Björn Hagströmer

Professor of Finance at Stockholm Business School

A portrait of Raman Uppal

To have a deep understanding of empirical asset pricing, one needs to write code using actual data. To learn how to do this, there is no better starting point than Tidy Finance. [...] I strongly recommend Tidy Finance to both beginners and experts.

Raman Uppal

Professor of Finance at EDHEC Business School

A portrait of Mark Salmon

Students and professionals alike are led step by step until they suddenly find themselves coding on their own. A brilliant and required resource!

Mark Salmon

Professor of Economics at University of Cambridge

The team

Who maintains Tidy Finance

A portrait of Christoph Scheuch

Christoph Scheuch

Associate Researcher at HU Berlin

LinkedIn →
A portrait of Stefan Voigt

Stefan Voigt

Assistant Professor of Finance at University of Copenhagen

Website →
A portrait of Patrick Weiss

Patrick Weiss

Assistant Professor of Finance at Reykjavik University

Website →
A portrait of Christoph Frey

Christoph Frey

Quantitative Researcher

Website →
© Christoph Frey, Christoph Scheuch, Stefan Voigt & Patrick Weiss
Disclaimer Cookie Preferences
 
  • View source