File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 32
32
Union ,
33
33
)
34
34
35
+ from async_generator import aclosing
35
36
from bidict import bidict
36
37
import pendulum
37
38
import trio
@@ -316,6 +317,7 @@ async def trades_dialogue(
316
317
),
317
318
) as ws ,
318
319
trio .open_nursery () as n ,
320
+ aclosing (stream_messages (ws )) as stream ,
319
321
):
320
322
# task local msg dialog tracking
321
323
emsflow : dict [
@@ -339,7 +341,7 @@ async def trades_dialogue(
339
341
340
342
# enter relay loop
341
343
await handle_order_updates (
342
- ws ,
344
+ stream ,
343
345
ems_stream ,
344
346
emsflow ,
345
347
ids ,
@@ -351,7 +353,7 @@ async def trades_dialogue(
351
353
352
354
353
355
async def handle_order_updates (
354
- ws : NoBsWs ,
356
+ ws_stream : NoBsWs ,
355
357
ems_stream : tractor .MsgStream ,
356
358
emsflow : dict [str , list [MsgUnion ]],
357
359
ids : bidict [str , int ],
@@ -372,7 +374,7 @@ async def handle_order_updates(
372
374
# on new trade clearing events (aka order "fills")
373
375
trans : list [pp .Transaction ]
374
376
375
- async for msg in stream_messages ( ws ) :
377
+ async for msg in ws_stream :
376
378
match msg :
377
379
# process and relay clearing trade events to ems
378
380
# https://docs.kraken.com/websockets/#message-ownTrades
You can’t perform that action at this time.
0 commit comments