14 Creating web services for sharing data analysis results

 

This chapter covers

  • Implementing a Monte Carlo simulation
  • Using multiple threads in computations
  • Creating and running a web service in Julia

In chapter 1, we discussed a Timeline case study. Recall that the Timeline company provides a web application that helps financial advisers with retirement financial planning. This application needs to perform a lot of on-demand computations while having a fast response time. In this chapter, we will create a web service that serves a similar purpose in a simplified setting.

Imagine we are working at a company that offers its customers a service of evaluating financial assets. You are asked to create a web service that will perform pricing of an Asian option. Asian options are financial instruments whose price depends on an average price of an underlying asset (for example, a stock) over a certain period; in section 14.1, I give details of how this option is defined.

Since the Asian option is a complex financial instrument, there is no simple formula for its value. Therefore, you need to perform a Monte Carlo simulation to approximate this value. When doing a Monte Carlo simulation, we randomly sample the evolution of the underlying asset’s price multiple times. Next, for each price path, we compute the payoff of the Asian option and use the average payoff to approximate the option’s value.

14.1 Pricing financial options by using a Monte Carlo simulation

 
 
 

14.1.1 Calculating the payoff of an Asian option definition

 
 
 

14.1.2 Computing the value of an Asian option

 
 
 

14.1.3 Understanding GBM

 
 

14.1.4 Using a numerical approach to computing the Asian option value

 
 
 

14.2 Implementing the option pricing simulator

 
 
 

14.2.1 Starting Julia with multiple-thread support

 
 

14.2.2 Computing the option payoff for a single sample of stock prices

 
 

14.2.3 Computing the option value

 
 

14.3 Creating a web service serving the Asian option valuation

 
 
 

14.3.1 A general approach to building a web service

 
 
 
 

14.3.2 Creating a web service using Genie.jl

 
 

14.3.3 Running the web service

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage