# print(list(s.book.iteritems())) # fdfdsfds s.book.use_trading_accounts = True # mtr = s.transactions(description="weird transaction") # print(mtr.ledger_str()) # print(mtr.calculate_imbalances()) # fdsfds for tr in s.transactions: if tr.description == "weird transaction": print(tr.ledger_str()) tr.splits = [sp for sp in tr.splits if sp.account.type != "TRADING"] before = tr.ledger_str() if any(tr.calculate_imbalances()[1]): print(before) tr.normalize_trading_accounts() print(tr.ledger_str()) s.save() fdsfdsfds with create_book("test_bitcoin.gnucash", overwrite=True) as s: root = s.book.root_account bitcoin = Commodity("CURRENCY", "XBT", "Bitcoin", 1000000) Account("My bitcoin account", "BANK", bitcoin, parent=root) s.save() fdsfds with open_book("../gnucash_books/default_book.gnucash") as s: