With my wife and kids away, I am having a geeky bachelor time that many who read this would probably find quite thrilling. For example: I spent this last weekend producing a new MonteCarlo application example for GigaSpaces.

It is rich in the patterns it utilizes:

  • SBA (Colocated spaces with workers)
  • Master-worker (remote workers which scale dynamically when the workload is too high)
  • Spring Remoting on top of GigaSpaces – the aggregation work is achieved utilizing our Sync Remoting

The app goes like this:

Historical information regarding several funds is used to predict the future behavior of those funds over a 20 year time period with Minute by Minute fluctuation in prices being calculated and applied.
These funds are grouped in different formations into Portfolios and the entire Portfolio assessed for its growth over the same 20 year period.

In the end, the best combination of funds within a portfolio is determined and reported and the best and worst behaving funds are also shown.

Technically, several portfolios and their associated funds are written as tasks into the system for analysis – the logic needed to process them and their historical information is sent along with them as well. Workers take the tasks, process the associated logic and return a result showing the outcome of the application of the expected variation in price for each fund in the portfolio over the designated 20 year period.

This is performed over a set of possible portfolios – each containing different variations of funds.
Each set is repeatedly simulated to avoid undo skewing and allow for better control of the randomness.

In the end, the client requests a summary of all the results which is created by a service that operates in parallel across the available spaces to take all the results and sort them and aggregate them to determine the most common, best [highest value portfolio], and worst [lowest value portfolio]

This information is returned to the client and printed out to the console.

This morning, I produced a nifty 8 minute flash presentation showing my Monte Carlo application being executed on the GigaSpaces platform.

NB: To keep the video short, and because I only used my laptop, I kept the size of the sets and the iterations at very low levels. Nevertheless, the application scales very nicely and provides fault-tolerance as well.

You can check out the 8 minute video using this link: THE MONTECARLO VIDEO

[you may have to wait a while for the video to load, if it stops
mid-way, play it again from the beginning after it loads completely]

I hope you enjoy watching the fruits of my labors – what could be a better way to spend a bachelor weekend eh?



Tagged on: