About US

How to Integrate Third Party Pricing Libraries with Beacon Front Office Suite

By Claus Murmann and Tony Yum

Beacon Front Office Suite includes reference implementations of pricing models such as Black-Scholes, Ju and Zhong American option approximation, and binary trees. That said, some customers prefer to use their own pricing library and/or use Beacon’s reference implementation to validate the outputs from other systems, which tend to be “black box” implementations. Beacon’s open architecture makes it easy to integrate third-party models and pricing libraries written in a variety of other languages aside from Python, such as C++, C#, R, Rust, and M (MATLAB).

An example in C++

There are many ways to integrate third-party libraries with Front Office Suite. In this example, we use the ctypes library to make use of a Black-Scholes pricer written in C++, and QuantLib’s Simplified Wrapper and Interface Generator (SWIG) for a C++ binomial pricer. We then make use of these pricers in the Beacon IDE.

To pass inputs to the C++ pricers, we need to implement a class that extends Beacon’s standard FuturesOptionPricer and override the method called PremiumPrice. Within this node we use the Black-Scholes pricer for pricing European options, and the Binomial pricer for pricing American options. Using the library from within the Beacon IDE shows a price using each of the three models: Beacon, Black-Scholes, and a 170-step binomial tree.

For the demo, we used a default crude oil option contract, and this is what we see in the output screen:

Beacon: 4765.499950004733

C++ Pricer (European exercise): 4762.913427370567

C++ Pricer (American exercise): 4759.863160195619

An example Glint app

Now, let’s wrap this up in a simple app using Glint, Beacon’s SDK for building apps. The app allows the user to select a commodity contract, and compare the outputs from the different pricing libraries. Because the app sits on top of Beacon’s dynamic data architecture, changing any parameter, such as the contract month will instantly reprice the option. We also include a simple plot that allows the user to visualize the outputs.

Figure 1: App which allows users ability to compare pricing models

Adding support for C# via containers

Beacon uses a layered container architecture. Adding support for another language just requires launching Beacon IDE with the relevant Docker image. For example, if you’re using a C# pricing library you would need to launch with the Microsoft .NET image. You can even compile the library directly into your Python script if desired.

Integrating is easy with Beacon

Integrating additional pricing modules into Beacon Front Office suite is as simple as extending the default Pricer method to call the pricing library of your choice. Since Beacon comes with broad support for different languages and interfaces, these pricing libraries can be written in almost any popular language; there is no need to rewrite existing code.

You can have a look at our video to see this in action, or contact us to learn more. You can also install Beacon Lab from the Beacon App Store and take a look at the code in beacon-lab/beacon/lab/apps/pricer_demos.