COMPUTATIONAL FINANCE

COMPUTATIONAL FINANCE

Nicola Borri

Instructional goals

Python is the core language for finance applications—and not only finance applications—thanks to its versatility and extensive ecosystem. The objective of this course is to develop computational financial applications using Python. Our focus is primarily on practical implementation rather than theory, and the course adopts a strong hands-on approach to ensure you gain real-world skills in financial programming. With the development of AI and vibe coding, the approach has shifted to master the use of AI tools functional to the construction of Python applications.

Intended learning outcomes

Students will explore cutting-edge asset pricing models while developing a deep understanding of the risk-return tradeoff. The course emphasizes real-world applications, with all projects and analyses implemented using Python to turn theory into actionable insights.

Course Contents

The course will provide a crash introduction to finance and investment, covering topics like the historical behavior of financial series, time-value of money, portfolio optimization and measures of risk. The focus of the course is on data and students will learn how to answer the following questions: where can I find financial data? What do financial time-series look like? How can I easily import and manipulate data in a software package? How to build an optimal financial portfolio? How to measure portfolio risk? How to measure asset liquidity? Details: - Python Fundamentals for Finance Build proficiency in Python, focusing on core programming concepts and best practices. Gain hands-on experience with key libraries such as NumPy, pandas, and matplotlib for data handling, analysis, and visualization. - Financial Data Acquisition & Management Learn techniques for importing, cleaning, and preprocessing financial datasets. Address challenges specific to financial time series, ensuring accuracy and consistency in data analysis. - Portfolio Construction and Optimization Understand and apply modern portfolio theory, including risk-return trade-offs and the efficient frontier. Implement portfolio optimization models (e.g., mean-variance optimization and risk budgeting) using Python, considering practical constraints like transaction costs and liquidity. - Performance Measurement and Risk Analysis Analyze key performance metrics (e.g., Sharpe ratio, Sortino ratio, alpha, beta) to evaluate investment outcomes. Calculate and interpret risk measures such as Value at Risk (VaR), Conditional VaR, and maximum drawdown. Develop back-testing strategies to assess model performance and robustness. - Estimation of Factor Models Explore multi-factor models (e.g., Fama-French, Carhart) to explain asset returns. Use regression analysis in Python to estimate factor exposures and statistically validate model assumptions. - Development of Systematic Trading Strategies Create and refine systematic trading strategies through hands-on projects and algorithmic trading frameworks. Integrate quantitative analysis with risk management techniques to build adaptable, real-world financial strategies.

Reference Books

I will distribute material for this class in the form of slides, notes, Python notebooks and code. I will use the my.luiss page for this classroom to distribute any relevant material. Additional (non-required) references are: 1) For general topics in finance: Bodie, Kane and Marcus, Essential of Investments, McGraw Hill (latest edition). 2) For financial applications in Python: Yves Hilpisch, Python for Finance (latest edition). Note that Luiss subscribes to the O’Reilly Learning, where you can find online versions of Yves Hilpisch, Python for Finance, as well as several useful resources. Further useful references are: Tidy Finance with Python (free website: https://www.tidy-finance.org/python/index.html), which also exists in the form of textbook; QuantEcon (open source code for economic and finance modeling: https://quantecon.org). More advanced references: Hastie, Tibshirani, Friedman, The Elements of Statistical Learning L Data Mining, Inference, and Prediction (Springer) and James, Witten, Hastie, Tibshirani, Taylor, An Introduction to Statistical Learning: With Applications in Python (Springer). Note that the last two references are fundamental for those of you who plan a career in machine learning (with or without finance applications).

Teaching Methods

- traditional lecture 40% - team works 30% - learning by doing 30%

Assessment Method

For students taking the exam before the summer in one of the two examination dates. - take-home group assignment 40% - in class individual assignment 20% - final exam 40% For the take-home group assignment, students should form their own groups with 5 students each. For students taking the exam after the summer, a second time, or that do not want to follow the above assessment criteria, the evaluation is based 100% on the final in-class exam. Note: The final exams and individual assignments require using Python to complete some tasks. Students will be asked to bring their own laptop to class the day of the examination.

Thesis assignment criteria

The criteria established by the Director of the LM in Finance as well as those stated by the Department of Economics and Finance.

Week 1

Introduction and stylized facts, Bloomberg tour

Week 2

Introduction to pandas matplotlib

Week 3

Introduction to pandas matplotlib

Week 4

Portfolio theory: a crash course

Week 5

Building a portfolio using Python

Week 6

Backtesting and out-of-sample analysis

Week 7

Factor models: a crash course

Week 8

Estimating factor models: Fama-MacBeth procedure

Week 9

Estimating factor models: Fama-MacBeth procedure

Week 10

Factor models and investment strategies

Week 11

Reverse engineering of investment strategies using a factor model: the case of Warren Buffet

Week 12

Reverse engineering of investment strategies using a factor model: the case of Warren Buffet: a Python Application