Skip to content

Commit 739fb17

Browse files
This commit adds and improves numpydoc-style docstrings to the quantlib/time/date.pyx and quantlib/time/calendar.pyx files.
The following classes and their methods have been documented: - `Period` - `Date` - `Calendar` The docstrings now use fully qualified type hints to support documentation generation and cross-referencing. The `Parameters` sections have been moved to the class docstrings for consistency. Additionally, a bug in the `is_end_of_month` method in `quantlib/time/calendar.pyx` has been corrected.
1 parent 670d0ce commit 739fb17

File tree

356 files changed

+1663
-1636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+1663
-1636
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ quantlib.egg-info/*
66
QuantLib.dll
77
symbol_win*.def
88
*.cpp
9-
!quantlib/cpp_layer/*.cpp
109
*.so
1110
*.h
1211
*.pyc

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
global-include *.dll
2+
include quantlib/preload_dlls.txt

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
wheel:
2-
python -m build --wheel -n -C--global-option=build_ext -C--global-option=-j6
3-
41
build:
52
python setup.py build_ext --inplace -j 8
63

4+
build2:
5+
python2 setup.py build_ext --inplace -j 8
6+
77
docs:
8-
-rm -rf docs/source/_autosummary
98
make -C docs html
109

1110
install:
12-
pip install . -C--global-option=build_ext -C--global-option=-j6
11+
pip install .
1312

1413
uninstall:
1514
pip uninstall quantlib
1615

16+
tests-preload:
17+
LD_PRELOAD=/opt/QuantLib-1.1/lib/libQuantLib.so nosetests -v quantlib/test
18+
1719
tests: build
1820
python -m unittest discover -v
1921

22+
tests2: build2
23+
python2 -m unittest discover -v
24+
25+
build_ex:
26+
g++ -m32 -I/opt/local/include/ -I/opt/local/include/boost quantlib_test2.cpp \
27+
-o test2 -L/opt/local/lib/ -lQuantLib
28+
2029
clean:
2130
find quantlib -name \*.so -exec rm {} +
2231
find quantlib -name \*.pyc -exec rm {} +
23-
find quantlib -path quantlib/cpp_layer -prune -o -name \*.cpp -exec rm {} +
32+
find quantlib -name \*.cpp -exec rm {} +
2433
find quantlib -name \*.c -exec rm {} +
2534
find quantlib -name \*.h -exec rm {} +
2635
-rm quantlib/termstructures/yields/{piecewise_yield_curve,discount_curve,forward_curve,zero_curve}.{pxd,pyx}
27-
-rm quantlib/handle.{pxd,pyx}
2836
rm -rf build
2937
rm -rf dist
3038

31-
.PHONY: build docs clean
39+
.PHONY: build build2 docs clean
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195
# Grouping the document tree into LaTeX files. List of tuples
196196
# (source start file, target name, title, author, documentclass [howto/manual]).
197197
latex_documents = [
198-
('index', 'Quantlibcythonwrapper.tex', 'Quantlib cython wrapper Documentation',
199-
'Didrik Pinte & Patrick Hénaff', 'manual'),
198+
('index', 'Quantlibcythonwrapper.tex', u'Quantlib cython wrapper Documentation',
199+
u'Didrik Pinte \& Patrick Hénaff', 'manual'),
200200
]
201201

202202
# The name of an image file (relative to this directory) to place at the top of

examples/american_option.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
FOR A PARTICULAR PURPOSE. See the license for more details.
88
"""
99
from quantlib.instruments.api import AmericanExercise, VanillaOption, OptionType
10-
from quantlib.payoffs import PlainVanillaPayoff
10+
from quantlib.instruments.payoffs import PlainVanillaPayoff
1111
from quantlib.pricingengines.api import BaroneAdesiWhaleyApproximationEngine
1212
from quantlib.pricingengines.api import FdBlackScholesVanillaEngine
1313
from quantlib.processes.black_scholes_process import BlackScholesMertonProcess
1414
from quantlib.quotes import SimpleQuote
1515
from quantlib.settings import Settings
1616
from quantlib.time.api import Actual365Fixed, Date, May, TARGET
17-
from quantlib.termstructures.volatility.api import BlackConstantVol, HandleBlackVolTermStructure
18-
from quantlib.termstructures.yields.api import RelinkableHandleYieldTermStructure, FlatForward
17+
from quantlib.termstructures.volatility.api import BlackConstantVol
18+
from quantlib.termstructures.yields.api import HandleYieldTermStructure, FlatForward
1919
from quantlib.methods.finitedifferences.solvers.fdmbackwardsolver \
2020
import FdmSchemeDesc
2121

@@ -25,7 +25,7 @@ def main():
2525
Settings.instance().evaluation_date = todays_date
2626
settlement_date = Date(17, May, 1998)
2727

28-
risk_free_rate = RelinkableHandleYieldTermStructure()
28+
risk_free_rate = HandleYieldTermStructure()
2929
risk_free_rate.link_to(
3030
FlatForward(
3131
reference_date=settlement_date,
@@ -43,11 +43,9 @@ def main():
4343

4444
# market data
4545
underlying = SimpleQuote(36.0)
46-
volatility = HandleBlackVolTermStructure(
47-
BlackConstantVol(todays_date, TARGET(), 0.20,
46+
volatility = BlackConstantVol(todays_date, TARGET(), 0.20,
4847
Actual365Fixed())
49-
)
50-
dividend_yield = RelinkableHandleYieldTermStructure()
48+
dividend_yield = HandleYieldTermStructure()
5149
dividend_yield.link_to(
5250
FlatForward(
5351
reference_date=settlement_date,

0 commit comments

Comments
 (0)