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]]