enthought / pyql

Cython QuantLib wrappers
Other
975 stars 193 forks source link

test a examples file failed #162

Closed Zhaosunday closed 7 years ago

Zhaosunday commented 7 years ago

first of all, my English is not good. sry about that. i just build pyql using boost 1.62 and quantlib 1.8 on pyql-master. my platform is ubuntu 16 after I try a file called traits_example.py in examples directory """ Simple example pricing a European option using a Black&Scholes Merton process.""" import datetime from traits.api import HasTraits, Enum, Float, Date, Property, Range from traitsui.api import View, Item, HGroup, EnumEditor

from quantlib.instruments.option import Put, Call, EuropeanExercise from quantlib.instruments.payoffs import PlainVanillaPayoff

-----------------------------------------------------------------------------------------------

it shoes Traceback (most recent call last): File "traits_example.py", line 7, in from quantlib.instruments.option import Put, Call, EuropeanExercise ImportError: cannot import name 'Put' And this problem also happens on QuantLib 1.5, how can I solve it? btw, i think i have successfully installed pyql since testing other file such as american_opion.py, bonds.py in examples is ok Thanks.

dpinte commented 7 years ago

@Zhaosunday did you install the library after building it?

Zhaosunday commented 7 years ago

@dpinte yeah I have installed it,There is "sudo make install" in guide so I won't miss it. And it's not every Quantlib module not working, like I said " other file such as american_opion.py, bonds.py in examples works well". btw I have tried reinstall 4 times, not working. And if I delete the "put" line, than "AnalyticEuropeanEngine" cannot be import. so the problem is some module can't work and some r ok. that's so far I have found.

-----------------------------------------------------------------------------------------------------------------------

i didn't find "put" class in option.pyx (which is at quantlib/instruments directory), and there is EuropeanExercise class it can be called correctly, so I think this example maybe not write correctly?

Zhaosunday commented 7 years ago

I have fixed the problem, never mind