|
From: Eric E. <eri...@re...> - 2020-11-16 12:57:31
|
I don't think it makes sense to load the XLL into Python. One motivation for exporting the QuantLibAddin interface to a non-Excel platform such as C or C++ is that you can then exactly replicate the behavior of a spreadsheet in some other environment. I have used exactly that for grid computing where the spreadsheet sent calculations off to the grid for processing. But if you just want to call QuantLib from Python and you don't care about matching a spreadsheet then it would make more sense to use QuantLib's normal SWIG binding to Python. You could export the QuantLibAddin interface to COM and I think we may have even done that at one point, I can't remember. Not sure how you would go about calling pure QuantLib from COM. Regards, Eric On 11/16/20 12:54 PM, da...@el... wrote: > > My question would be why would you want to use QuantLibXL in Python? > > As I understand it, the main point of the Excel interface is to create > a system which holds object state, as Excel (and some other > frameworks) don’t support this. Python is OO-ready, so doesn’t require > this ObjectHandler layer. All it would add is a lot of unnecessary > type conversion from Python -> C++ -> Excel datatypes. > > Since we are on the subject of generating interfaces, I was wondering > whether a COM interface would be possible: ie auto-generate the IDL > file from C++ class definitions to add the COM layer onto the existing > QL classes. > > Best wishes, > > David > > *From:*Eric Ehlers <eri...@re...> > *Sent:* Monday, 16 November 2020 10:34 > *To:* SX L <han...@ho...> > *Cc:* qua...@li... > *Subject:* Re: [Quantlib-users] How to expose QuantLibAddin to Python? > > > I managed to load QuantLibXLL into Python with win32com. > > That's an interesting exercise to attempt. An XLL is a DLL so I guess > there is nothing to prevent you from loading it as such into Python. > But the XLL's entry points are designed to be called from Excel so it > would be a hassle at best to use from Python. > > > However, what about Linux side? SWIG? Can gensrc generate C interfaces similar to > XL ones? > > The idea behind gensrc is that you could autogenerate source code for > the QuantLibAddin interface for any platform, Excel is just one > example. There is a build for C++ but it only supports a subset of > the functionality that QuantLibXL supports. So the C++ build is more > of a proof of concept. It works on Windows and Linux and is > documented here: > > https://www.quantlib.org/quantlibaddin/build_cpp.html > > Once upon a time, we implemented a gensrc module to export the > QuantLibAddin interface to C, and that facilitated deployment to > platforms such as Python that talk C. However that build has not been > maintained for a long time and it would not be a trivial task to > resurrect it. > > Regards, > Eric > > On 11/15/20 5:13 PM, SX L wrote: > > I managed to load QuantLibXLL into Python with win32com. However, > what about Linux side? SWIG? Can gensrc generate C interfaces > similar to XL ones? > > > > > _______________________________________________ > > QuantLib-users mailing list > > Qua...@li... <mailto:Qua...@li...> > > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |