JuliaCon 2023

Introducing a financial simulation ecosystem in Julia
07-28, 11:00–11:30 (US/Eastern), 32-124

In this talk, I’ll introduce a suite of software packages built end-to-end in Julia to represent the modeling and analysis of complex financial systems. This package ecosystem leverages agent-based modeling and machine learning to produce a flexible simulation environment for studying market phenomena, generating scenarios, and building real-time trading applications.

Financial markets are composed of complex and evolving interactions that are difficult to define. Systems that exhibit these dynamics are known as complex adaptive systems (CAS). In these systems, the micro-scale behaviors of individual actors or agents (e.g., retail investors, trading firms, etc.) coalesce to generate emergent properties at the macro-scale. In financial systems, emergent properties can manifest unexpectedly and have varying consequences. One example of emergence is the price discovery process, in which the price series of an asset is determined through the individual orders submitted by various buyers and sellers. Other emergent phenomena can be irrational and deviate significantly from historical events, such as a flash crash (i.e., a sudden and extreme drop in asset value that can have lingering and widespread effects on the market).

Agent-based models (ABMs) capture critical features of complex systems—emergent properties, non-linearity, and heterogeneity. These features arise naturally due to the micro-scale interactions; that is, macroscopic properties of the system emerge without being explicitly constrained, or under any assumption, to do so. ABMs typically undergo both a calibration and validation procedure to generate realistic behavior. This entire process is facilitated by a combination of two new packages: Brokerage.jl and TradingAgents.jl.

In this talk, we calibrate an agent-based model of risky asset price dynamics and trading behavior by configuring agent-specific parameters through heuristics and machine learning (online recursive least squares). To validate the model, we run statistical tests on the simulation outputs and compare these against actual market behavior (i.e., check for the presence of empirical regularities, or “stylized facts”, through the use of empirical macroscopic data). We’ll show that our market ABM produces price and volume time series with many statistical features of actual market data, e.g., non-Gaussian returns distributions and volatility clustering. Further, we’ll demonstrate our market ABM’s ability to function across multiple assets and large agent population sizes. Taken together, this new package ecosystem presents an opportunity for researchers to model and analyze complex market phenomena in a flexible, scalable, and fully open-source environment.

PhD student @ Cornell University.