INNER CODE UNIT · Python
opt
baileydanseglio/thetadata-python · thetadata/client.py:256
opt = parse_int(data[root_len + 2: root_len + 3])
self.isOption = opt == 1
if not self.isOption:
return
date_raw = str(parse_int(view[root_len + 3: root_len + 7]))
self.exp = date(year=int(date_raw[0:4]), month=int(date_raw[4:6]), day=int(date_raw[6:8]))
self.isCall = parse_int(view[root_len + 7: root_len + 8]) == 1
self.strike = parse_int(view[root_len + 9: root_len + 13]) / 1000.0
def to_string(self) -> str:
"""String representation of open interest."""
return 'root: ' + self.root + ' isOption: ' + str(self.isOption) + ' exp: ' + str(self.exp) + \
' strike: ' + str(self.strike) + ' isCall: ' + str(self.isCall)
class StreamMsg:
"""Stream Msg"""
def __init__(self):