From 733b58250f78dd99af5485e93697092462047943 Mon Sep 17 00:00:00 2001 From: Nelson Torres Date: Tue, 26 Nov 2024 15:15:51 -0300 Subject: [PATCH] open_oi_feed --- piker/brokers/deribit/api.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/piker/brokers/deribit/api.py b/piker/brokers/deribit/api.py index 15a9f88f..332681f6 100644 --- a/piker/brokers/deribit/api.py +++ b/piker/brokers/deribit/api.py @@ -831,6 +831,31 @@ async def aio_open_interest_feed_relay( await asyncio.sleep(float('inf')) +@acm +async def open_oi_feed( +) -> to_asyncio.LinkedTaskChannel: + + instruments: list[Symbol] + async with get_client( + ) as client: + instruments = await client.get_instruments() + + fh: FeedHandler + first: None + chan: to_asyncio.LinkedTaskChannel + async with ( + maybe_open_feed_handler() as fh, + to_asyncio.open_channel_from( + partial( + aio_open_interest_feed_relay, + fh, + instruments + ) + ) as (first, chan) + ): + yield chan + + # TODO, move all to `.broker` submod! # async def aio_order_feed_relay(