From ddffe2bec6754091cf57a6a01625ec257192a313 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Tue, 12 Nov 2024 16:06:59 -0300 Subject: [PATCH] Added expiry property for OptionPair --- piker/brokers/deribit/venues.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/piker/brokers/deribit/venues.py b/piker/brokers/deribit/venues.py index ef3d5497..3bd134d8 100644 --- a/piker/brokers/deribit/venues.py +++ b/piker/brokers/deribit/venues.py @@ -116,6 +116,12 @@ class OptionPair(Pair, frozen=True, kw_only=True): # NOTE: see `.data._symcache.SymbologyCache.load()` for why 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 def venue(self) -> str: return 'OPTION'