moved function out of api

Nelson Torres 2024-12-07 10:13:12 -03:00
parent 3b8cec45da
commit f9018670b9
2 changed files with 15 additions and 15 deletions

View File

@ -10,6 +10,20 @@ async def max_pain_daemon(
) -> None:
async with maybe_open_oi_feed() as oi_feed:
print('Im in...')
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
async def main():

View File

@ -246,20 +246,6 @@ 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:
'''
@ -886,7 +872,7 @@ async def aio_open_interest_feed_relay(
c: Decimal = Decimal(f'{close}')
call_cash += max(0, (s - c) * oi_by_strikes[f'{close}']['C'])
put_cash += max(0, (c - s) * oi_by_strikes[f'{close}']['P'])
intrinsic_values[f'{strike}'] = {}
intrinsic_values[f'{strike}']['C'] = call_cash
intrinsic_values[f'{strike}']['P'] = put_cash