mirror of
https://github.com/wassname/options_backtester.git
synced 2026-07-12 08:19:27 +08:00
21 lines
443 B
Python
21 lines
443 B
Python
# Option Enum types
|
|
from enum import Enum
|
|
|
|
|
|
class Type(Enum):
|
|
CALL = 'call'
|
|
PUT = 'put'
|
|
|
|
def __invert__(self):
|
|
flip = Type.PUT if self == Type.CALL else Type.CALL
|
|
return flip
|
|
|
|
|
|
class Direction(Enum):
|
|
BUY = 'ask' # Schema field for BUY price
|
|
SELL = 'bid' # Schema field for SELL price
|
|
|
|
def __invert__(self):
|
|
flip = Direction.SELL if self == Direction.BUY else Direction.BUY
|
|
return flip
|