quantitative finance

Big Data, Small Data, Grid Computing, Cloud Computing, Distributed Computation vs Distributed Persistence


Hadoop (http://hadoop.apache.org) has gained a lot of popularity in recent years – and have claimed to throne in Grid Computing. There’s has been a lot of confusion what’s meant by Grid, Load Balancing, Big Data, Cloud…etc. There’re grids that’s geared towards persisting, parsing and analyzing non-relational data (Social media, web scrapping …etc) – Hadoop is one such example. There’re software vendors that cater for simple Enterprise workflow (i.e. Scheduling, Job Chaining) – BMC Control-M, Schedulix for instance. There’re also data platform that’s geared towards Numerical and Quantitative Analysis (Data in relational format)Applied Algo ETL Suite. How do we decide what’s suitable for what purpose?

What is Big Data?

We will start with this easy one – Big Data is just Big Data. Wikipedia says Big Data is simply a lot of data: Big data[1][2] is the term for a collection of 

View original post 1,451 more words


Monte Carlo – Estimate π (Pi) and Option Pricing

Here’s elaboration on John Hull’s “Options, Futures, and Other Derivatives”, chapter on “Basic Numerical Procedures”. What I’ve added is graphics to help understand the procedure.

Assume a circle fits inside a square with dimension 1 x 1. Now imagine, you’re throwing random darts at it. What are the chances it will hit inside the circle?

Monte Carlo basically is a numerical method where you randomly generate random numbers “a” and “b” a hundred times.  Each time, if sq(a) + sq(b) < sq(r), then it’s inside the circle. At the end of the hundred trials, count # hits inside circle. # hits inside circle / 100 = probability of hitting the circle = Area of Circle / Area of Square. Then, solve for π.

Detail as follows,

Estimate π using Monte Carlo 1

Estimate π using Monte Carlo 2


Estimate π using Monte Carlo 3

To do this from Excel,

A = RAND()

B = RAND()

C = sq (A-r) =(A2-0.5)^2

D = sq (B-r) = =(B2-0.5)^2

E = sq (A-r) + sq (B-r) =C2+D2

F =IF(E2<(0.5^2), 1, 0)

(i.e. If dart inside circle, F = 1, if dart outside circle, F = 0)

I2 = COUNTIF(F2:F1001, 1)


I4 = I3 x 4

Shown below Excel sheet simulation.

Estimate π using Monte Carlo 4


Monte Carlo in Option Pricing (Quantitative Finance)

There’re basically three ways you can price an option,

a. Black Sholes



  • European option/can’t exercise early
  • constant vol/rates
  • no provision for dividend, transaction fee
  • assume you can always short underlier
  • Price movement is normally distributed

Advantage? Fast


b. Lattice/Binomial Tree

Advantage? Much fewer assumptions but slow.

Disadvantage? A 20 steps non-recombining tree can contain a million nodes.


c. Monte Carlo

Monte Carlo simulation is also used in pricing options where option price is dependent on price history of underlying asset (for example, look-back or Asian options – i.e. Path Dependent) or those where underlying spot movement doesn’t follow “Normal Distribution” (which is foundation of Black Sholes and lattice based price tree generation)

In essence, Monte Carlo, in context of option pricing, is just a methodology where market variable (may it be spot price of underlying stock of an equity option, or interest/Exchange rate) is randomly generated over time from time=0 to time=maturity. Underlying spot at maturity is then used to calculate option payoff. Repeat this procedure over a hundred times, take the average payoff calculated over these hundred iterations, discount it to present value: That’s your option value from Monte Carlo simulation

Advantage? Less Computationally intensive than binomial tree.

Disadvantage? Every time you run the same calculation you have a different number if # trials too small. (Should converge otherwise)

Option Pricing using Monte Carlo



For European options, you can:

STEP 1. Run Numerical Approximation from time=0 to time=maturity to estimate underlying spot at Maturity

STEP 2. Calculate payoff based on that estimation on underlying spot @ maturity

STEP 3. Repeat STEP 1-2 a hundred times

STEP 4. Take average over the hundred runs as payoff of option value