Functional Programming in Financial Markets by Damián Soriano

September 13, 2023

In the Functional Programming in Financial Markets presentation by Damián Soriano, he discusses the application of functional programming in financial markets, focusing on the complexity of pricing financial contracts accurately, the role of quantitative analysts in determining fair prices and assessing risk exposures, and the development and usage of the programming language Mu at Standard Charter for financial modeling and pricing. The presentation delves into Cortex, a pricing library in the financial market, its functionalities for intraday recalculation and testing, and its benefits and challenges compared to Haskell. Additionally, Damián highlights the use of functional programming in GUI applications for traders and tools like Shepard and QuickRisk for managing workflows and computational tasks efficiently. Lastly, Damián addresses queries on Simon Peyton Jones’ influence, memory efficiency concerns, and the recruitment of Haskell developers at Standard Chartered Bank.

Functional Programming in Financial Markets: A comprehensive overview

Understanding Financial Markets

Damián Soriano begins by setting the stage with a fundamental explanation of financial markets, emphasizing the exchange of complex financial contracts. These contracts require precise pricing, a task managed by quantitative analysts using sophisticated mathematical models. The models not only determine the fair value of these contracts but also assess future risk exposures, providing a competitive edge to financial institutions.


The role of Functional Programming

Functional programming has a significant role in finance due to its ability to handle complex computations and mathematical models efficiently. At Standard Chartered, the journey began with spreadsheets, which can be seen as functional programs. Over time, the need for a robust system led to the development of Lambda and later Mu, a language combining the strengths of Haskell with compatibility to their existing ecosystem.


Cortex: The backbone of financial calculations

Cortex, a comprehensive pricing library, stands at the core of Standard Chartered’s financial computations. It supports various programming interfaces, including C++, .NET, Java, and Excel. Damián highlights Cortex’s capability to handle intraday recalculations and testing, demonstrating how it connects to external services, fetches trades, computes risk sensitivities, and delivers results.


Functional Programming languages in use

Damián discusses the use of Mu and its evolution from Haskell. While Mu shares similarities with Haskell, it incorporates optimizations like strict runtime and native C++ integration, crucial for financial applications. This choice ensures efficient processing and integration with existing systems, albeit with longer compilation times due to the need for whole program compilation.


GUI and workflow management

The presentation delves into building GUI applications for traders using Windows Presentation Foundation (WPF) and functional widget libraries. Damián provides examples of simple applications, illustrating the separation of UI and business logic for clarity and maintenance.


Advanced computational tools: QuickRisk and Shepard

QuickRisk, another tool discussed by Damián, generates workflows based on user inputs, creating dependency graphs for computations. This approach allows for efficient and scalable processing of financial data. Shepard, a workflow management system, tracks dependencies, manages tasks, and ensures efficient computation, even in the event of failures.


The team and the codebase

Standard Chartered’s financial programming team is extensive, with over 700 contributors and a codebase exceeding 6 million lines, predominantly in Haskell. This large-scale collaboration underscores the complexity and importance of their financial models and tools.


Influences and practical considerations

Damián acknowledges the influence of Simon Peyton Jones‘ work on their internal contract language, highlighting continuous evolution and adaptation. He also addresses common concerns about functional programming, such as memory consumption and efficiency, arguing that these issues are not unique to functional languages and can be managed effectively.


Recruitment and industry growth

Contrary to the belief that finding Haskell developers is challenging, Damián notes that Standard Chartered has had success in attracting and hiring skilled developers. The bank’s commitment to functional programming has not only facilitated internal growth but also attracted talent eager to work with cutting-edge technologies in finance.



Damián Soriano’s presentation provides a comprehensive overview of how functional programming, particularly Haskell and mu, is leveraged in financial markets to manage complex computations and risk assessments. The integration of advanced tools like Cortex, QuickRisk, and Shepard exemplifies the efficiency and scalability achieved through functional programming, reinforcing its pivotal role in modern financial systems.


Additional resources

Check out more from the MeetUp Func Prog Sweden. Func Prog Sweden is the community for anyone interested in functional programming. At the MeetUps the community explore different functional languages like Erlang, Elixir, Haskell, Scala, Clojure, OCaml, F# and more.