forked from streamlit/streamlit-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModels.py
More file actions
49 lines (40 loc) · 1 KB
/
Models.py
File metadata and controls
49 lines (40 loc) · 1 KB
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
42
43
44
45
46
47
48
49
import pandas as pd
import numpy as np
import dataclasses
import datetime as datetime
from dataclasses import dataclass
@dataclass
class OptionMarketModel(object):
OptionTicker: str
Symbol: str
OptPC: str
Expiry: pd.datetime
Strike: float
Symbol : str
yTicker : yf.Ticker()
def __repr__(self):
return self.OptionTicker
@dataclass
class OptionContract:
"""
A class to represent an option contract
"""
strike: float
expiry: datetime.datetime
option_type: str
exchange: str = "SMART"
multiplier: int = 100
currency: str = "USD"
option_exercise_type: str = "A"
def __post_init__(self):
self.option = Option(
strike=self.strike,
expiry=self.expiry,
option_type=self.option_type,
exchange=self.exchange,
multiplier=self.multiplier,
currency=self.currency,
option_exercise_type=self.option_exercise_type
)
def price(self):
pass