Page 2 of 16

Architecture and Design

Posted: October 11th, 2011, 10:04 pm
by fancidev
Nice one! A few of my thoughts:- in math:rocesses, these classes likely will have some sort of interaction with random number generation, monte-carlo simulation, etc. Would be nice if they can be decoupled clearly or maybe move math:rocesses to some higher level of the library.- fin::instruments, are they supposed to be generic instruments (option with expiry T and strike K) or specific contracts (fx option with a specific expiry date, settlement date, time-cut, currency pair, etc)?- similar question applies to the black_and_scholes model. In general, are we going to deal with it generic (double T, T=1.0 means one year) or specific (particular date)? Well for constant vol BS this probably doesn't differ much but assume we have a time-dependent deterministic vol BS...- probably add "calendar", "day count calculator/schedule generator" to fin namespace?- can add "sabr" to special_models ?

Architecture and Design

Posted: October 13th, 2011, 1:36 pm
by Alan
Re calendars and date/time support. I was re-reading the VIX white paper yesterday. They measure time-to-expiration in minutes andsuggest that most professional traders do so also. Suggest at least this granularity be available to all derivative evaluators. If youwanted to replicate the VIX index, for instance, you would need it.

Architecture and Design

Posted: October 22nd, 2011, 2:34 pm
by Cuchulainn
One important aspect of MC and FDM frameworks is that we must be able to customise algorithms. In GOF I use Strategy, Template Method, Command and Visitor. Very good (V1). This is already working in both cases.Now, I also want a generic version (V2) as well. I use Boost function and signals which are excellent. And BGL Visitor to define event points in an algorithm (default visitors have empty body and you use inheritance.)I would then have a BGL Visitor for each kind of option (barrier, asian, early) and output (e.g. MC statistics gathering). Super flexible and easy to do in C# (delegates) as well.Q1. Is this a good approach in V2?2. Is BGL Visitor approach used a lot (for me, it is aka Template Method pattern?edit: The analogy Boost Visitor and GOF Template Method is the most accurate one imo.

Architecture and Design

Posted: October 23rd, 2011, 9:12 am
by Cuchulainn
Quote* your post is about having a flexible engine, which gets configured (runtime/compiletime), and then need to numbercrunch with high efficiency...It's about the archictecture and design drawings and interfaces that wil be mapped to C++, C# , Matlab etc. This process is well-known and documented. A well-designed system leads to an efficient (and maintainable!) one.Quote* a nice set of information containers and manipulation bits that setup the engine.Maybe, this look like detailed design, which is the easy part. I want to avoid premature optimisation. QuoteCan we work on a case? Eg the price of digital barrier option? With implicit, explicit Euler and with MC?That would allow use to define elements, and put things at the correct place? This is possible (and has been done, see bespoke chapter 0 MC!) but I don't need code examples in order to discover requirements as I have a number of frameworks at design level which I want to 'stress-test' by inspecting the UML class and component diagrams. Simultaneously, I have a number of Proof-Of-Concept (POC) programs to test the design.QuoteEg, a digital barrier contract has:* barrier* expiration date...we can use doubles for both for now.It has a payoff of $1 at expiration if max(St) 0<t<=T is at least B We could decide to sample the max(St) distribution, or we can make various path samples with discrete time steps, and approximate the distribution.There is also a process, eg gbm or Heston, that's another element... That's no problem and low-risk; more pressing is finding the components and their interfaces. See again Chap 0 POC.Question:Do quants 'see' a system as multiple lines of code or have they some _back_of_envelope_ design model??

Architecture and Design

Posted: October 23rd, 2011, 9:47 am
by Cuchulainn
QuoteOriginally posted by: outrunThen I would like to see the design in action with a code example. I need to see potential holes by trying to come up with things that wont fit, or generate inefficient code. Do you have access to the sandbox?I hear what you are saying.Of course. I am not ready yet. First, my design documents. Can you find potential holes without having access to code (Btw, it has and can be done).My question again is reading design documents! It's crucial.

Architecture and Design

Posted: October 23rd, 2011, 10:03 am
by Cuchulainn
The component diagrams will look like this: