Skip to content

Commit

Permalink
example jump change
Browse files Browse the repository at this point in the history
  • Loading branch information
rhandal-pfn committed Aug 27, 2024
1 parent b6a5e54 commit 875ffc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pfhedge/instruments/primary/kou_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class KouJumpStock(BasePrimary):
>>> from pfhedge.instruments import KouJumpStock
>>>
>>> _ = torch.manual_seed(42)
>>> stock = KouJumpStock(device = torch.device('cpu'))
>>> stock = KouJumpStock(jump_per_year = 10.0)
>>> stock.simulate(n_paths=2, time_horizon=5 / 250)
>>> stock.spot
tensor([[1.0000, 0.9868, 0.9934, 0.9999, 0.9893, 0.9906],
[1.0000, 0.9956, 1.0050, 1.0121, 1.0227, 1.0369]])
tensor([[1.0000, 1.0021, 1.0055, 1.0089, 0.9952, 0.9933],
[1.0000, 0.9924, 0.9987, 1.0025, 1.0098, 1.0207]])
>>> stock.variance
tensor([[0.0400, 0.0400, 0.0400, 0.0400, 0.0400, 0.0400],
[0.0400, 0.0400, 0.0400, 0.0400, 0.0400, 0.0400]])
Expand Down
6 changes: 3 additions & 3 deletions pfhedge/stochastic/kou_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def generate_kou_jump(
>>> from pfhedge.stochastic import generate_kou_jump
>>>
>>> _ = torch.manual_seed(42)
>>> generate_kou_jump(2, 5, device = torch.device('cpu'))
tensor([[1.0000, 1.0053, 1.0119, 0.9993, 0.9887],
[1.0000, 1.0321, 1.0275, 1.0372, 1.0445]])
>>> generate_kou_jump(2, 5, jump_per_year = 0.0)
tensor([[1.0000, 1.0016, 1.0044, 1.0073, 0.9930],
[1.0000, 1.0282, 1.0199, 1.0258, 1.0292]])
"""
assert jump_eta_up > 1.0, "jump_eta_up must be larger than 1.0"
assert jump_eta_down > 0.0, "jump_eta_down must be larger than 0.0"
Expand Down

0 comments on commit 875ffc3

Please sign in to comment.