From d0530c4e26e52f9e30e1184fe30914f9d1630f38 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 11 May 2022 15:39:42 -0400 Subject: [PATCH] Deliver accounts from query instead of just pps with `ib` --- piker/brokers/ib.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index 20865e30..87281f31 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -2143,6 +2143,19 @@ async def trades_dialogue( accounts.add(msg.account) all_positions.append(msg.dict()) + # the account has no open positions (pps) so + # we just deliver the accounts def for now? + for value in client.ib.accountValues(): + account = value.account + if account not in accounts_def.inverse: + log.warning( + f'Client {client} defines an unknown account ' + '(not in brokers.toml):\n' + f'{account}' + ) + else: + accounts.add(accounts_def.inverse[account]) + await ctx.started(( all_positions, tuple(name for name in accounts_def if name in accounts),