Serving the Quantitative Finance Community

 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 8:25 am

QuoteOriginally posted by: PolterQuote1. low: market/simulated data of the params2. models and paths3. option pricing Quote"Instrument definition" or "contract definition" instead of payoff?market_data / Marketmodel_data / Modelcontract_data / Contract?I think these are good names for the layers. I had used 'data' in the names to suggest data flow between the layers. Ideally, we need independence between these layers (~ ISO stack):i) The number of layers needed.ii) The services that a layer delivers to its upper layers.iii) Specify the interfaces for each layer.iv) Structure each layer (for example, design the classes that implement each layer).v) Decouple adjacent layers.vi) Design an error-handling strategy.
Last edited by Cuchulainn on January 20th, 2014, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 8:36 am

QuoteOriginally posted by: outrunYes, choosers is also a good example!I think it should capture all information of an instrument that's needed to compute a cashflow given a MC engine (scenario). In the simple case (eg chooser option) it should tell the "MC configurator" that it needs a sample of the two underlyings at some time T, and also an interest rate up to T for discounting the cashflow. That information should also be useable for non-MC applications (up to some point).American option are more difficult, they can't be evaluated on a scenario by scenario basis because the boundary depend on a set of scenarios. You can probably use an online (incremental) regression model to accumulate some measure to evaluate the American price? I've never done American option with MC but I think it involves least squares regression over the scenario set."Instrument definition" or "contract definition" instead of payoff?Let's say you have a MC model to price choosers. The payoff used it itself a model because it will use a numerical model (Exact, MC, PDE) to compute the payoff at t = T. We he nested models which is doable but good interfaces are needed.This will be in the description of a contract definition, yes?
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 8:46 am

QuoteOriginally posted by: outrunCalibration is model dependent, a different stoch model will give different implied volatilities. In general the calibration involves processing some historical data (historical covariance matric) or current prices in the market (volatility surface), and it provided the model parameters that are needed as an input to genate a set of MC paths (or also for other numerical methods)If we have layering it should be easier to manage this N:N situation.Example;Let's say you want to price a contract (e.g. discount bond option) using BDT model. Then we first have to fit BDT to the yield curve (zcb, state vars) to constuct a discount factor tree and use the backwards induction to price the derivative contract starting with payoff (contract definition?) at t = T.As far I can see there is clear separation of concerns into layers. What do you think? What is the big deal? As little coupling as possible and interchangeable components, yes??
Last edited by Cuchulainn on January 20th, 2014, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 11:54 am

QuoteOriginally posted by: outrunThis is my guess:A SDE (is that the model?) has well defined parameter, and that definition is the interface between calibration and simulation. You can have various algorithm that estimate the SDE parameters given all sort of data (historical data, implied vol data) and all sort of calibration methods (least squares, maximum likelihood, constraint optimized like "all forward rates need to be positive" etc etc).That calibration is orthogonal to the MC simulation and a world on its own. The MC engine needs SDE parameter values as input, and it doesn't care if those are based on calibration or eg a manual picked stress scenario by a risk manager.For the MC framework you can forget about the calibration and assume the SDE parameters as given/input.Yes, I agree.A SDE (is that the model?) has well defined parameter, and that definition is the interface between calibration and simulation2 interfaces 1) to upper pricer , 2) possibly to lower market/simulated data. In fact, you have answered my previous:0) the SDE is just a class that models sdes with drift, diffusion etc. More detailed layered designs allows you to initialise them using MLE etc. (like your OU calibration paper). Is that what you mean?
Last edited by Cuchulainn on January 20th, 2014, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 11:58 am

QuoteThat calibration is orthogonal to the MC simulation and a world on its own.Put another way, calibration is far away/in a world of its own/in another layer hiding behing a facade.
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 21st, 2014, 11:58 am

QuoteThat calibration is orthogonal to the MC simulation and a world on its own.Put another way, calibration is far away/in a world of its own/in another layer hiding behing a Façade. A and B are othogonal <==> A and B have no underlying dependencies, yes?
Last edited by Cuchulainn on January 20th, 2014, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 22nd, 2014, 9:51 am

QuoteOriginally posted by: outrunAll the MC simulator needs is a set of model SDE parameters.The calibration step might use the MC engine for pricing complex derivatives. Eg it could price all derivatives multiple times, repeatedly feed it with different model parameters and explore the parameter space, and them pick the parameters where the theoretical derivative prices fit the observed market prices best.Any ideas on avoiding recomputation that is not needed? e.g. do you create redundant variables etc. It there a structural way to do this?
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 23rd, 2014, 11:30 am

QuoteOriginally posted by: outrunYes, choosers is also a good example!I think it should capture all information of an instrument that's needed to compute a cashflow given a MC engine (scenario). In the simple case (eg chooser option) it should tell the "MC configurator" that it needs a sample of the two underlyings at some time T, and also an interest rate up to T for discounting the cashflow. That information should also be useable for non-MC applications (up to some point).In general, the discounting will not be a simple number but the result of a computation.But where do we put it?IMO the input is the path from the path evolver, so I would have it 'close' to the component that prices the option, yes?
Last edited by Cuchulainn on January 22nd, 2014, 11:00 pm, edited 1 time in total.
 
User avatar
Polter
Posts: 1
Joined: April 29th, 2008, 4:55 pm

MC Common Framework in C++ versus C#

January 23rd, 2014, 12:00 pm

BTW, don't forget about collateralization and multi-curve term structure setup (e.g., OIS for discounting, LIBOR for cash flows).See, for instance, http://arxiv.org/abs/1304.1397
 
User avatar
Cuchulainn
Topic Author
Posts: 20250
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

MC Common Framework in C++ versus C#

January 23rd, 2014, 2:39 pm

QuoteOriginally posted by: outrungood point, for each instrument you need to specify what curve you are going to use for discounting, and what numerical method for interpolation etcall discounting one of a specific curve should be done with the exact same interpolation setting, otherwise you'll get arbitrage opportunities. maybe make a separate design element for this?Good points, both.Andrea Germani - my coauthor - has made a design component for this, he does multi-curve and 5 interpolators So, I just need to define a good interface to it.