-
This commit is contained in:
45
internal_types/types.py
Normal file
45
internal_types/types.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum, auto
|
||||
|
||||
|
||||
class SecurityType(Enum):
|
||||
CRYPTO = auto()
|
||||
EQUITY = auto()
|
||||
FUTURE = auto()
|
||||
OPTION = auto()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Instrument:
|
||||
symbol: str
|
||||
security_type: SecurityType
|
||||
multiplier: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Position:
|
||||
instr: Instrument
|
||||
quantity: int # todo: crypto has fractional shares
|
||||
price: float
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BidAsk:
|
||||
instr: Instrument
|
||||
timestamp: int
|
||||
bid: float
|
||||
ask: float
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class OHLC:
|
||||
instr: Instrument
|
||||
timestamp: int
|
||||
open: float
|
||||
high: float
|
||||
low: float
|
||||
close: float
|
||||
volume: int # todo: crypto volume is float
|
||||
|
||||
|
||||
Quote = BidAsk | OHLC
|
||||
Reference in New Issue
Block a user