Added expiry property for OptionPair

deribit_fix
Nelson Torres 2024-11-12 16:06:59 -03:00
parent 19b4ca9d85
commit ddffe2bec6
1 changed files with 6 additions and 0 deletions

View File

@ -116,6 +116,12 @@ class OptionPair(Pair, frozen=True, kw_only=True):
# NOTE: see `.data._symcache.SymbologyCache.load()` for why # NOTE: see `.data._symcache.SymbologyCache.load()` for why
ns_path: str = 'piker.brokers.deribit:OptionPair' ns_path: str = 'piker.brokers.deribit:OptionPair'
@property
def expiry(self) -> str:
symbol: str = self.instrument_name.lower()
pair, expiry, strike_price, otype = symbol.split('-')
return f'{expiry}'
@property @property
def venue(self) -> str: def venue(self) -> str:
return 'OPTION' return 'OPTION'