Exemplo n.º 1
0
 def S(self, val: float) -> None:
     """Set the spot price of the underlying."""
     if not is_pos(val):
         raise ValueError(
             f'Expected non-negative float, instead got {val} with type '
             f'{type(val)}!')
     self._S = float(val)
Exemplo n.º 2
0
 def K(self, val: float) -> None:
     """Set the strike price."""
     if not is_pos(val):
         raise ValueError(
             f'Expected non-negative float, instead got {val} with type '
             f'{type(val)}!')
     self._K = float(val)
Exemplo n.º 3
0
 def div(self, val: float) -> None:
     """Set the time to maturity."""
     if not is_pos(val):
         raise ValueError(
             f'Expected non-negative float, instead got {val} with type '
             f'{type(val)}!')
     self._div = float(val)
Exemplo n.º 4
0
 def pd(self, val: float) -> None:
     """Set the risk free probability of down move."""
     if not is_pos(val):
         raise ValueError(
             f'Expected non-negative float, instead got {val} with type '
             f'{type(val)}!')
     self._pd = float(val)
Exemplo n.º 5
0
 def N(self, val: int) -> None:
     """Set the number of increments."""
     if not isinstance(val, (int, np.int)):
         raise ValueError(
             f'Expected integer, instead got {val} with type {type(val)}')
     if not is_pos(val):
         raise ValueError(f'Expected non-negative int, instead got {val}')
     self._N = val
Exemplo n.º 6
0
 def T(self, val: float) -> None:
     """Set the time to maturity."""
     if not is_pos(val):
         raise ValueError(
             f'Expected non-negative float, instead got {val} with type '
             f'{type(val)}!')
     if val == 0:
         raise ValueError(f'T cannot be set to zero, got {val}')
     self._T = float(val)
Exemplo n.º 7
0
 def M(self, val: int) -> None:
     """Set the number of underlying increments."""
     if not isinstance(val, (int, np.int)):
         raise ValueError(
             f'Expected integer, instead got {val} with type {type(val)}'
         )
     if not is_pos(val):
         raise ValueError(f'Expected non-negative int, instead got {val}')
     self._M = val
     self.s_steps = np.arange(val)