From cbc5168b8d44c55061f02ac9b9ef835f3d30ce2c Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Thu, 5 Dec 2024 23:43:13 -0300 Subject: [PATCH] renaming variable fixed variable name for better understanding. --- piker/brokers/deribit/api.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index 57861368..83e8b2a7 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -833,7 +833,7 @@ async def aio_open_interest_feed_relay( to_trio: trio.abc.SendChannel, ) -> None: - max_losses: Decimal = Decimal('Infinity') + total_intrinsic_value: Decimal = Decimal('Infinity') max_pain: Decimal = Decimal(0) async def _trade( @@ -859,7 +859,7 @@ async def aio_open_interest_feed_relay( ''' nonlocal intrinsic_values nonlocal oi_by_strikes - nonlocal max_losses + nonlocal total_intrinsic_value nonlocal max_pain 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) for strike in intrinsic_values: - if intrinsic_values[f'{strike}']['total'] < max_losses: - max_losses = intrinsic_values[f'{strike}']['total'] + if intrinsic_values[f'{strike}']['total'] < total_intrinsic_value: + total_intrinsic_value = intrinsic_values[f'{strike}']['total'] max_pain = strike print('-----------------------------------------------') - print(f'time: {oi.timestamp}') - print(f'max_pain: {max_pain}') - print(f'max_losses: {max_losses}') + print(f'expiry date: {expiry_date}') + print(f'max_pain: {max_pain}') + print(f'total intrinsic value: {total_intrinsic_value}') print('-----------------------------------------------') @@ -931,8 +931,7 @@ async def aio_open_interest_feed_relay( @acm async def open_oi_feed( ) -> to_asyncio.LinkedTaskChannel: - - expiry_date: str = '20DEC24' + expiry_date: str = '6DEC24' instruments: list[Symbol] = [] intrinsic_values: dict[str, dict[str, Decimal]] = {} oi_by_strikes: dict[str, dict[str, Decimal]]