|
All,
I am facing the following task [in C++]:
Given a list of trades (serialized in xml), load them and the required mkt data to reprice the instruments.
I was thinking using the power of the object handler and to do the following:
1-For each trade, look recursively to the Preceding IDs
2- once we find a pre-defined type (like a TermsStructure), load the serialized xml of this object.
If the object is not present, throw an error as there is a missing mkt data, otherwise, continue
For example, for a simple swap, the workflow would be:
1- Load the swap from SWAP.XML
We have now in the ObjectHandler the swap loaded with the following Preceding IDs:
- EONIA_INDEX: type qlEonia
- FixedLegSchedule: type qlSchedule
- FloatLegSchedule: type qlSchedule
2- For EONIA_INDEX looking at the Preceding IDs:
- EONIA_CURVE: type qlPiecewiseYieldCurve
So if the EONIA_CURVE is not in the Repository, deserialize the xml from the correct mktdata folder.
Then move to the next.
3- for FixedLegSchedule & FloatLegSchedule, look at the Preceding IDs
There are none, so we continue...
Doing like this, it seems we could make it work, but I am not sure there is a more clever way of doing.
Also, I am not sure that we can load the SWAP in the ObjectHandler before having everything correctly loaded before (in XL, this is not possible since we get an exception
ohObjectLoad - Error deserializing file c:/temp/serialization/swap.xml: Error processing item 0: ObjectHandler error: attempt to retrieve object with unknown ID 'EONIA_CURVE'
)
Kind regards
|