diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index 0fcada2b..f39815ec 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -246,6 +246,20 @@ def get_config() -> dict[str, Any]: return section +def check_if_complete( + oi: dict[str, dict[str, Decimal | None]], + + ) -> bool: + for strike in oi: + if ( + oi[strike]['C'] == None + or + oi[strike]['P'] == None + ): + return False + + return True + class Client: ''' @@ -410,6 +424,27 @@ class Client: return response_list + def get_strikes_dict( + self, + instruments: list[Symbol], + + ) -> dict[str, dict[str, Decimal | None]]: + """ + Get a dict with strike prices as keys. + """ + + response: dict[str, dict[str, Decimal | None]] = {} + + for i in range(len(instruments)): + element = instruments[i] + strike = f'{str(element).split('-')[1]}' + response[f'{strike}'] = { + 'C': None, + 'P': None, + } + + return response + async def submit_limit( self, symbol: str,