The APEX Big Data Analytics service (BDAaS) can ingest any dataset and rapidly scale the application of any mathematical model or equation upon that ingested dataset. This is achieved using proprietary data structures, highly optimized proprietary caching techniques and a powerful reusable microservice and graphical user interface framework.

This document describes how the APEX BDAaS was used to implement the black scholes model to generate implied volatility curves for digital assets derivatives in real-time.

If your organization would like access to this feature or has a similar need for stocks/equities derivatives or any other asset class, please feel free to book a demo via https://www.apexe3.com or contact Usman K or Robert R.

**The Business Problem**

An implied volatility curve (IVC) for option derivatives provides several benefits, including:

**Predictive Power:** It can help predict future volatility levels, as options prices reflect the market's expectation of future volatility.

**Option Pricing**: It enables accurate pricing of options, allowing traders to make informed decisions on buying or selling options.

**Strategy Development:** It provides a basis for developing volatility-based trading strategies that can profit from changes in implied volatility levels.

**Risk Management:** It allows traders to manage their risk exposure by monitoring changes in implied volatility levels and adjusting their positions accordingly.

**Arbitrage Opportunities**: It can help identify pricing discrepancies between options and underlying assets, creating potential arbitrage opportunities.

At the time of writing over $500 million of options derivatives contracts are traded daily on just one digital asset exchange, with many analysts predicting further growth.

Institutional and sophisticated investors would like to track the implied volatility curve for specific derivative option contract expiries, in real-time, to extract the benefits that were described earlier.

This is a non-trivial and computationally intensive requirement for which off the shelf solutions are not readily available.

**An Approach to Solving this Business Problem**

There are multiple ways to construct the IVC. Here is one method:

**Select an underlying asset:**Choose the asset for which you want to calculate the implied volatility curve. This could be a stock, index, commodity, or currency pair.

**Select a set of option contracts:**Choose a set of option contracts with the same underlying asset, expiration date, and strike price range.

**Collect option prices:**Collect the current market prices of the chosen options. These prices will be used to calculate implied volatilities.

**Calculate implied volatility:**Use an option pricing model, such as the Black-Scholes model, to calculate the implied volatility for each option contract.

**Plot the implied volatility curve:**Plot the implied volatility values on a graph with the strike prices as the X-axis and implied volatility as the Y-axis. This will create the implied volatility curve for the chosen expiration date.

**Repeat steps 2-5:** Repeat steps 2-5 for different expiration dates to construct the full implied volatility surface.

**The Black-Scholes model**

In step 4 we use the Black-Scholes model, which can be described as follows:

The Black-Scholes model is a mathematical formula used to price European-style options. It was developed by Fischer Black and Myron Scholes in 1973 and is widely used in finance.

The Black-Scholes model assumes that the price of the underlying asset follows a lognormal distribution, and that the option price is influenced by several factors, including the underlying asset price, the option's strike price, time to expiration, risk-free interest rate, and volatility of the underlying asset.

The Black-Scholes equation for pricing a European call option is:

C = SN(d1) - Xe^(-r*t)*N(d2)

Where:

C is the price of the call option (The subtraction can be reversed for a Put (P))

S is the current price of the underlying asset

X is the option's strike price

r is the risk-free interest rate

t is the time to expiration, expressed in years

N() is the standard normal cumulative distribution function

d1 = (ln(S/X) + (r + (σ^2/2))t) / (σsqrt(t))

d2 = d1 - σ*sqrt(t)

σ is the volatility of the underlying asset, which is the most important input to the Black-Scholes model. It represents the market's expectation of the future volatility of the underlying asset.

The Black-Scholes model can be used to price European-style call and put options, assuming that the underlying asset does not pay dividends and that there are no transaction costs or taxes.

Additionally, variations of the Black-Scholes model, such as the Black-Scholes-Merton (BSM) model, can be used to test hypotheses about the impact of various factors on option prices, such as changes in interest rates, dividends, or changes in the underlying asset's price distribution.

**Using the APEX BDAaS to Solve this Business Problem**

The BDAaS has existing ingestor microservices that can ingest market data in real-time. Your organizations real-time options derivatives feed can be easily integrated with the BDAaS.

The BDAaS will identify and classify unique options contracts based on the underlying spot market, strike price and expiration date.

A proprietary option-chain data structure (POCDS) will be used to model options chain constructs in-memory.

POCDS’s will be indexed and sharded enabling APEX stateless calculation microservices to operate on multiple options contracts and POCDS’s in parallel.

An APEX Stateless microservice will implement the Black-Scholes-Merton (BSM) model business logic as a highly optimized stateless function that accepts relevant parameters. The linear regression logic aspect can be optionally executed as a separate worker thread if the need arises.

Multiple BSM microservices will be instantiated vertically (or horizontally) to calculate the implied volatility for one or more option contracts in parallel.

The BDAaS is able to detect changes in the underlying contracts' spot price, book price or risk free rate, triggering re-calculations, in parallel.

The calculations will be used to construct POCDS’s view data structures that update in real-time.

The views data structures will be published and accessible via a BDAaS websocket gateway in real-time.

A REST endpoint will allow static querying of POCDS’s views (e.g. via jupyter notebook).

An APEX dashboard will be created using our existing GUI component framework to rapidly ingest the POCDS updates and visualize real-time implied volatility curves.

Third party algos can also access the BDAaS websocket gateway to ingest APEX POCDS’s in real-time.

Simply increase the number of calculation microservices vertically or horizontally to scale and maintain a consistent time to calculate implied volatility for POCDS’s for new options derivatives contracts.

**Making It Real**

This production grade prototype was rapidly created using the above process in less than one week.

Pricing all ingested options contracts resulted in 1,788,893 calculations in < than 15 seconds, equating to 119,259 calculations per second.

This solution was executed with one of our basic parallelisation schemes. Althought the results are impressive, the per second amount can still be substantially increased with a more our more advanced paralleisation schemes.

The following diagram highlights the components of the BDAaS that were updated, instantiated and deployed for this solution:

The following screenshot shows a graphical user interface which can be accessed via the web or modern desktop containers.

Users can view the real-time implied volatility curves aross 3 digital assets and their respective option chains.

It shows a comparison of the APEX generated Implied Volatility Curve (smile) vs that of a well known Digital Asset Options exchange (Deribit).

The delta in the calculation is likely the result of differing risk free rates used by APEX and the exchange.