Skip to content

Commit

Permalink
v0.5 (created by auxilium)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonntagsgesicht committed Nov 21, 2021
1 parent 6c24bd0 commit 00fbe42
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 63 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ setenv
.aux/
*/__pycache__/
*.egg-info/
__pycache__/
.vs/
*.json
*.zip

4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Release date was |today|

# new casting concept for curves, old `curve_instance.cast(TypeToCastTo)` is replaced by `TypeToCastTo(curve_instance)`

# restructuring cashflow lists, see |cashflow|
# restructuring cashflow lists, see |dcf.cashflow|

# adding payment plans, see |plans|
# adding payment plans, see |dcf.plans|

# adding pricing functions, e.g. |get_present_value()|, |get_yield_to_maturity()|, |get_par_rate()|, ...

Expand Down
8 changes: 4 additions & 4 deletions HOWTO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ There are four different types of interest rate curves:
They meet all the same interface, i.e. have the same properties and methods.
They differ only in data which can be given for constructing the curves.
This sets how rates are stored and interpolated.
Moreover an large list of interpolation methods are provided |interpolation|.
Moreover an large list of interpolation methods are provided.

As the names indicate, these curves take either

Expand Down Expand Up @@ -140,7 +140,7 @@ Already use was the domain property |Curve().domain| or |DateCurve().domain|
which reveals the *x*-values of the curve.

As we have to measure distances by a day counting method (aka. year fraction) |DateCurve().day_count()|,
which is mainly turning days into |float|.
which is mainly turning days into :code:`float`.

See `wikipedia <https://en.wikipedia.org/wiki/Day_count_convention>`_ for details and
also `businessdate <https://businessdate.readthedocs.io/en/latest/doc.html#module-businessdate.daycount>`_
Expand Down Expand Up @@ -234,11 +234,11 @@ Finally, create for each leg a |CashFlowList|.

>>> principal = FixedCashFlowList([start_date], [-notional], origin=start_date)
>>> print(principal)
FixedCashFlowList([BusinessDate(20201031) ... BusinessDate(20201031)], [-1000.0 ... -1000.0], origin=BusinessDate(20201031), day_count=day_count)
FixedCashFlowList([BusinessDate(20201031) ... BusinessDate(20201031)], [-1000.0 ... -1000.0], origin=BusinessDate(20201031))

>>> redemption = FixedCashFlowList(payment_dates, plan, origin=start_date)
>>> print(redemption)
FixedCashFlowList([BusinessDate(20210131) ... BusinessDate(20221031)], [125.0 ... 125.0], origin=BusinessDate(20201031), day_count=day_count)
FixedCashFlowList([BusinessDate(20210131) ... BusinessDate(20221031)], [125.0 ... 125.0], origin=BusinessDate(20201031))

>>> interest = RateCashFlowList(payment_dates, out, origin=start_date, fixed_rate=interest_rate)
>>> print(interest)
Expand Down
1 change: 1 addition & 0 deletions dcf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
__dependency_links__ = ()
__data__ = ()
__scripts__ = ()
__theme__ = 'sphinx_rtd_theme'

import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())
Expand Down
136 changes: 80 additions & 56 deletions doc/sphinx/conf.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,80 +1,53 @@
# -*- coding: utf-8 -*-

# dcf
# ---
# A Python library for generating discounted cashflows.
#
# Author: sonntagsgesicht, based on a fork of Deutsche Postbank [pbrisk]
# Version: 0.4, copyright Saturday, 10 October 2020
# Website: https://github.com/sonntagsgesicht/dcf
# auxilium
# --------
# A Python project for an automated test and deploy toolkit - 100%
# reusable.
#
# Author: sonntagsgesicht
# Version: 0.1.4, copyright Sunday, 11 October 2020
# Website: https://github.com/sonntagsgesicht/auxilium
# License: Apache License 2.0 (see LICENSE file)


import os
import sys

sys.path.insert(0, os.path.abspath('../../')) # needed to import pkg
sys.path.insert(0, os.path.abspath('.')) # needed to import pkg

if os.getcwd().find('readthedocs')<0:
pkg = __import__(os.getcwd().split(os.sep)[-3])
else:
pkg = __import__(os.getcwd().split(os.sep)[-5])
sys.path.append('../..')

sys.path.insert(0, os.path.abspath('../../' + pkg.__name__)) # needed to import pkg
# -- Import project pkg ---------------------------------------------------

from auxilium import replacements_from_pkg, replacements, replacements_str

replacements = replacements_from_pkg(replacements, pkg)
rst_prolog = replacements_str(replacements)
print(rst_prolog)
pos = -5 if 'readthedocs' in __file__ else -3 # hack for readthedocs.org
pkg_path = __file__.split(os.sep)[:pos]
sys.path.append(os.sep.join(pkg_path))
pkg = __import__(pkg_path[-1])

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

needs_sphinx = '1.8'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_rtd_theme',
'sphinx_pytype_substitution',
'sphinx_math_dollar',
'sphinx.ext.autodoc',
#'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon',
'sphinx.ext.inheritance_diagram',
]

autodoc_default_options = {
'show-inheritance': 1,
'members': True, # 'var1, var2',
'member-order': 'bysource',
# 'inherited-members': False,
# 'special-members': '__call__',
'undoc-members': True,
# 'exclude-members': '__weakref__',
# 'autosummary': True,
'inherit_docstrings': True
}
numpydoc_show_class_members=True
autoclass_content = 'both'
#autosummary_generate = True

# needed for version 1.8.5 (python 2.7)
autodoc_default_flags = [ 'members', 'show-inheritance']
autodoc_member_order = 'bysource' #'groupwise'
autodoc_inherit_docstrings = True

#source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# Extend extensions by project theme
if pkg.__theme__ and pkg.__theme__.replace('-', '_') not in extensions:
extensions.append(pkg.__theme__.replace('-', '_'))
html_logo = 'logo.png'

# The master toctree document.
master_doc = 'index'
Expand All @@ -92,6 +65,8 @@
version = pkg.__version__
# The full version, including alpha/beta/rc tags.
release = pkg.__version__ + ' [' + pkg.__dev_status__ + ']'
# today as date of release
today = pkg.__date__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -108,27 +83,29 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
# If true, `to_do` and `to_do_List` produce output, else they produce nothing.
todo_include_todos = False

# A boolean that decides whether module names are prepended to all object names.
# A boolean that decides whether module names are prepended to all object
# names.
add_module_names = True

# -- Options for HTML output ----------------------------------------------

html_theme = 'sphinx_rtd_theme'
html_logo = 'logo.png'
if pkg.__theme__:
html_theme = pkg.__theme__.replace('-', '_')
# html_logo = 'logo.png'
# html_theme_options = {}
# html_static_path = ['_static']


# -- Options for LaTeX output ---------------------------------------------

latex_logo = 'logo.png'
latex_elements = {
'papersize': 'a4paper',
'pointsize': '10pt',
}
# latex_logo = 'logo.png'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
Expand All @@ -139,8 +116,7 @@
pkg.__name__.capitalize() + ' Documentation',
pkg.__author__,
'manual'
),]

), ]

# -- Options for manual page output ---------------------------------------

Expand All @@ -154,3 +130,51 @@
[pkg.__author__],
1)
]


# -- Options for autodoc extension -----------------------------------------

autodoc_default_options = {
'show-inheritance': 1,
'inherit_docstrings': True,
'member-order': 'bysource',
'members': True, # 'var1, var2',
'undoc-members': True,
'private-members': False,
'inherited-members': False,
'imported-members': False,
# 'special-members': '__call__',
# 'exclude-members': '__weakref__',
# 'autosummary': True,
# 'ignore-module-all':
# 'class-doc-from':
}
# This value selects what content will be inserted into the main body of an
# autoclass directive. (autodoc)
# "class" Only the class’ docstring is inserted.
# "init" Only the __init__ method’s docstring is inserted.
# "both" Both the class’ and the __init__ method’s docstring are inserted.
autoclass_content = 'both'

# This value selects how the signature will be displayed for the class defined
# by autoclass directive. (autodoc)
# "mixed" Display the signature with the class name.
# "separated" Display the signature as a method.
autodoc_class_signature = "separated"

# -- Config for math-dollar extension (mathjax) ----------------------------

mathjax3_config = {
'tex2jax': {
'inlineMath': [["\\(", "\\)"]],
'displayMath': [["\\[", "\\]"]],
},
}

# -- Config for pytype_substitution extension ------------------------------

pytype_substitutions = pkg, # package, module or class to reference to
pytype_buildins = False # not implemented in v0.1
pytype_short_ref = True # drop module from reference (if it does not conflict)
pytype_match_pattern = '' # regex to filter entities to ref to
pytype_exclude_pattern = '' # regex to exclude entities to ref to
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
scipy
businessdate
auxilium
regtest

0 comments on commit 00fbe42

Please sign in to comment.