Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.7.4 #179

Merged
5 commits merged into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions pfhedge/instruments/primary/brownian.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class BrownianStock(Primary):

The drift of the spot prices is assumed to be vanishing.

See :func:`pfhedge.stochastic.generate_geometric_brownian`
for details of the process.

Args:
volatility (float, default=0.2): The volatility of the price.
cost (float, default=0.0): The transaction cost rate.
Expand Down
2 changes: 1 addition & 1 deletion pfhedge/instruments/primary/heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class HestonStock(Primary):
"""A stock of which spot price and variance follow Heston process.

See :func:`pfhedge.stochastic.generate_heston` for details of the Heston process.
See :func:`pfhedge.stochastic.generate_heston` for details of the process.

Args:
kappa (float, default=1.0): The parameter :math:`\\kappa`.
Expand Down
4 changes: 4 additions & 0 deletions pfhedge/nn/modules/bs/american_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class BSAmericanBinaryOption(BSModuleMixin):
tensor([[1.1285],
[0.0000],
[0.0000]])

References:
Dai, M., 2000. A closed-form solution for perpetual American floating strike
lookback options. Journal of Computational Finance, 4(2), pp.63-68.
"""

def __init__(self, call: bool = True, strike: float = 1.0):
Expand Down
4 changes: 3 additions & 1 deletion pfhedge/nn/modules/bs/european.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class BSEuropeanOption(BSModuleMixin):
tensor([[0.4497],
[0.5126],
[0.5752]])

References:
John C. Hull, 2003. Options futures and other derivatives. Pearson.
"""

def __init__(self, call: bool = True, strike: float = 1.0):
Expand Down Expand Up @@ -142,7 +145,6 @@ def price(

Args:
log_moneyness (torch.Tensor): Log moneyness of the underlying asset.
max_log_moneyness (torch.Tensor): Cumulative maximum of the log moneyness.
expiry_time (torch.Tensor): Time to expiry of the option.
volatility (torch.Tensor): Volatility of the underlying asset.

Expand Down
3 changes: 3 additions & 0 deletions pfhedge/nn/modules/bs/european_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class BSEuropeanBinaryOption(BSModuleMixin):
tensor([[6.2576],
[6.3047],
[6.1953]])

References:
John C. Hull, 2003. Options futures and other derivatives. Pearson.
"""

def __init__(self, call: bool = True, strike: float = 1.0):
Expand Down
4 changes: 4 additions & 0 deletions pfhedge/nn/modules/bs/lookback.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class BSLookbackOption(BSModuleMixin):
tensor([[0.9208],
[1.0515],
[1.0515]])

References:
Conze, A., 1991. Path dependent options: The case of lookback options.
The Journal of Finance, 46(5), pp.1893-1907.
"""

def __init__(self, call: bool = True, strike: float = 1.0):
Expand Down
12 changes: 12 additions & 0 deletions pfhedge/stochastic/brownian.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def generate_brownian(

The drift of the time series is assumed to be vanishing.

The time evolution of the process is given by:

.. math ::

dS(t) = \\sigma dW(t) \\,.

Args:
n_paths (int): The number of simulated paths.
n_steps (int): The number of time steps.
Expand Down Expand Up @@ -66,6 +72,12 @@ def generate_geometric_brownian(

The drift of the time series is assumed to be vanishing.

The time evolution of the process is given by:

.. math ::

dS(t) = \\sigma S(t) dW(t) \\,.

Args:
n_paths (int): The number of simulated paths.
n_steps (int): The number of time steps.
Expand Down
4 changes: 3 additions & 1 deletion pfhedge/stochastic/cir.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def generate_cir(
) -> Tensor:
"""Returns time series following Cox-Ingersoll-Ross process.

The time evolution of CIR process is given by:
The time evolution of the process is given by:

.. math ::

dX(t) = \\kappa (\\theta - X(t)) + \\sigma \\sqrt{X(t)} dW(t) \\,.

Time-series is generated by Andersen's QE-M method (See Reference for details).

Args:
n_paths (int): The number of simulated paths.
n_steps (int): The number of time steps.
Expand Down
5 changes: 3 additions & 2 deletions pfhedge/stochastic/heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ def generate_heston(
) -> Tuple[Tensor, Tensor]:
"""Returns time series following Heston model.

The time evolution of Heston process is given by:
The time evolution of the process is given by:

.. math ::

dS(t) = S(t) \\sqrt{V(t)} dW_1(t) \\,, \\\\
dV(t) = \\kappa (\\theta - V(t)) + \\sigma \\sqrt{V(t)} dW_2(t) \\,.

The correlation between :math:`dW_1` and :math:`dW_2` is :math:`\\rho`.
The correlation between :math:`dW_1` and :math:`dW_2` is `\\rho`.

Time-series is generated by Andersen's QE-M method (See Reference for details).

Args:
n_paths (int): The number of simulated paths.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pfhedge"
version = "0.7.3"
version = "0.7.4"
description = "Deep Hedging in PyTorch"
authors = ["Shota Imaki <shota.imaki.0801@gmail.com>"]
license = "MIT"
Expand Down