2. Overview
Provide instrument level analytical service to clients
Depend on reference data and analytical library such as QuantLib or
OpenGamma
Need calendar and holiday management
May rely on certain index
Reset when the trading day rolls
Pick up reference data update at run time
Could be embedded or remotely accessed
It should be thread safe
4. Process Flow for the Embedded Mode
Client requests an instrument by an ID
Embedded module checks the availability of the instrument in the cache
If found return, otherwise create, cache, and return the object
The instrument creation is based on reference data and decision tree
Register a listener for the reference data update for this instrument
Client invokes an method on the instrument object
This module has an instance of calendar factory which handles the mapping
among products, country, and market automatically. The factory accepts real
time update.
The default settlement rule is specified in config file and could be overridden by
reference data
5. Features
Hide the low level complexity of analytical library from end users and provide a high level value added
abstraction
Combine the reference data and analytics transparently and automatically
Link an identifier to a financial product via reference data and rule based decision tree.
A user may not know a product is a coupon bond or zero coupon bond but our service will figure that
out and let the client know. Then the analytical methods supported for that product will be disclosed.
More business meaningful analytical functions are exposed
A few examples for bonds include price yield conversion, accrued interest, forward price, duration, dv01,
convexity, z-spread …
Less business meaningful functions, such as how to set the proper day count conversion or holiday
schedule, will not be disclosed
Can be embedded in an application or remotely accessed
The embedded service has Java API. The remote access protocol will be take advantage of
messaging and Java reflection indirectly.
Provide load balancing and high availability
6. Big picture: Layers of Abstractions
Pricing or Risk Service: end users interact with this layer
Calculation Engines: deploy related templates into one engine.
Templates: a group of calculators which define a meaningful business
component. An example could be a curve built based on liquid products
Calculator: define a specify function such as pricing a liquid product by
aggregating several ECNs’ quotes
Analytical Service: combine reference data and lib in an intelligent fashion
Quantitative Libraries: implement the math for different models or products
Math Formulas: pure math
Note the top layers depends on the lower layers and their business meanings will be
more concrete. Also each layer can be provided to our users as a service.
7. Services We could Provide to Our Clients at Each Layer
-there is only configuration involved for the top three layers
Layer Example Potential User
A group of engines Future pricing, risk, offering, and
PNL solution
Portfolio manager
Engine (计算引擎) Future risk engine IT team of a bank
Calculator Module (单元模块) A group of calculators handles
bond future risk calculation
IT team of a bank
Calculator (计算单元) A bond future CTD calculator
finds the CTD from a basket of
deliverables
A developer who configure
calculator models
Analytical Service (分析终端) A bond related analytical service
which does price, risk, and
settlement related calculation
A offering service which needs the
calculation on the fly. A spread
sheet developer who need the
dv01 of a bond.
Quantitative Libraries A enhanced version of QuantLib
which does proper calculation for
Chinese Government bonds
No targeted user
Math formula A model’s white paper No targeted user
8. Big Picture Again
We have three kinds of data, static reference data, dynamic market data, and
specific user inquiry data.
If an application is driven by market data, it is event based and real time pushing
is the solution. In most case, our calculation engines fits into here.
If an application is mainly driven by user inquiries, it is query/response based and
the remote analytical service would be a good candidate for this.
In both case, the referenced data will be needed to handle the requirements.
However, the approaches could be combined. For example, a calculation engine
could constantly publish a curve driven by market data. A client could ask the
remote analytical service for the z-spread of a bond’s price against that curve.
10. Remote Analytical Service Example
The user’s concern is “I have a bond and I want to do yield price conversion.”
In this example, the user queries the RAS and gets the response right away
Behind the scene,
We gets the ID and retrieve the reference data, such as coupon and maturity
Realize it is a bond.
Prepare the cash flow schedule and make a bond object from it.
The calcPriceFromYield method which is mapped to cleanPrice (double yld) in QuantLib will be
called with the 0.09 as a parameter.
Return clean price
Note we will not expose QuantLib methods directly and the client will not be affected if we switch to
another library.
12. Rule Based Decision Used to Identify Instrument Type
The decision tree is configured in an XML file
It is based on certain criteria checking against the reference data
It goes from general to specific as much as possible. For example, if a
checking matches generic bond, coupon bond, and callable coupon bond,
we shall return callable coupon bond as the instrument type.
Once the best match is found, the corresponding instrument type will be
returned
An instrument object will be built after that
13. Security Tree
Leverage object oriented design to avoid redundancy
Reference data and analytical methods are organized accordingly
Help on identify a product type
Security
GenericBond Future Swap Option
ZeroCpnBond CpnBond
Linker CallableBond
BondFuture CmdtyFut
14. High Performance and Availability
Deploy multiple instances in load balanced fashion
Each instance is thread safe and multithreaded
Preload frequently used instrument objects: liquid products fit into this category
Intelligent caching helps on optimization
Instrument object caching
On a specific day, the prices of a product fluctuates with in limited range and caching
algorithms taking advantage of this phenomenon improves performance considerably