Monte Carlo in Esperanto


This article shows how a simple parser environment in Excel/VBA could be used to perform single and multi-dimensional Monte Carlo. The clsMathParser is a class for math expression evaluation in Excel/VBA. We show that a host of vanilla and exotic derivatives can be priced easily in this framework. The parser allows separation of concernand natural language expression of structured product payoffs.We provide test results for 1-dimensional and multi-dimensional options and sample spreadsheets.

“Let me try to explain to you, what to my taste is characteristic for all intelligent thinking. It is, that one is willing to study in depth an aspect of one’s subject matter in isolation for the sake of
its own consistency, all the time knowing that one is occupying oneself only with one of the aspects.

We know that a program must be correct and we can study it from that viewpoint only; we also know that is should be efficient and we can study its efficiency on another day [. . .] But nothing
is gained—on the contrary—by tackling these various aspects simultaneously. It is what I sometimes have called “the separation of concerns’’

Edsger W. Dijkstra

1 Introduction

Every few months there is a new thread on the Wilmott forum with a new spin on the age-old computer language debate. Although the thread title is different each time, C++ vs Fortran, Ada vs Java, the discussions are typical of the debate: heated and inconclusive.

Language preferences and superiority of one environment over the other are hard to decide. There has been an attempt in the past at benchmarking languages using standardized test suites [1], and more recently Bagley’s shootout.

Today, there are about a dozen active programming languages in use, of which C, C++ and Java seem to dominate the Street. But in terms of reuse and rapid development tools there is much work still to be done.

2 Domain Specific Languages

Computer Scientists spend a significant amount of their time creating languages that are specific to a problem domain (Domain Specific Languages, or DSL’s). A DSL is a specific formal language that is formed using a limited set of symbols with a set of predefined rules. DSL’s are similar to high-level languages, they often allow us to express in the operating lexicon of the problem domain, “mathematics”. Although DSL remains an active area of research and it has been repeatedly shown to improve productivity and speed, DSL use remains rare. Although many banks appear to have made custom ports of high-level languages there is a disconnect between the model abstraction, conceptual basis and actual implementation.

In terms of high-level tools there are commercial products that provide a high-level language environment and “automagically” generate and compile code for a target language environment based on a domain-specific notation. Although very promising, the average Quant developer/Financial Engineer is not likely to use these tools.

Logged-in members can download the article by clicking the link under all the Related Posts below. To log in or register visit here.