Resolution

All pages

Imports

The Import page reads a broker's own export and records each row as owner-attested history. The rows are what the broker reported. Nothing is recomputed, and nothing is booked that cannot be read with certainty.

Code: src/imports/ (brokers.ts holds the readers, csv.ts the CSV tokenizer, engine.ts preview and commit, ibkr-flex.ts the Flex XML reader and web service). View: web/views/imports.js.

Brokers

LayoutFileStatus
degiro-transactionsDEGIRO Transactions.csvverified
degiro-accountDEGIRO Account.csv (dividends, withholding, cash)verified
saxoSaxo trades / account exportverified
trade-republicTrade Republic transactions exportverified
buxBUX transactions exportverified
flatexFlatex (Windows-1252)community
trading212Trading 212 history exportcommunity
xtbXTB cash operations exportcommunity
revolutRevolut Invest statementcommunity
rabobankRabobank beleggen exportcommunity
ibkr-activityIBKR activity statement CSVcommunity
ibkr-flexIBKR Flex Query XMLcommunity
boleroBolero (Windows-1252)unverified

The Trading 212, XTB, Revolut, Rabobank and IBKR activity readers are adapted from Export-To-Ghostfolio (Apache-2.0). The DEGIRO, Saxo and BUX readers were cross-checked against the same project and corrected where the two disagreed. See THIRD_PARTY_NOTICES.md.

Every reader is tested against a recorded file in test/fixtures/imports/ (test/imports.test.ts, test/imports-oss.test.ts).

What each row becomes

  • A buy or sell: transaction.attested.
  • A dividend: dividend.recorded, with the tax withheld paired to it. A payment in lieu of a dividend and a return of capital carry subtype, so the tax page sends them to review instead of checking them against a treaty.
  • Deposits, withdrawals, interest and fees: cash.attested.
  • Anything else: skipped, with the reason shown in the preview.

Each import writes one import.recorded event. It carries the file name, counts, the layout's verification status and the flagged rows. Rows are fingerprinted, so importing an overlapping file again adds only what is new.

Flags: never reconciled automatically

A split, reverse split, merger, spin-off, symbol or ISIN change, rights issue, transfer in or out, cancelled trade, short position or derivative changes what the owner holds without an ordinary buy or sell. These rows are not booked. They appear in the preview as flagged rows with a code (corporate_action, transfer, discontinuity, unsupported) and an explanation, and they are kept in import.recorded.flags[]. The owner checks each one against the broker's statement and enters the result.

IBKR Flex Query XML

parseFlex reads a FlexQueryResponse:

  • Trade rows (stocks and funds; options, futures and similar are flagged)
  • CashTransaction rows: dividends, payments in lieu, withholding tax paired to its dividend, interest, fees, deposits and withdrawals
  • ConversionRate rows (used as euro rates only when the base currency is EUR)
  • CorporateAction and transfer rows, which are always flagged

It accepts one or several statements, in either the yyyyMMdd or yyyy-MM-dd date format and the ;, , or space date-time separators. The account number is masked (U…4567) in everything written to the Record. The schema knowledge (element and attribute names, reorg codes) comes from ibflex (MIT); the parser is new code.

Flex Web Service (scheduled, read-only)

With a Flex token and a query id, the server can fetch the statement itself:

  1. SendRequest with the token and query id returns a reference code.
  2. GetStatement is polled with that code: a first pause of 2 s, then 5 s, up to 12 polls. "Busy" codes wait, and the throttle code (1018) waits 10 s.
  3. The XML goes through the same preview and commit as an upload, with source: 'flex-web-service'.

flexPull runs at most once a day and is idempotent by statement date: a statement whose end date is already in the Record is not imported again. Errors are mapped to plain sentences (expired token, IP restriction, wrong query id). The token never appears in an error, a log line or the Record: redact strips it everywhere.

A Flex token can only read reports. It cannot trade, move money or log in. Resolution never asks for or stores a broker password.

Settings (environment or Settings): IBKR_FLEX_TOKEN, IBKR_FLEX_QUERY_ID, and IBKR_FLEX_PULL_HOUR (the UTC hour from which the daily pull runs, default 6). The schedule itself (the flex:<date> job, retries, reconciliation) is in operating.md.

ISIN to FIGI (OpenFIGI)

figiLookup(isins, options) in src/eu/instruments.ts maps ISINs to FIGI, ticker and exchange via the OpenFIGI v3 mapping API:

  • The built-in instrument table is tried first, then an in-memory cache, then <dataDir>/openfigi.json. Resolved answers are kept for 90 days, unresolved ones for about a week, and errors are not cached.
  • An EU listing is preferred: Euronext Amsterdam, Xetra, Paris, Brussels, Milan, Madrid and others, in that order, before the US.
  • An invalid ISIN (bad checksum) is refused before any call. An ISIN that OpenFIGI does not know is returned as unresolved. Nothing is guessed.
  • Rate limits are respected: 10 ISINs per request with a 2.5 s pause anonymously, or 100 with a 0.25 s pause with a key. On HTTP 429 it waits 60 s and retries once.
  • Key (optional): OPENFIGI_API_KEY.

Tests (test/openfigi.test.ts) inject fetch and never touch the network.