diff --git a/fetch/banking-ib.py b/fetch/banking-ib.py index 37fe9ea..72a516f 100644 --- a/fetch/banking-ib.py +++ b/fetch/banking-ib.py @@ -531,6 +531,8 @@ if __name__ == "__main__": assert False, "unhandled option" lock() + + balances = {} if cached: print "[i] Cached run - will not connect to the bank" @@ -568,6 +570,10 @@ if __name__ == "__main__": cachefile.write(history) cachefile.close() history_logs[account_number] = history + balances[account_number] = (account["available_balance"],account["currency"]) + balancefile = open(CACHE_DIR+"/balance-"+account_number,'w') + balancefile.write("{} {}\n".format(account["available_balance"],account["currency"])) + balancefile.close() parsed = {} stats = {} @@ -587,7 +593,12 @@ if __name__ == "__main__": if noaction: print "[i] --no-action set, skipping row {}".format(row) session.commit() - + + if balances: + print "[i] Account balances:" + for account_number,v in balances.items(): + balance,currency = v + print "\t{}: {} {}".format(account_number, balance, currency) print "[i] Done: ", stats release() #print f.create_report().read()