aboutsummaryrefslogtreecommitdiffstats
path: root/utils/payoff.py
diff options
context:
space:
mode:
authorShivesh Mandalia <shivesh.mandalia@outlook.com>2020-04-20 01:25:38 +0100
committerShivesh Mandalia <shivesh.mandalia@outlook.com>2020-04-20 01:25:38 +0100
commitda67665b62c75fe10a1494e3bc7d944963127fc0 (patch)
tree4b93630c020727ad65b3d06548cdbc9466cbe412 /utils/payoff.py
parent1c8649fdcd9f56cca5b191ae3cbaec4977569380 (diff)
downloadMCOptionPricing-da67665b62c75fe10a1494e3bc7d944963127fc0.tar.gz
MCOptionPricing-da67665b62c75fe10a1494e3bc7d944963127fc0.zip
Add __slots__
Diffstat (limited to 'utils/payoff.py')
-rw-r--r--utils/payoff.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/payoff.py b/utils/payoff.py
index 7edeb87..0a2a439 100644
--- a/utils/payoff.py
+++ b/utils/payoff.py
@@ -24,6 +24,7 @@ __all__ = [
class BasePayoff(ABC):
"""Base class for calculating the payoff."""
+ __slots__ = 'K', '_option_right'
def __init__(self, K: Number,
option_right: Union[AnyStr, OptionRight]) -> None:
@@ -244,11 +245,12 @@ class DiscreteBarrierPayOff(BasePayoff):
DiscreteBarrierPayOff(K=100, option_right=Call, B=90, barrier_updown=Down, barrier_inout=Out)
"""
+ __slots__ = 'K', '_option_right', 'B', '_barrier_updown', '_barrier_inout'
def __init__(
self,
- option_right: Union[AnyStr, OptionRight],
K: Number,
+ option_right: Union[AnyStr, OptionRight],
B: Number,
barrier_updown: Union[AnyStr, BarrierUpDown],
barrier_inout: Union[AnyStr, BarrierInOut]