Introduction

Author

Alec Loudenback

“I think one of the things that really separates us from the high primates is that we’re tool builders. I read a study that measured the efficiency of locomotion for various species on the planet. The condor used the least energy to move a kilometer. And, humans came in with a rather unimpressive showing, about a third of the way down the list. It was not too proud a showing for the crown of creation. So, that didn’t look so good. But, then somebody at Scientific American had the insight to test the efficiency of locomotion for a man on a bicycle. And, a man on a bicycle, a human on a bicycle, blew the condor away, completely off the top of the charts.

And that’s what a computer is to me. What a computer is to me is it’s the most remarkable tool that we’ve ever come up with, and it’s the equivalent of a bicycle for our minds.” - Steve Jobs (1990)

The world of financial modeling is incredibly complex and variegated. Like many sciences, financial modeling blends practical goals with computational tools to arrive at answers that (we hope) are meaningful in a way that tells us more about the world we live in. Practitioners utilize computers to do the heavy work of processing data or running simulations that reveal insights about the complex systems we seek to represent. In this way, then, financial modelers must also be craftsmen who seek not only to design new products, but must also think carefully about the tools and the process used therein.

This book helps you develop that workmanship: We will develop new ways to look at the process, think about how to most clearly represent ideas, dive into details about computer hardware, connect the low-level details with high level abstractions, and adopt a vocabulary to more clearly express and communicate these concepts. The book contains a large number of practical examples to demonstrate that the end result is superior when adopting computer science concepts.

This book addresses programming for the applied financial professional, starting with a fundamental question: “Why is this relevant for financial modeling?” The answer is simple: Financial modeling is complex, data-intensive, and often very abstract. Programming is the best tool humans have so far developed for rigorously transforming ideas and data into results. A builder may be the most skilled person in the world with a hammer, but another builder with some basic training in a richer set of tools will build a better house. This book will enhance your toolkit with a language to talk about solving problems, a deeper understanding of specific problem solving techniques, how to architecture a thoughtful solution for complex problems, and practical advice from experienced practitioners.

The Approach

The authors of the book are practicing actuaries, but we intend for the content to be applicable to nearly all practitioners in the financial industry. The discussion and examples may have an orientation towards insurance topics, but the concepts and patterns generalize to asset management, risk, treasury, and valuation.

We will pull from examples on both sides of the balance sheet: the left (assets) and right (liabilities). We may also take the liberty to, at times, abuse traditional accounting notions: a liability is just an asset with the obligor and obligee switched. When the accounting conventions are important (such as modeling a total balance sheet) we will be mindful in explaining the accounting perspective. In practice, this means that we’ll present examples of assets (fixed income, equity, derivatives) and liabilities (life insurance, annuities, long-term care) and show that similar modeling techniques can be used for both.

What You Will Learn

It is our hope that with the help of this book, you will find it more efficient to discuss aspects of modeling with colleagues, borrow problem-solving language from computer science, spot recurring structural patterns in problems that arise, and understand how best to make use of the “bicycle for your mind” in the context of financial modeling.

It is the experience of the authors that many professionals that do complex modeling as a part of their work have gotten to be very proficient in spite of not having substantive formal training on problem solving, algorithms, or model architecture. This book serves to fill that gap and provide the “missing semester” (and years of practical learning). After reading this book, we hope that you will appreciate the attributes of Microsoft Excel that made it so ubiquitous, but that you prefer to use a programming language for the ability to more naturally express the relevant abstractions which make your models simpler, faster, or more usable by others.

Even if your role does not entail hands-on coding (e.g., management or low-code tools), the ideas and language should help guide the work to a cleaner, more efficient solution.

The Journey Ahead

Learning a new topic, especially one that’s not well-trodden in a given field, can be intimidating. There are many resources available online, this book will recommend some additional resources to point you in the right direction. There is also community support available - check the chat and forums and look for the users talking about the topics that interest you. One of the wonderful things about the technology community is the degree to which content is available online for learning and reference.

Further, moving substantial parts of the financial services industry towards a digital-first, modern workflow is a monumental effort and you should seek partners on both the finance and information technology side. In general, good ideas and processes will prevail. The trick to encouraging adoption is finding the right place to plug a new idea or suggestion.

Additionally, this book provides the language and technical knowledge to partner with others (such as peers and IT) to make pragmatic decisions about the trade-offs that will need to be made.

What to Expect

This book will guide you through:

  1. Core programming concepts applied to finance
  2. Modern software development practices
  3. Computational approaches to common financial problems
  4. Real-world examples and applications

The goal is to build both theoretical understanding and practical skills you can apply immediately in your work.

Prerequisites

Basic experience with financial modeling is not strictly required, but it will benefit the reader to be familiar so that the examples will not be attempting to teach both financial math and computer science simultaneously.

Advanced financial math (e.g. stochastic calculus) is not required. Indeed, this book is not oriented to the advanced technicalities of Wall Street “quants” and is instead directed at the multitudes of financial practitioners focused on producing results that are not measured in the microseconds of high-frequency trading.

Prior programming experience is not required; see 5  Elements of Programming introduces the basic syntax and concepts while 21  Writing Julia Code covers setting up your environment to follow along. For readers with background in programming, we recommend skimming 5  Elements of Programming.

The Contents of This Book

The book is organized into eight parts, each addressing key aspects of computational thinking and financial modeling. Part I introduces foundational concepts, explaining why programming matters for financial professionals, and why Julia is particularly well-suited programming language for financial modeling applications.

Parts II, III, and IV establish the theoretical foundations—covering effective financial modeling practices, programming abstractions, and techniques for building performant models. These sections bridge theory with practical implementation, exploring topics like model design, functional programming, data types, and parallelization strategies.

Part V connects interdisciplinary concepts with practical applications, demonstrating how software engineering practices, computer science principles, statistical methods, and visualization techniques enhance financial modeling.

Since the rest of the book is intended to be generally agnostic about the choice of programming language, Part VII chapter serves to actually focus on Julia tooling and advice. It provides detailed guidance on developing in Julia, from writing and troubleshooting code to optimization. This is the section that really leans into Julia-specific ideas and workflows.

Part VIII showcases applied financial modeling techniques through real-world examples, including stochastic mortality projections, scenario generation, sensitivity analysis, and portfolio optimization.

While Julia is used for the examples throughout the book, the concepts presented are largely language-agnostic. The principles of computational thinking and financial modeling remain applicable regardless of implementation language. Readers are encouraged to follow along with the examples on their own computers. The entire book is available at https://ModernFinancialModeling.com.

A Crash-Course

This text is written with the intention to explain and show many core and related concepts that are useful for a practitioner utilizing code-based modeling and workflows. If you are looking for a crash-course in getting up to speed in order to contribute to a functional project, here is a condensed syllabus for getting the most out of this book:

A suggested short course reading list for chapters from this book.
How to Read Chapter Number Chapter Title Why
Skim and re-reference 5 Elements of Programming Programming syntax and core components provided by most languages
Read in entirety 6 Functional Abstractions Patterns of functional abstractions that are repeatedly useful in financial modeling
Read in entirety 7 Data and Types Utilizing types of data to improve efficiency and architecture of models
Read in entirety 12 Apply Software Engineering Practices Best practices for code-based workflows, including version control, testing, documentation, and code distribution.
Skim and re-reference 21-24 Developing in Julia Writing, troubleshooting, distributing, and optimizing Julia specific code. Skim lightly if using a language other than Julia; you’ll learn what kinds of tools to look for in other ecosystems.

Notes on formatting

When a concept is defined for the first time, the term will be bold. Code, or references to pieces of code, will be formatted in inline code style like 1+1 or in separate code blocks:

"This is a code block that doesn't show any results"
"This is a code block that does show output"
"This is a code block that does show output"

When we show inline commands to be sent to Pkg mode in the REPL (see Environments and Dependencies), such as add DataFrames, we will try to make it clear in the context. If using Pkg mode in standalone codeblocks, it will be presented showing the full prompt, such as:

(@v1.11) pkg> add DataFrames

There will be various callout blocks which indicate tips or warnings. These should be self-evident but we wanted to point to a particular callout which is intended to convey advice that stems from practical modeling experience of the authors:

TipFinancial Modeling Pro Tip

This box indicates a side note that’s particularly applicable to improving your financial modeling.

Colophon

The HTML and PDF versions book were rendered using Quarto and Quarto’s open source dependencies like Pandoc and LaTeX.

The HTML version of this book uses Lato for the body font and JuliaMono for the monospace font.

The PDF version of this book uses TeX Gyre Pagella for the body font and JuliaMono for the monospace font.

The cover was designed by Alec Loudenback using Affinity Designer with the graphic used with permission by GitHub user cormullion.

This book was rendered on December 1, 2025. The system used to generate the code and benchmarks was:

versioninfo()
Julia Version 1.12.2
Commit ca9b6662be4 (2025-11-20 16:25 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 14 × Apple M4 Max
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m4)
  GC: Built with stock GC
Threads: 10 default, 1 interactive, 10 GC (on 10 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_PROJECT = @.
  JULIA_LOAD_PATH = @:@stdlib