Login  Register

Re: Python - pickling quantlib objects?

Posted by Piter Dias-4 on Dec 03, 2012; 12:59am
URL: http://quantlib.414.s1.nabble.com/Python-pickling-quantlib-objects-tp13769p13773.html

Wouldn't QuantLibAddin/ObjectHandler help somehow? The objects can be serialized using XML, including the dependencies between them.

The snippet below was exported using QuantLibXL. Everything that starts with "NTN-F (QuantLibXL):" is a object, also exported.

                <item>

                                <px class_id_reference="14" object_id="_168">

                                                <ObjectId>NTN-F (QuantLibXL): 7-10</ObjectId>

                                                <ClassName>qlFixedRateBond2</ClassName>

                                                <Description>NTN-F</Description>

                                                <Currency>BRL</Currency>

                                                <SettlementDays>0</SettlementDays>

                                                <FaceAmount>1000</FaceAmount>

                                                <ScheduleID>NTN-F (QuantLibXL): 30-10</ScheduleID>

                                                <Coupons>

                                                                <count>1</count>

                                                                <item_version>0</item_version>

                                                                <item>NTN-F (QuantLibXL): 22-10</item>

                                                </Coupons>

                                                <PaymentBDC>Following</PaymentBDC>

                                                <Redemption>100</Redemption>

                                                <IssueDate>

                                                                <which>0</which>

                                                                <value></value>

                                                </IssueDate>

                                                <PaymentCalendar>Brazil::Settlement</PaymentCalendar>

                                                <Permanent>0</Permanent>

                                                <UserProperties>

                                                                <count>0</count>

                                                                <item_version>0</item_version>

                                                </UserProperties>

                                </px>

                </item>

 

---

________________________ Piter Dias [hidden email] http://www.piterdias.com

Em 2012-12-02 22:08, Didrik Pinte escreveu:

Hi Matthew,

On 2 December 2012 17:53, Matthew Gline <[hidden email]> wrote:
Hello all, I have a general question for anyone out there who is using QuantLib in Python: SWIG objects are, as I understand them, by nature not pickleable. This doesn't matter for day-to-day use of the library but it creates some issues when trying to build something more robust around it: it's difficult to store QuantLib objects in databases, etc. Has anyone encountered this issue / found a workaround for it? Obviously one solution is to store all of the inputs required to create the objects, but this is a fairly expensive workaround if you're dealing with a sizable number of curves or instruments... Does anyone know if the PyQL bindings that use Cython result in pickleable objects?
The Cython wrappers in PyQL could support some pickling and provide
some of what you want. It doesn't do anything like that for now. If
they are some functionalities available on the C++ side, we could
potentially use that. Otherwise, it will be some work to have a decent
serialization support on the python layer ...

-- Didrik

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
BUILD Helping you discover the best ways to construct your parallel projects.
http://goparallel.sourceforge.net
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
BUILD Helping you discover the best ways to construct your parallel projects.
http://goparallel.sourceforge.net
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users