Comments (25)
I have a build that works under MSVC 2008 for my pybg project, which uses part of pyql, but there are still problems. It compiles, links and runs, but QuantLib's Settings singleton is not a singleton under MSVC--the instance created in each module has a different address and not all have the same values.
This is way beyond my level of expertise, so I'm curious if anyone has any insights.
from pyql.
Also, should mention the changes I had to make included stripping out the distutils directives from the code--they override MSVC's auto-linking, causing it to look for an non-existent QuantLib.lib, instead of the standard QuantLib-vc90-mt.lib created when you build QuantLib with MSVC.
from pyql.
Thanks for the report. This is a known issue with MSVC and mingw/gcc on Windows. We had the very same problem with some previous Ubuntu versions that were solved by preloading the shared library. I am investigating and want to have a robust solution soon
from pyql.
Similar to bondgeek:
- Python 2.7.2 x64, Boost 1.5.2, QuantLib 1.2.1
- compiled using MSVC 2008, in MS Windows 7 x64 SDK (sp1, .NET 3.5).
- used Cython 0.17, unpatched
- My version is x64, most of the hard work was in compiling Boost and QuantLib correctly for that. Small change in setup.py is needed (replace '/machine:I386' with '/machine:x64'). Stripping out distutils directives also applies.
- Some people referenced an issue where the cythonize commands do not kick in, making build_ext command look for inexistant *.c files. In my case that was corrected by installing pyrex.
After running the tests, the following fail:
test_bonds.py (fail 2, skip 1)
FFs
======================================================================
FAIL: test_excel_example_with_fixed_rate_bond (__main__.BondTestCase)
Port the QuantLib Excel adding bond example to Python.
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_bonds.py", line 184, in test_excel_example_with_fixed_rate_bond
calendar.advance(todays_date, 3, Days), bond.settlement_date()
AssertionError: 30/08/2011 != 5/12/2012
======================================================================
FAIL: test_excel_example_with_zero_coupon_bond (__main__.BondTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_bonds.py", line 224, in test_excel_example_with_zero_coupon_bond
calendar.advance(todays_date, 3, Days), bond.settlement_date()
AssertionError: 30/08/2011 != 5/12/2012
----------------------------------------------------------------------
Ran 3 tests in 0.001s
FAILED (failures=2, skipped=1)
test_heston_model.py (fail 1)
F...
======================================================================
FAIL: test_DAX_calibration (__main__.HestonModelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_heston_model.py", line 225, in test_DAX_calibration
self.assertAlmostEquals(expected, sse, delta=1.0)
AssertionError: 177.2 != 103062.59612570431 within 1.0 delta
----------------------------------------------------------------------
Ran 4 tests in 1.071s
FAILED (failures=1)
test_mlab.py (fail 1)
.E
======================================================================
ERROR: test_option_to_rate (__main__.OptionPricerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_mlab.py", line 17, in test_option_to_rate
os.path.join('quantlib', 'test','data','df_SPX_24jan2011.pkl')
File "C:\Python27\lib\site-packages\pandas\core\common.py", line 830, in load
f = open(path, 'rb')
IOError: [Errno 2] No such file or directory: 'quantlib\\test\\data\\df_SPX_24jan2011.pkl'
----------------------------------------------------------------------
Ran 2 tests in 0.009s
FAILED (errors=1)
test_piecewise_yield_curve.py (fail 1)
..F.
======================================================================
FAIL: test_deposit_swap (__main__.PiecewiseYieldCurveTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_piecewise_yield_curve.py", line 201, in test_deposit_swap
ts.discount(calendar.advance(todays_date, 2, Years)),3)
AssertionError: 0.9103 != 0.9126920284652297 within 3 places
----------------------------------------------------------------------
Ran 4 tests in 0.010s
FAILED (failures=1)
test_vanilla_option.py (fail 3)
FF.F.
======================================================================
FAIL: test_american_vanilla_option (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 121, in test_american_vanilla_option
self.assertAlmostEquals(4.459628, american_option.net_present_value, 6)
AssertionError: 4.459628 != 0.0 within 6 places
======================================================================
FAIL: test_american_vanilla_option_with_earliest_date (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 137, in test_american_vanilla_option_with_earliest_date
self.assertAlmostEquals(4.459628, american_option.net_present_value, 6)
AssertionError: 4.459628 != 0.0 within 6 places
======================================================================
FAIL: test_european_vanilla_option_usage (__main__.VanillaOptionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\smalov\workspace\stas_sandbox\test\test_vanilla_option.py", line 108, in test_european_vanilla_option_usage
self.assertAlmostEquals(3.844308, european_option.net_present_value, 6)
AssertionError: 3.844308 != 0.0 within 6 places
----------------------------------------------------------------------
Ran 5 tests in 0.002s
FAILED (failures=3)
from pyql.
Thanks for the report. Just to confirm, those are mostly issues related to the QuantLib::Settings singleton ...
from pyql.
Will you guys be able to provide a windows binary for this, or a way to do a clean install in Windows 7?
from pyql.
@iceman: no real timeline so far but if somebody really need this, we could prioritize and solve the issue.
from pyql.
Not sure if one vote would count but I definitely need this.
from pyql.
Every single vote counts ;-) This is an annoying bug. I'll try to get some time to look at it in the coming weeks.
from pyql.
Much appreciated. I am looking forward to it.
Even better if the binaries could be hosted on Chris Goehlke's Windows binaries page for us unsophisticated users who are not good at compiler tweaking.
Please keep us posted.
from pyql.
I want to throw in my vote too. I regularly come in check to see if the windows build is fixed. I really need this as well.
from pyql.
So I am guessing this didn't get enough votes...you can add mine.
from pyql.
@RayVR I am working on it in my spare time. It is a nightmare ;-) The Settings singleton is causing way more pain than it should.
from pyql.
Have you spoken with any of the QuantLib developers about a change on their side? (This question is coming from complete ignorance about the nature of the problem)
On Mar 14, 2014, at 7:00 AM, Didrik Pinte [email protected] wrote:
@RayVR I am working on it in my spare time. It is a nightmare ;-) The Settings singleton is causing way more pain than it should.
�
Reply to this email directly or view it on GitHub.
from pyql.
@RayVR the key problem is more how we link things on the Windows side. I'll ping the QL mailing list and see if somebody else on Windows have the same kind of issue. I haven't found anything about it in the archives
from pyql.
is a segfault while running the tests the expected symptom of this issue or is that unrelated?
from pyql.
@RayVR No, the test suite runs without segfault. The problem is that the Settings singleton seem to have multiple instances ... This means that if you set your evaluation date two month in the past and construct a bond e.g., the bond settlement date will not be correct (should be two month ago + 3 days but will today + 3 days).
from pyql.
@RayVR good news, I got it to work this morning. There is a bit of work left but I'll push the fist bit of working code in the next two days to the repo.
from pyql.
great news. I'm using the swig wrappers right now, which give me a headache.
from pyql.
@RayVR I got the full test suite passing in this branch https://github.com/dpinte/pyql/tree/fix-win-build If you get a chance to give it a try, it requires MSVC 2008. I'm testing it on Mac/Linux and fix regressions and we will finally have a PR
from pyql.
@BlueCollarWorker @iceman273 @malos @bondgeek If you want to give a try at the fix-win-build branch and report success or failures, please do. It runs on OSX and Win-32 without problems for me. I'll merge master in this week-end.
from pyql.
I have taken a look at this branch but after making all the modifications to the setup file I had to make on enthought/master it still does not compile for me.
I get "fatal error LNK1120: 155 unresolved externals"
from pyql.
@RayVR I have that solved on a branch. Will push the latest latest today.
from pyql.
PR #63 comes with a real solution to the issue. The entire test suite passes with no more issue with the Settings singleton.
from pyql.
#63 fixes the issue
from pyql.
Related Issues (20)
- test a examples file failed HOT 3
- Calls to CreditDefaultSwap.fair_upfront crash Python HOT 7
- def file generation HOT 2
- Test results with QuantLib 1.10
- compilation error HOT 3
- Problem with Python examples - american_option HOT 3
- testing pyql - errors HOT 2
- Odd issue with Period HOT 4
- Cython error + compilation error HOT 1
- Compilation Error on MacOS High Sierra HOT 15
- Cython version issue
- commit 27e9d9bf2 breaks compatibility with Quantlib < 1.13
- Adding OISRateHelpers HOT 13
- Building issue Win10x64 Python3.7.1 / x64 / VS2017 / QL1.15 / Boost 1.69 HOT 18
- Building on x64
- Build error error: ‘Microsecond’ is not a member of ‘QuantLib’ HOT 2
- install pyql in mac HOT 1
- error: ‘RelativePriceError’ is not a member of ‘QuantLib::CalibrationHelper’ HOT 4
- pyql/examples/data/df_libor.pkl cannot be loaded
- Pain point: Not enough documentation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyql.