Writing

Essays and commentary on software, finance, economics, and policy.

Writing results

Showing 36 pieces.

  1. The December Fed Meeting: What to Watch

    The December Fed meeting is today! Despite the worrying lack of data, the market is confident that rates will be cut by 25 bps, with the FedWatch tool giving a 87.6% chance for a…

  2. Why 50-Year Mortgages Fall Short

    Federal Housing Finance Agency director Bill Pulte recently floated a big potential change to the mortgage market: 50 year mortgages. Unfortunately, these aren’t realistic.…

  3. Why Rate Cuts Won't Fix a Labor Supply Shock

    Interest rate cuts won’t relieve a labor supply shock: with lessons from energy and housing crises. After today’s stunning job revision of −911,000 jobs for March 2025, the stock…

  4. The Case for Structured Errors in Rust

    I found this article on structured errors insightful. Although it is focused on Rust, the explanations of the direct benefits of encoding information about the failure surface of…

  5. What a U.S. Credit Rating Downgrade Means

    Moody’s has downgraded the US’s credit rating from the best (Aaa) to second-best (Aa1), sending the markets into a buzz. But what does it mean to downgrade a credit rating? All…

  6. Rust at 10: Why I've Followed the Language

    Rust turns 10! In honor of this momentous anniversary, I’d like to reflect on what Rust means to me, and why I have followed it for so long. I first heard about Rust in 2021,…

  7. Copulas and Portfolio Risk

    Ending early today because the Pacers are playing tonight Generally speaking, the Basel 2 , Basel 3, and current Basel 3.5, all these rules and regulations require that banks…

  8. Counterparty Risk-Weighted Assets

    The syllabus records “Risk Weighted Assets: Counterparty RWAs. Calculation and modeling,” taught by Juan. The personal course export contains the scheduled topic but no worked…

  9. Multi-Name Credit Risk

    This is going to be a basic introduction, this is a complex topic to cover comprehensively. The Gaussian latent-variable framework and conditional-independence construction are…

  10. Neural Networks and Credit Ratings

    This is an idea that was created in the 50s, exploded in the 90s, where it was called neural networks. A lot of development on the brain happened, so ANN was a term to…

  11. XVA and Counterparty Risk

    The syllabus records “Introduction to X-VAs: CVA/FVA,” taught by Yee Han. The personal course export has the topic and date, but no worked XVA lecture notes. The former CVA/FVA…

  12. Why Federal Reserve Independence Matters

    Trump is threatening the independence of the Federal Reserve. But why does this even matter? And what does the Fed even do? The role of central banks in the economy is a…

  13. Dependence and Copulas

    Lecture notes on minimum, independent, and maximum dependence in a one-factor credit model.

  14. Euler–Milstein and Monte Carlo Extensions

    We will expand on the variance reduction techniques, we will repeat a couple things from last week. But before we do that, we should talk about Euler Milstein or Euler Maruyama.…

  15. Vietnam and the Tariff Shock

    The biggest loser of the tariffs, the tragedy of the “miracle on the Mekong”: Vietnam 🇻🇳 When President Trump revealed the list of tariffs on “Liberation Day”, one country stood…

  16. China's Tariff Strategy and the One-Punch Proverb

    An old Chinese proverb contains the key to understanding their tariff strategy: 打得一拳开 免得百拳来 “throw out one punch now to avoid a hundred punches in the future” What does it mean?…

  17. Structured Credit and CDOs

    Last day of class is Thursday, May 8. The final exam is going to be posted then, take-home exam. It’ll be posted like an assignment. Will be posted in evening around 6:30, you’ll…

  18. Why Crashing the Economy Won't Work

    The secret plan behind crashing the economy—and why it can’t work 😴 The anticipation of and uncertainty around Trump’s tariffs have caused the stock market to plunge rapidly…

  19. Monte Carlo and Variance Reduction

    We will cover this stuff in two different lectures. Today is Monte Carlo 1. The two theorems are the basis of the entire Monte Carlo simulation. The Law of Large Numbers (LLN)

  20. Misinformation in Volatile Markets

    Misinformation becomes especially dangerous in volatile markets… 😱 After President Trump’s tariff announcement on “Liberation Day” last Wednesday, markets have roiled. The…

  21. Documentation Is the Key to Vibe Coding

    Documentation is the key to vibe coding success! The use of LLM AI code assistants (or “copilots”) like Github Copilot and Claude has exploded recently. Many non-programmers have…

  22. Rust 1.86: `get_disjoint_mut`

    Rust 1.86.0 has been released, with a very nice ergonomic feature to get around the borrow checker: get_disjoint_mut Rust’s borrow checker is the heart of its promise of memory…

  23. Credit Default Swap Valuation

    We discussed the mechanics of CDS a bit, and then started on the valuation. So let’s discuss the valuation in more details. We have two legs. The premium leg is the buyer, who…

  24. Calibration and SDE Parameter Estimation

    Parameter estimation for stochastic differential equations. investments by the West after dictator Ceaușescu failed to invade Czech republic he stopped imports and increased…

  25. CDS and Credit Markets

    The syllabus records “Introduction to Credit: Credit Default Swaps; relationship to Bonds; Credit as a traded asset class,” taught by Yee Han. The personal course export contains…

  26. The Cost of AI-Generated Images

    New AI images stun the world 🤯 but are they worth the cost? 🤔 AI images have flooded social media seemingly overnight, with the specific trend of “Ghiblization” (transforming…

  27. Hazard Rates and Credit Default Swaps

    Λ , the hazard rate, is convenient to work with. If we integrate over it, we can get the survival probability 𝑉 ( 𝑡 ) at time 𝑡 . We can also get the probability of default 𝑄 ( 𝑡…

  28. Midterm Cheat Sheet

    Handwritten midterm reference for quadrature and Black-Scholes notation; several formulas are unclear in the source render.

  29. GARCH Risk Statistics

    The syllabus records “Risk Management: GARCH — Statistics.” The personal course export contains the schedule and the workbook implementation notes for the Black–Scholes/FX…

  30. LIBOR Market Model and Hazard Rates

    The LIBOR Market Model (or Brace-Gatarek-Musiela Model ) is a model constructed in terms of the forward rates underlying caplet prices. HJM was defined as a process for the…

  31. Stochastic Volatility, Jumps, and Fourier Transforms

    Theoretical transformations, very technical How do you solve a Heston model using Fourier transforms? The very first stochastic volatility model introduced is the Hull-White model.

  32. Short-Rate Calibration and HJM

    We’ll look specifically at Vasicek and CIR. Then we will make some remarks on the Hull-White two factor model, then some more complex model. The code for this in a package in R.…

  33. American Options and Cubic Splines

    Cubic Splines, you solve something that is like a tridiagonal system Artificial Neural Network multilayer perceptron… the whole point of this is that you can exercise this at any…

  34. FX Volatility Smiles and Uncertainty

    The syllabus records “Black-Scholes shortcomings: smile effects.” The source export contains the volatility-surface helper below and explicitly labels it “Vol Surface Functions —…

  35. Hull–White Interest Rate Trees

    This will be focused on numerical methods, next week we will have more examples. What is the difference between interest rate risk and stock price risk? One of the most important…

  36. Crank–Nicolson and the Heston Model

    Don’t use AI, you won’t learn anything. And it’s not really intelligent, it just takes things from the Internet. There are two different general finite difference schemes, which…

  37. Finite-Difference Sketches

    A handwritten finite-difference sketch with A/B/C labels; surrounding equation notation is unclear in the source render.

  38. FX Discrete Hedging and Greeks

    The syllabus labels this class “Black-Scholes shortcomings: discrete hedging; volatility uncertainty.” The source workbook expresses the risk measures as functions. It does not…

  39. Constant Maturity Swaps and Short-Rate Models

    Timing and quanto adjustments, we also looked at nonstandard swaps, LIBOR for LES? Another kind of nonstandard swap is… The definition of a CMS is an interest rate swap where the…

  40. Differential Equations and PDE Methods

    Finite difference methods to approximate PDEs this week Next week we will continue this and do a little bit more complicated stuff. Homework is due right before spring break.

  41. Black–Scholes Pricing for FX

    The syllabus calls this class “Introduction to Black-Scholes. BS usage for a practitioner. First and Second order risks. Xgamma. Intuitive awareness.” The source notes are the…

  42. Interest Rate Adjustments and Currency Swaps

    We may have to make some adjustments when we value interest rate derivatives. These are convexity, timing, and quant adjustments. We will see when it is appropriate to make these…

  43. Trinomial Trees, Dividends, and Greeks

    I posted an assignment, this assignment is due this week on Sunday. Let’s just talk about the homework. This covers material from first two lectures. This lecture and previous…

  44. Bond Options, Caps, Floors, and Swaptions

    We’re going to look at bond options, caps and floors, and everything about swaptions. Depending on time, we may go forward. Basically these are instruments whose payoff is…

  45. Tree Approximation and American Options

    We’re not going to use the arbitrage method, we are going to use the forest methods. You all understand the stochastic process. Fundamentally, it starts from a point 𝑆 0 , and…

  46. FX Parity and Forward Trading

    The syllabus records this class as “Stochastic Processes — Intro to FX: FX parity; Spot and Forward trading; FX conventions.” The source document does not contain a prose…

  47. Yield Curves and Bootstrapping

    We started to look at interest rates. In the first part we’re going to discuss various interpolation methods, functions that are useful for modeling the yield curve. That’s…

  48. Black–Scholes, Calibration, and Implied Volatility

    Hanlon 2 is occupied by the system administrator, Zheng Xing. He will move his class so that we can occupy there. They will need to remote desktop into the lab. I should have…

  49. Bond Pricing, Duration, and DV01

    Take-home exam format, 24/48 hours, lots of writing code, during finals week. If a company wants money, it has options. It can issue stock, get a bank loan, or issue a bond. What…

  50. The Cost of Transit Delays

    As a frequent user of public transit, I know how impactful delays are both on my productivity and my mental health. Being stuck in Secaucus Junction because of some nonsense…

  51. Stochastic Processes and Computational Pricing

    I’m out on vacation this week, so I watched the recording A stochastic processes is merely a collection of indexed random variables. The indexing of these variables confers a…

  52. Rust 1.84: Three Infrastructure Changes

    A new version of the Rust language has been released: Rust 1.84.0! Although there aren’t any new language features, this release kickstarts three big infrastructure improvements…

  53. Exotic Options

    This is the last lecture we have for this class. Next week will be a review session. Exam will be online . December 21, We’re going to be pricing exotic options. We are focusing…

  54. Options and Volatility

    The straddle strategy is owning a call and put option with the same characteristics. If I end up long a call option and short a put, it ends up being a forward contract. I can…

  55. Default Fields in Rust Structs

    A recent RFC (request for comment) for the Rust language has divided the community: default fields in structs. In order to implement a default version of a struct in Rust, one…

  56. Hedging Bonds

    Notes added to lab 4 and discussion which delves into the analytic part establishing the connection between the two. Futures are less flexible because they are standardized, and…

  57. Rust 1.83 Brings More `const`

    A happy Thanksgiving to all! Today, in addition to my loved ones, I’m grateful for a brand-new version of Rust, now with more const ! const evaluation is one of the most…

  58. Poisson Processes

    in-class final will be decided by Thanksgiving All of the stuff we learned about stochastic calculus has been organized around the Ito process, which is continuous. We’re going…

  59. Linear Hedging

    Let’s say I’m trading futures. What is the log return of this? The futures contract at time 1 is worth 𝑆 0 𝑒 𝑟 , then at time 2 is 𝑆 0 𝑒 2 𝑟 , etc. If you look at log returns,…

  60. Stochastic Differential Equations

    Came late because my brother couldn’t get up 🙁 where 𝛽 is the drift and 𝛾 is the diffusion. Diffeqs always need a boundary condition, given by

  61. Multidimensional Market Models

    The Girsanov states that The norm of a process is the Euclidean Norm: ∥ Θ ( 𝑡 ) ∥ = ∑ 𝑗 = 1 𝑑 Θ 𝑗 2 ( 𝑡 ) And so the square of the norm is just that.

  62. Risk-Neutral Valuation and Interest Rate Parity

    We’re going to continue derivatives, uninteresting because I’m taking 620. Then we will start linear risk, more interesting. A financial engineer is someone who doesn’t know…

  63. Joint and Conditional Distributions

    Keep in mind that you can’t separate 𝜖 out from 𝑌 because they are not necessarily independent. We can use the fact that 𝜖 is complementary to divide up what 𝑋 means. But notice…

  64. Forward Contracts

    On problem 2, either you optimize for risk-free or risky assets. The question becomes unconstrained optimization. Either we have the same thing as Exam 1, released on 13 or 19?…

  65. Risk-Neutral Measures

    Let’s go into the world of sports gambling. Hypothetically, we’re going to have two teams competing, Team A and Team B. Objectively, Team A is the better team. Let’s say in the…

  66. Random Vectors and Independence

    Beginning chapter 7, vectors of random variables. We are concerned with a random vector The cdf of this vector is We can also say that if we have a random vector (X, Y) then

  67. Derivatives and Clearinghouses

    The Treynor ratio is intended to capture systematic risk, but doesn’t tell you anything about portfolio returns. Sharpe ratio doesn’t tell you anything about systematic risk. R^2…

  68. Stochastic Calculus Review

    Recognize that this is some function that looks like 𝑓 ( 𝑎 , 𝑏 ) , like where 𝑎 is a deterministic component and 𝑏 is a stochastic component. Then solve your partials

  69. Student's t and Heavy-Tailed Distributions

    Definition 5.4.6 says that the pdf is then X is a Student t-distribution with degrees of freedom 𝑡 𝑛 . Proposition 5.48 will tell us all the moments, which are not easy to prove.

  70. Interest Rate Risk and Duration

    The Economic Value of Mean Squared Error: Evidence from Portfolio Selection What’s the intuition? Everyone talks about optimization, rational agents doing the best they can. A…

  71. Multidimensional Itô Calculus

    We’re going to be talking about multivariable stochastic calculus. All of this material is fair game for the midterm. Next week is the midterm review session. Bring questions!…

  72. Gamma, Beta, and Chi-Squared Distributions

    Definition 5.36 says that X is a Chi squared distribution whose pdf is described by This is actually linked to the gamma distribution There is also a remark which says that the…

  73. Black–Scholes

    We will either lend or borrow from a bank at interest rate r. In that scenario, the amount of wealth that i have at maturity time T. My wealth would be the value of my shares and…

  74. Probability and Regression Review

    We can actually do this from a portfolio perspective, it’s the same idea. We have some weight What’s the variance? 𝕍 [ 𝑍 ] = 𝑤 1 𝜎 1 2 + 𝑤 2 2 𝜎 2 2 + 2 𝑤 1 𝑤 2 𝜎 12 It’s the…

  75. Continuous Random Variables and Transformations

    Recall for a discrete random variable. The moment formula is The moment for a continuous rv is the integral All the possibilities are the real line here.

  76. Bonds and the Time Value of Money

    We started with the foundation, risk-reward trade offs, portfolios. Then we moved to quantitative analysis on individual assets. Mostly we have focused on a single game, a single…

  77. Itô Calculus

    This is seemingly one of the simplest integrals you could do. If we’re going to do this integral, how we’re going to do that is to create a process Δ 𝑛 ( 𝑢 ) → 𝑊 ( 𝑢 ) that…

  78. Stochastic Integrals

    We left off last week talking about first passage time. We said that the cdf was Last thing before Stochastic Calculus we should talk about maximum to date . This will be…

  79. Brownian Motion

    The most important properties of Brownian motion are that it is a martingale (the expected value of the process is 0) and it accumulates quadratic variation at a rate of one per…

  80. Brownian Motion and Geometric Growth

    Under market efficiency, financial prices should exhibit a random walk. Eugene Fama is the big guy behind market efficiency. He was interviewed by the Financial Times ( Open…

  81. Discrete Distributions and Moments

    We will be covering discrete random variables this week. A discrete random variable is one whose image 𝑋 ( Ω ) is a finite/countable subset of ℝ . First thing we introduce is the…

  82. Martingales and Random Walks

    (continuing from last time) A stochastic process is a collection of random variables indexed by time. If you start out at time 0 and each time you pick heads you go one step,…

  83. Monte Carlo Risk Simulation

    50 bps cut! Markets exploded today. Information gets priced in a nonlinear way Today’s topic will be a little independent of what we’ve done, so it will be more into the…

  84. Random Variables and CDFs

    We can consider a mapping between all of the sets in the 𝜎 -algebra of one measurable space ( Ω , ℱ︀ ) to another sample space Ω 1 , where the mapping is measurable each set has…

  85. Probability Spaces and Filtrations

    Let’s define an infinite probability space Ω ∞ . This sample space is uncountably infinite, which means that the probability of any particular outcome is zero. Therefore, in…

  86. Risk-Adjusted Performance

    Let’s say we want to invest in long-term U.S. government bonds. The monthly average return of this is 0.47%, half of the equity market, and 2.3% standard deviation, less than…

  87. Probability Measures and Bayes' Rule

    We have already considered the measurable space ( Ω , ℱ︀ ) of the sample space and 𝜎 -algebra. We can now define the probability measure ℙ as a measure defined on events in the 𝜎…

  88. Risk Measurement and Portfolio Construction

    Financial risk management involves identifying, assessing, measuring, and managing financial risks. Some risks are measurable, others are not. Risk cannot always be avoided, but…

  89. Probability Spaces

    The purpose of probability is to obtain answers about real-life phenomena which do not have a predetermined outcome. We need a mathematical model to describe this so that we can…

  90. Floating Point Architecture

    Floating point numbers are complicated enough in the abstract. How do systems programmers and hardware designers cope with the complexity of floating point? In the general…

  91. IEEE-754

    IEEE-754 is the standard for floating point computation around the world. Thus, any real-world discussion of floating point must include it. IEEE-754 floating point numbers are…

  92. Floating Point

    Floating point representation is a complex topic full of nuance. To understand it, we must focus on the abstract method used to represent non-integer numbers. Math is infinite.…

  93. Network Security

    The internet has taken over the world, but with it have come malicious actors. People want to spy on you, scam you, steal from you, or harm you through the internet. Through…

  94. A Crash Course in Python

    Python is a powerful jack-of-all-trades language that is much less limited than OCaml. Arithmetic works in a very simple and clear way in Python, basically like a calculator. 2 #…

  95. Disks

    Persistent storage is essential to every system that we can think of, and we can hardly think of a computer without it. However, managing disks is not as simple as it might…

  96. Particles

    Tiny particles are affected in different ways than we are by waves. There are several different effects that must be discussed. Many people believe that Albert Einstein won the…

  97. Multimedia Networking

    Streaming multimedia is a relatively new concept in internet technology, but now has become central to the daily media consumption of people around the world. In contrast to the…

  98. Control in Prolog

    Conditional statements are very powerful and are in used in almost every language. How does Prolog implement the same idea? The basic idea behind a control statement is that…

  99. Special Relativity

    Albert Einstein revolutionized the world of physics when he discovered the special theory of relativity. It is only possible due to his contributions that valuable technologies…

  100. Waves

    Light is curious because it is both a particle and a wave, which makes it behave strangely in certain contexts. When projected through a slit, some strange fringes will appear,…

  101. The Link Layer

    Through all the layers of the internet, the most essential is the link layer : converting bits to and from signals, detecting errors, flow control, and addressing. We have spoken…

  102. Prolog

    Prolog is a special programming language that is not like many others. It exemplifies the paradigm of logic programming . Functional programming is based on the idea that all…

  103. Threads

    Concurrency is a powerful tool to increase performance in applications. This is usually accomplished using threads. Clock frequency in CPUs has massively increased over the past…

  104. Routing Algorithms

    When a host needs to find the best destination/prefix to another host, what routing algorithm does it use? We can use either intra or inter domain. As you may recall, the routing…

  105. Swapping

    Sometimes we don’t have a lot of memory to access. In those cases, we need a place to put our data. The natural solution is to put data in the disk, which has very high storage.…

  106. Routers

    Everyone nowadays gets the Internet through the router in their home. But what is a router? It’s likely that you have an internet speed in the tens of Mbps. This unit is megabits…

  107. Mirrors

    Mirrors can interact with light in interesting ways. In fact, reflection and refraction are probably most people’s engagement with laws of physics surrounding light in their…

  108. Lambda Calculus

    When we discuss the principles of programming languages, lambda calculus is the bedrock of our discussion. It is the most abstract, formal way to describe functions and…

  109. More Internet Protocols

    Besides the primary Internet protocols, there are some others to learn about, like DHCP , NAT , IPv6 , etc. What happens if a device doesn’t have a permanent IP address? You take…

  110. Electromagnetic Waves

    We have discussed electric fields and magnetic fields, and the way that they change and interact. The full interaction of these fields will create electromagnetic waves , the…

  111. ISP Addressing

    How does an ISP assign IP addresses to its customers? An ISP has a block of addresses that are partitioned to its customers. If an ISP network has an address like 200.8.4/24…

  112. Currying Arguments in a Function

    Currying is the concept of having multiple arguments in a function. OCaml defaults to currying its functions. int -> int -> int is a function that takes two int s and returns an…

  113. HTTP Explained

    HTTP is probably the most visible Internet protocol to end users. It appears (as well as its cousin, HTTPS ) at the beginning of every URL we use to access the internet. But how…

  114. Paging

    The main problem that segments have introduced to managing memory space is that their variable size wastes memory through fragmentation. Fixed-size pieces that are easier to…

  115. TCP Explained

    TCP is the well-known protocol for reliable transfer of data. But how does it actually work? System of handshakes ensures reliable transmission of data. What happens if a packet…

  116. Electromagnetic Induction

    The final piece to the puzzle of electromagnetism here is electromagnetic induction , where we use magnets to create current. Like with charges in a magnetic field, magnets do…

  117. Data Types in OCaml

    When we make our programs more and more complex, we need more complex data types as well. We have only used OCaml’s built-in data types, how can we construct our own data types?…

  118. Operational Semantics

    What are the formal semantics of how a programming language works, mathematically? That’s a broad topic. Operational semantics , which are how programs execute , are narrow…

  119. Tail Recursion in OCaml

    Recursion in many languages can cause significant overhead. It might seem that the excess amount of recursion in OCaml would decrease its performance. But it actually doesn’t,…

  120. UDP Explained

    The simplest transport protocol that is used communicate between sockets is known as UDP , the User Datagram Protocol . Let’s say we want to design the simplest transport…

  121. Magnets

    The question of how magnets work has long puzzled many . We will endeavor to answer all of those questions today. Magnets work similarly to electric charges where like poles…

  122. SMTP Explained

    Email is the most popular way in the world to send large messages. This is a complicated process which requires its own protocol: SMTP . The Simple Mail Transfer Protocol is how…

  123. Higher Order Functions in OCaml

    We can do a lot of cool things with functions besides calling them in OCaml. Values are a subset of expressions, as previously stated. All expressions can evaluate to values, but…

  124. FTP Explained

    Before we had Google Drive, users needed a way to access files from other people quickly and easily. The method for that was FTP . The point of the File Transfer Protocol , was,…

  125. Memory Virtualization

    Accessing physical memory can cause big issues if we do it directly. How can we virtualize the memory like the CPU so we can use it efficiently and safely? Let’s think of a super…

  126. Lets, Tuples, and Records in OCaml

    Lists are the most basic data structure in OCaml, but there are others that we need to be aware of. We have seen the keyword let used to define expressions and store values.…

  127. Circuits

    Circuits are the method by which all electricity travels throughout the world and power every single device in existence. It is therefore crucial to understand them while…

  128. DNS Explained

    We need protocols to define the way that messages are interpreted. Messages are different based on what kind of information you are sending. For example, HTTP (HyperText…

  129. Packet Switching vs Message Switching

    How do we get the best performance in sending information over the internet? What is packet switching and how can it help? Performance is bottlenecked by propagation delay and…

  130. Scheduling

    The way that the operating system decides which processes to run and when is a complicated process known as scheduling . This is how it works. We should understand a few…

  131. Lists in OCaml

    Lists are the most basic data structure in OCaml. The most analogous structure is a vector in C++ or Rust. Lists are homogeneous and of arbitrary length . The most basic list is…

  132. Electric Potential

    Besides electrical charge and field, there’s another force that is relevant to electricity: electric potential . Gravity is similar to the electrostatic force, apart from the…

  133. Functions in OCaml

    A function takes arguments, performs operations using them, and returns a value. In OCaml, we can write functions like so let rec fact n = (* the function is named fact and its…

  134. Electrostatics

    What is electricity, and how does it work? Fundamentally, the negative charge comes from the electron , a subatomic particle. The positive charge comes from protons , also in the…

  135. CPU Virtualization

    We need a way to map on to the physical CPU through our operating system. We do this through virtualization. A process is an execution stream in the context of a process state.…

Study archive