diff options
| author | Shivesh Mandalia <shivesh.mandalia@outlook.com> | 2020-03-21 17:30:06 +0000 |
|---|---|---|
| committer | Shivesh Mandalia <shivesh.mandalia@outlook.com> | 2020-03-21 17:30:06 +0000 |
| commit | c5df1cb77e6e40f701ecf002687d7b3932b28d8f (patch) | |
| tree | 03535770c6510eb22230049403daf6a41c5cc392 /utils/enums.py | |
| download | MCOptionPricing-c5df1cb77e6e40f701ecf002687d7b3932b28d8f.tar.gz MCOptionPricing-c5df1cb77e6e40f701ecf002687d7b3932b28d8f.zip | |
Initial Commit
Diffstat (limited to 'utils/enums.py')
| -rw-r--r-- | utils/enums.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/utils/enums.py b/utils/enums.py new file mode 100644 index 0000000..6a607ea --- /dev/null +++ b/utils/enums.py @@ -0,0 +1,40 @@ +# author : S. Mandalia +# shivesh.mandalia@outlook.com +# +# date : March 19, 2020 + +""" +Enumeration utility classes. +""" + +from enum import Enum, auto + +__all__ = ['OptionRight', 'BarrierUpDown', 'BarrierInOut'] + + +class PPEnum(Enum): + """Enum with prettier printing.""" + + def __repr__(self) -> str: + return super().__repr__().split('.')[1].split(':')[0] + + def __str__(self) -> str: + return super().__str__().split('.')[1] + + +class OptionRight(PPEnum): + """Right of an option.""" + Call = auto() + Put = auto() + + +class BarrierUpDown(PPEnum): + """Up or down type barrier option.""" + Up = auto() + Down = auto() + + +class BarrierInOut(PPEnum): + """In or out type barrier option.""" + In = auto() + Out = auto() |
