This repository includes F1-optimized implementations of four Monte Carlo financial models, namely:
Further details can be found in the following paper. If you find this work useful for your research, please consider citing:
@INPROCEEDINGS{7920245,
author={L. Ma and F. B. Muslim and L. Lavagno},
booktitle={2016 European Modelling Symposium (EMS)},
title={High Performance and Low Power Monte Carlo Methods to Option Pricing Models via High Level Design and Synthesis},
year={2016},
pages={157-162},
doi={10.1109/EMS.2016.036},
month={Nov},
}
Or
@ARTICLE{7859319,
author={F. B. Muslim and L. Ma and M. Roozmeh and L. Lavagno},
journal={IEEE Access},
title={Efficient FPGA Implementation of OpenCL High-Performance Computing Applications via High-Level Synthesis},
year={2017},
volume={5},
pages={2747-2762},
doi={10.1109/ACCESS.2017.2671881},
}
The Black-Scholes model, which was first published by Fischer Black and Myron Scholes in 1973, is a well known basic mathematical model describing the behaviour of investment instruments in financial markets. This model focuses on comparing the Return On Investment for one risky asset, whose price is subject to geometric Brownian motion and one riskless asset with a fixed interest rate.
The geometric Brownian behaviour of the price of the risky asset is described by this stochastic differential equation: where S is the price of the risky asset (usually called stock price), r is the fixed interest rate of the riskless asset, is the volatility of the stock and is a Wiener process.
According to Ito's Lemma, the analytical solution of this stochastic differential equation is as follows: where , (the standard normal distribution).
Entering more specifically into the financial sector operations, two styles of stock transaction options are considered in this implementation of the Black-Scholes model, namely the European vanilla option and Asian option (which is one of the exotic options). Call options and put options are defined reciprocally. Given the basic parameters for an option, namely expiration date and strike price, the call/put payoff price could be estimated as follows. For the European vanilla option, we have: where S is the stock price at the expiration date (estimated by the model above) and K is the strike price. For the Asian option, we have: where T is the time period (between now and the option expiration date) , S is the stock price at the expiration date, and K is the strike price.
The Heston model, which was first published by Steven Heston in 1993, is a more sophisticated mathematical model describing the behaviour of investment instruments in financial markets. This model focuses on comparing the Return On Investment for one risky asset, whose price and volatility are subject to geometric Brownian motion and one riskless asset with a fixed interest rate.
Two styles of stock transaction options are considered in this implementation of the Heston model, namely the European vanilla option and European barrier option (which is one of the exotic options). Call options and put options are defined reciprocally. Given the basic parameters for an option, namely expiration date and strike price, the call/put payoff price can be estimated as discussed in this article.
In any directory such as
> cd FinancialModels_AmazonF1/blackScholes_model/europeanOption/
> make TARGETS=hw PLATFORM=$PLATFORM all
See repo https://github.com/aws/aws-fpga/tree/master/SDAccel
Examples of usage for the European and Asian options by BlackSchole model:
> blackeuro -b <binary_file_name> [-n number_of_repeat] [-s number_of_simulation] [-k number_of_time_partition] [-c expect_call_price] [-p expect_put_price]
> blackasian -b <binary_file_name> [-n number_of_repeat] [-s number_of_simulation] [-k number_of_time_partition] [-c expect_call_price] [-p expect_put_price]
The outputs of both commands are the expected call and put prices. The -b <binary_file_name>
option can be used to specify a binary file name different from the default <kernel_name>.hw.xilinx_xil-accel-rd-ku115_4ddr-xpr.awsxclbin
The model parameters are specified in a file called blackEuro.parameters
and blackAsian.parameters
respectively. The meaning of the parameters is as follows.
Parameter | Meaning |
---|---|
time | time period |
rate | interest rate of riskless asset |
volatility | volatility of the risky asset |
initprice | initial price of the stock |
strikeprice | strike price for the option |
Parameter | Meaning |
---|---|
time | time period |
rate | interest rate of riskless asset |
volatility | volatility of the risky asset |
initprice | initial price of the stock |
strikeprice | strike price for the option |
theta | long run average price volatility |
kappa | rate at which the volatility reverts to theta |
xi | volatility of the volatility |
rho | covariance |
upb | upper bound on price |
lowb | lower bound on price |
Target frequency is 250MHz. Target device is 'xcvu9p-flgb2104-2-i'
Model | Option | N. threads | N. simulations | N. simulation groups | N. steps | Time C5 96-core CPU [ms] | Time F1 FPGA [ms] | LUT | LUTMem | REG | BRAM | DSP |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Black-Scholes | European option | 64 | 65536 | 32 | 1024 | 23.75 | 2.84 | 66% | 7% | 38% | 23% | 71% |
Black-Scholes | Asian option | 64 | 65536 | 32 | 1024 | 25 | 2.81 | 70% | 8% | 42% | 31% | 80% |
Heston | European option | 52 | 65536 | 64 | 1024 | 56.67 | 7.2 | 62% | 8% | 37% | 20% | 77% |
Heston | European barrier option | 52 | 65536 | 64 | 1024 | 36.25 | 6.4 | 63% | 9% | 39% | 20% | 77% |