blob: 55166985ccfb9df12346dc42c08519cbe2fb0d05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# 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: int = auto()
Put: int = auto()
class BarrierUpDown(PPEnum):
"""Up or down type barrier option."""
Up: int = auto()
Down: int = auto()
class BarrierInOut(PPEnum):
"""In or out type barrier option."""
In: int = auto()
Out: int = auto()
|