renaming variable

fixed variable name for better understanding.
max_pain_deribit
Nelson Torres 2024-12-05 23:43:13 -03:00
parent 2b70518eb9
commit cbc5168b8d
1 changed files with 8 additions and 9 deletions

View File

@ -833,7 +833,7 @@ async def aio_open_interest_feed_relay(
to_trio: trio.abc.SendChannel, to_trio: trio.abc.SendChannel,
) -> None: ) -> None:
max_losses: Decimal = Decimal('Infinity') total_intrinsic_value: Decimal = Decimal('Infinity')
max_pain: Decimal = Decimal(0) max_pain: Decimal = Decimal(0)
async def _trade( async def _trade(
@ -859,7 +859,7 @@ async def aio_open_interest_feed_relay(
''' '''
nonlocal intrinsic_values nonlocal intrinsic_values
nonlocal oi_by_strikes nonlocal oi_by_strikes
nonlocal max_losses nonlocal total_intrinsic_value
nonlocal max_pain nonlocal max_pain
symbol: Symbol = str_to_cb_sym(oi.symbol) symbol: Symbol = str_to_cb_sym(oi.symbol)
@ -894,14 +894,14 @@ async def aio_open_interest_feed_relay(
intrinsic_values[f'{strike}']['total'] = (call_cash + put_cash) intrinsic_values[f'{strike}']['total'] = (call_cash + put_cash)
for strike in intrinsic_values: for strike in intrinsic_values:
if intrinsic_values[f'{strike}']['total'] < max_losses: if intrinsic_values[f'{strike}']['total'] < total_intrinsic_value:
max_losses = intrinsic_values[f'{strike}']['total'] total_intrinsic_value = intrinsic_values[f'{strike}']['total']
max_pain = strike max_pain = strike
print('-----------------------------------------------') print('-----------------------------------------------')
print(f'time: {oi.timestamp}') print(f'expiry date: {expiry_date}')
print(f'max_pain: {max_pain}') print(f'max_pain: {max_pain}')
print(f'max_losses: {max_losses}') print(f'total intrinsic value: {total_intrinsic_value}')
print('-----------------------------------------------') print('-----------------------------------------------')
@ -931,8 +931,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] = []
intrinsic_values: dict[str, dict[str, Decimal]] = {} intrinsic_values: dict[str, dict[str, Decimal]] = {}
oi_by_strikes: dict[str, dict[str, Decimal]] oi_by_strikes: dict[str, dict[str, Decimal]]