tariochbctools.importers.ibkr package

Submodules

tariochbctools.importers.ibkr.importer module

class tariochbctools.importers.ibkr.importer.Importer[source]

Bases: Importer

An importer for Interactive Broker using the flex query service.

account(filepath: str) str[source]

Return the account associated with the given file.

The account is used to determine the archival folder for the document. While the interface allows returning different accounts for different documents, normally the returned account is a just a function of the importer instance.

Parameters:

filepath – Filesystem path to the document being imported.

Returns:

An account name.

createBuy(date: date, account: str, asset: str, quantity: Decimal, currency: str, price: Decimal, commission: Amount, netCash: Amount, baseCcy: str, fxRateToBase: Decimal) Transaction[source]
createDividen(payout: Decimal, withholding: Decimal, asset: str, currency: str, date: date, priceLookup: PriceLookup, description: str, account: str) Transaction[source]
extract(filepath: str, existing: list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom]) list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom][source]

Extract transactions and other directives from a document.

The existing entries list is loaded from the existing ledger file, if the user specified one on the command line. It can be used to supplement the information provided by the document being processed to drive the extraction. For example to derive the prior state of the inventory.

Parameters:
  • filepath – Filesystem path to the document being imported.

  • existing – Entries loaded from the existing ledger.

Returns:

A list of imported directives extracted from the document.

getAssetAccount(account: str, asset: str) str[source]
getFeeAccount(account: str) str[source]
getIncomeAccount(account: str) str[source]
getLiquidityAccount(account: str, currency: str) str[source]
getReceivableAccount(account: str) str[source]
identify(filepath: str) bool[source]

Return True if this importer matches the given file.

Parameters:

filepath – Filesystem path to the document to be matched.

Returns:

True if this importer can handle this file.

matches(trx: CashTransaction, t: Any, account: str) bool[source]

Module contents