Skip to content

Commit

Permalink
feat: IBKR add balance assertions for positions
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Jul 15, 2024
1 parent e06f53b commit f7d0864
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions beancount_reds_importers/importers/ibkr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,11 @@ def get_available_cash(self, settlement_fund_balance=0):
"""
ac = list(self.get_xpath_elements('/FlexQueryResponse/FlexStatements/FlexStatement/CashReport/CashReportCurrency'))[0]
return D(ac['slbNetCash'])

def get_balance_positions(self):
for pos in self.get_xpath_elements('/FlexQueryResponse/FlexStatements/FlexStatement/OpenPositions/OpenPosition'):
balance = {
'security': pos['isin'],
'units': D(pos['position']),
}
yield DictToObject(balance)

0 comments on commit f7d0864

Please sign in to comment.