auxiliar methods

max_pain_deribit
Nelson Torres 2024-12-05 23:29:45 -03:00
parent ec2123175a
commit c4600a0392
1 changed files with 35 additions and 0 deletions

View File

@ -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,