removed unused variable

minor refactor
expiry date changed to 20DEC24
max_pain_deribit
Nelson Torres 2024-12-06 07:41:48 -03:00
parent ec1da6134b
commit ca5e1b6ed1
1 changed files with 8 additions and 9 deletions

View File

@ -875,12 +875,10 @@ async def aio_open_interest_feed_relay(
open_interest: Decimal = oi.open_interest open_interest: Decimal = oi.open_interest
oi_by_strikes[f'{strike_price}'][f'{option_type}'] = open_interest oi_by_strikes[f'{strike_price}'][f'{option_type}'] = open_interest
is_ready = check_if_complete(oi_by_strikes) if check_if_complete(oi_by_strikes):
if is_ready: closes: list[str] = sorted(oi_by_strikes.keys())
for strike in oi_by_strikes: for strike in oi_by_strikes:
s: Decimal = Decimal(f'{strike}') s: Decimal = Decimal(f'{strike}')
close_losses = Decimal(0)
closes: list[str] = sorted(oi_by_strikes.keys())
call_cash: Decimal = Decimal(0) call_cash: Decimal = Decimal(0)
put_cash: Decimal = Decimal(0) put_cash: Decimal = Decimal(0)
for close in closes: for close in closes:
@ -888,10 +886,11 @@ async def aio_open_interest_feed_relay(
call_cash += max(0, (s - c) * oi_by_strikes[f'{close}']['C']) call_cash += max(0, (s - c) * oi_by_strikes[f'{close}']['C'])
put_cash += max(0, (c - s) * oi_by_strikes[f'{close}']['P']) put_cash += max(0, (c - s) * oi_by_strikes[f'{close}']['P'])
intrinsic_values[f'{strike}'] = {} intrinsic_values[strike] = {
intrinsic_values[f'{strike}']['C'] = call_cash 'C': call_cash,
intrinsic_values[f'{strike}']['P'] = put_cash 'P': put_cash,
intrinsic_values[f'{strike}']['total'] = (call_cash + put_cash) 'total': call_cash + put_cash,
}
for strike in intrinsic_values: for strike in intrinsic_values:
if intrinsic_values[f'{strike}']['total'] < total_intrinsic_value: if intrinsic_values[f'{strike}']['total'] < total_intrinsic_value:
@ -931,7 +930,7 @@ async def aio_open_interest_feed_relay(
@acm @acm
async def open_oi_feed( async def open_oi_feed(
) -> to_asyncio.LinkedTaskChannel: ) -> to_asyncio.LinkedTaskChannel:
expiry_date: str = '6DEC24' expiry_date: str = '20DEC24'
instruments: list[Symbol] = [] instruments: list[Symbol] = []
oi_by_strikes: dict[str, dict[str, Decimal]] oi_by_strikes: dict[str, dict[str, Decimal]]