Skip to content

RAW format

cgt-calc reads a simple seven-column CSV when your broker is not supported or when you need to add a supported event that its export does not identify. You write this file yourself from the broker's records; it is not the CSV that a broker supplies. For a transfer to or from a spouse or civil partner, a gift you made or received, an inheritance, or income an accumulation fund keeps, start with Transfers, gifts and fund income.

Create the CSV

Start the file with this header line:

date,action,symbol,quantity,price,fees,currency

The columns are:

Column Value
date Transaction date in YYYY-MM-DD format
action One of the documented actions; write the name in uppercase
symbol Instrument ticker; leave blank only where the action table allows it
quantity Number of shares or units, positive except where the action table says otherwise; use 1 when price holds the full cash amount
price Price per unit, or the full cash amount (positive or negative) when quantity is 1
fees Positive fees deducted from the cash amount; leave blank or use 0 when there are none
currency Three-letter currency code for the price, fees and resulting amount, such as USD

The header is required, because cgt-calc reads each value by the column the header names for it. The columns can come in any order, and letter case and spaces around a name do not matter; each row gives its values in the header's order. A file without the header, or with a column missing, named twice or not listed here, stops the run, and the message says what to change. The example rows on this page, and rows cgt-calc prints for you to add, follow the order above, so if your header lists the columns in another order, put each value under its column.

Two optional columns, broker and replaces, can be added when a row has to join a broker export or correct one of its rows. See Correct a row in a broker export. A third, market, says whether a ticker is a US or a London one: see Say which market a ticker is from.

A space before or after a value is ignored, so you can leave one after each comma.

Here is a complete small example:

date,action,symbol,quantity,price,fees,currency
2024-01-02,TRANSFER,,1,1000.00,0.00,GBP
2024-01-03,BUY,ACME,100,7.50,5.00,GBP
2024-06-01,DIVIDEND,ACME,100,0.04,0.00,GBP
2025-01-03,SELL,ACME,25,8.20,5.00,GBP

You can also compare the format with the tested example.

How the cash amount is calculated

The format has no separate amount column. For every action except BUY, cgt-calc calculates:

amount = quantity × price − fees

For BUY, it makes quantity × price negative first and then subtracts the fees. Enter positive quantities, positive unit prices and positive fees for ordinary purchases and disposals; cgt-calc therefore records the total cost of a purchase as negative and the net proceeds of a disposal as positive.

cgt-calc refuses a negative price on a row that acquires or sells shares, and negative fees on any row. A negative price turns a cost or proceeds the wrong way round, and negative fees move them the wrong way. The error names the row.

For a cash-only row, use quantity 1 and put the full amount in price: positive for money received and negative for money paid. A £250 deposit and a £40 withdrawal look like this:

2024-02-05,TRANSFER,,1,250.00,0.00,GBP
2024-03-14,TRANSFER,,1,-40.00,0.00,GBP

A positive amount on a DIVIDEND_TAX or INTEREST_TAX row is refused; enter tax still withheld as a negative price. If part of the tax for that payment was refunded, enter only the amount still withheld. The one exception is a row that replaces a refund in a broker export: it states the refund as the export does.

Do not leave quantity or price blank. On a row that moves cash, such as a trade, dividend, deposit or withdrawal, cgt-calc then has no amount to apply and stops with Price missing or Quantity missing, naming the blank cell.

If a STOCK_ACTIVITY row has no price, cgt-calc looks it up by ticker and date in the share prices and reads it in the row's currency. If there is none, the run stops with No share price: enter the market value per unit in price. Any fees on a STOCK_ACTIVITY row, such as a cost of having the shares transferred to you, are added to the cost of the shares, but not taken from your cash balance.

Actions to use

Use the following action names when writing a RAW file.

Action What to enter
BUY Ticker, positive quantity and positive unit price. fees increases the cash cost and allowable acquisition cost.
SELL Ticker, positive quantity and positive unit price. fees reduces the cash proceeds and gain.
STOCK_ACTIVITY Shares acquired without paying cash, such as a vest: ticker, quantity and market value per unit. For a gift or an inheritance, see Shares you were given or inherited.
DIVIDEND Ticker and gross dividend. Use the actual shares and dividend per share, or use quantity 1 and the gross total as price.
DIVIDEND_TAX Ticker, quantity 1 and the tax deducted as a negative price.
INTEREST Interest received: leave symbol blank, use quantity 1 and the gross total as a positive price.
INTEREST_TAX Tax deducted from interest: leave symbol blank, use quantity 1 and the deduction as a negative price.
TRANSFER Cash added or removed: leave symbol blank, use quantity 1, and use a positive price for a deposit or a negative one for a withdrawal.
ADJUSTMENT A cash-only correction or charge: write it like TRANSFER. It affects the balance but no holding or taxable income.
FEE A cost that should increase one holding's pooled cost: enter its ticker, quantity 1, the charge as a negative price, and fees 0.
CASH_MERGER, FULL_REDEMPTION A disposal for cash: write it like SELL. Use only when no replacement shares were received.
STOCK_SPLIT Ticker, the change a reorganisation made to your entire pooled holding, negative for a consolidation, price 0 and fees 0; see Share reorganisations.
SPIN_OFF New ticker, quantity received, price 0 and fees 0; cgt-calc works the rest out itself, as described below.
TRANSFER_TO_SPOUSE See Transfers to a spouse or civil partner.
TRANSFER_FROM_SPOUSE See If you received the shares.
GIFT, GIFT_UNCONNECTED See Gifts to anyone else.

For a reinvested dividend, write two rows in this order: a DIVIDEND for the income, then a BUY for the shares bought with it. Excess Reported Income uses the separate ERI_RAW format, not this file.

A FEE adds the charge to that holding's cost, which reduces a later gain, and takes it out of the cash balance. Choosing FEE does not make a charge an allowable cost. Use it only for an amount HMRC treats as spent on a holding you already have without giving you new shares, such as income reinvested in accumulation units of a UK fund. For anything else:

  • Put a commission or other cost of one purchase or sale in the fees column of that BUY or SELL row, so that it counts towards that trade.
  • Record a custody, ADR, platform or account charge as an ADJUSTMENT.

If you are unsure, use ADJUSTMENT: it takes the money out of the balance without touching any cost, which is the safer way to be wrong.

For a SPIN_OFF, cgt-calc needs to know which holding the new shares came from. It looks the new ticker up in --spin-offs-file, asks you when it is not there, and saves your answer to that file so it only asks once; a run that cannot ask, such as one in a script, stops and tells you how to supply the row yourself. It then looks up a closing price for the new and the old ticker on that date to divide the old holding's pooled cost between them, so a price for both has to be available: from Yahoo Finance, or given for both in a file passed with --prices-file.

Date the SPIN_OFF row on the first day both shares trade normally on their own. The company or exchange usually announces it as the ex-date, and it can be a day after the distribution or payment date. HMRC divides the cost by the two holdings' values on that day (CG52002); before it, the old shares' price still includes the new ones. For example, GE paid out GE HealthCare shares on 3 January 2023, but normal trading in them began on 4 January, so the row belongs on 4 January. If you also bought or sold the old shares that day, cgt-calc stops, because it cannot tell whether the trade came before or after the spin-off.

Generate the report

For the tax year 2024/25, run:

cgt-calc --year 2024 raw_data.csv

cgt-calc recognises a RAW file from its header row. --year 2024 means 6 April 2024 to 5 April 2025. Follow Generate a report to find and check the output.

You can also pass the file with --raw-file raw_data.csv, which reads it as a RAW file without recognising it first.

Include cash deposits and withdrawals if your records contain them so the balance check can detect an incomplete conversion. If the source genuinely has no cash history, use --no-balance-check only after checking that every acquisition, disposal, income payment, fee and corporate action is present.

The order of rows on one date

The date column carries no time, so within a single day the order you write the rows in is the only record of what happened first. Write each day's rows in the order the transactions actually happened, and give every quantity and price in the units that were in force at that moment.

This matters most on the day of a share split, because the change a STOCK_SPLIT row states (see Share reorganisations) depends on how many shares you held when it ran. Say you held 11 shares and sold 5 that morning. Six shares went into a 20-for-1 split and became 120, so the split created 114, and the sale above it is written in pre-split shares at the pre-split price:

2022-06-06,SELL,AMZN,5,2400.00,0.00,USD
2022-06-06,STOCK_SPLIT,AMZN,114,0.00,0.00,USD

Had you sold after the split instead, all 11 shares went into it and became 220, so the split created 209, and the sale below it is written in post-split shares at the post-split price:

2022-06-06,STOCK_SPLIT,AMZN,209,0.00,0.00,USD
2022-06-06,SELL,AMZN,100,120.00,0.00,USD

Same-day chronology across inputs

Within one RAW file the row order settles which units a same-day trade is stated in. Between two inputs it does not, and neither does the order cgt-calc merges them in. For a trade from another input, cgt-calc uses the time of day instead, but only when both the trade and the reorganisation have one. Without times, cgt-calc cannot tell the order even of two rows in the same broker export.

A trade timed after the reorganisation is in the new units. A trade timed before it is in the old units, but only if the reorganisation is exported as two timed rows, such as Trading 212's Stock split close and Stock split open. Any other same-day trade stops the run with cannot be placed either side of it, which explains how to move that day's rows into this file.

cgt-calc has no way to check the order you wrote. A sale placed on the wrong side of a STOCK_SPLIT row is refused when its quantity only makes sense on the other side, but a quantity that is plausible in both unit systems computes without complaint and gives wrong figures. After a run, check the report's reorganisation entry: it states the unit counts either side of the event, so a sale that landed in the wrong units shows up as a count you do not recognise.

This is about the RAW file you write yourself. cgt-calc assumes nothing about the order of the rows inside a broker's own export, so if you keep a small RAW file alongside a broker export, it is the RAW rows that need to be in the order things happened.

Share reorganisations

A stock split or a share consolidation restates a holding: the old shares are not disposed of and the new ones are not acquired, so no gain or loss arises and the pooled cost is unchanged (TCGA 1992 s127, CG51805). Only the number of units changes, so a later disposal takes a different share of the same cost.

The quantity is the change the event made to your holding, not the total you hold afterwards. Your broker's statement usually gives the total, so subtract what you held: 11 shares through a 20-for-1 split become 220, and the row says 209.

2022-06-06,STOCK_SPLIT,AMZN,209,0.00,0.00,USD

Writing the total instead is not something cgt-calc can catch: 220 reads as a plausible 21-for-1 split of the same 11 shares, and every later figure for the holding comes out wrong.

A consolidation shrinks the holding, so its quantity is negative: 100 shares consolidated 100-for-1 lose 99.

2026-02-02,STOCK_SPLIT,RKT,-99,0.00,0.00,GBP

Leave price and fees at 0: nothing is bought, sold or paid for. cgt-calc refuses a STOCK_SPLIT row that states either, rather than dropping the figure without telling you. A reorganisation row in a broker export is held to the same rule, and its amount column counts too: some exports state an amount with no price beside it, and that money is refused rather than dropped.

Cash in lieu of a fractional entitlement

A consolidation rarely divides evenly. cgt-calc keeps whatever fraction of a unit the arithmetic leaves, which is right only if you still hold it. Where the registrar sold the fraction and paid you the cash instead, the payment is consideration under TCGA 1992 s128(3): a part disposal of the holding, whose cost is apportioned under s129 rather than identified against acquisitions the way a sale of shares is (CG51875). Where the payment is small, s122(2) can instead treat it as no disposal at all and deduct the payment from the holding's pooled cost. HMRC generally accepts a payment as small when it is no more than 5% of the holding's value or no more than £3,000 (CG57835, CG57800).

cgt-calc does not model either treatment explicitly. For a reorganisation into one class, HMRC permits the s129 cost to be apportioned by the number of shares sold (CG51892), and a SELL row for the fraction and payment gives that result if no shares of the same class are acquired that day or in the following 30 days. If there is such an acquisition, ordinary share identification matches the SELL against it and uses its cost instead, which is wrong for s128(3). If you cannot establish that this condition holds, record no row for the payment. Without a row, the pool keeps both the sold fraction and cost that should have been removed or reduced, so correct its quantity, cost and later figures by hand (consider professional advice).

Holdings spread across brokers

If you hold the same security through more than one broker, add up their holdings before working out the number, which is the change to all of them together. A broker's own export states the change to its own account, and adding that to a pool built from several would restate the holding by a ratio that was never the corporate one. cgt-calc refuses a broker's single-row split when the pool has units from another source, and says so.

A RAW STOCK_SPLIT row is the answer to that refusal, and you do not have to edit the broker export to use it: where a date has both, the RAW row states the change to the whole holding, so cgt-calc uses it and ignores the broker's own row for the same event. The exception is a day on which a broker export also has another row that changes how much of that security you hold, such as a purchase, sale, vest, reinvested dividend or transfer. The RAW STOCK_SPLIT row has no time of day, so cgt-calc cannot tell whether the broker's row came before or after it, and stops with cannot be placed either side of it until you move the day's rows into this file.

Which accounts a holding is built from is remembered until a day closes with the whole pooled holding at zero, and a ticker rename carries the record to the new name along with the holding. So after one account sells all of its units, a single-row split reported by the other is still refused until that happens: cgt-calc does not track which account each remaining unit came from, so it will not assume they are all at the reporting one. The RAW row above is the answer there too.

Combining RAW with a broker export

A RAW row is assigned to a separate broker called Unknown unless its broker column names another. A complete history converted to RAW can therefore reconcile its own cash. With the broker left blank, its cash balance and interest stay separate from a broker's export. In particular, such a RAW DIVIDEND_TAX is not attached to that broker's dividend, and such a RAW deposit does not fund a purchase in that broker's balance. Dividends themselves are pooled by ticker and date across every broker, so a payment entered here that is already in the export is added to it rather than listed separately.

To add a row to a broker's own balance and dividends, or to replace a row that the broker's export got wrong, see Correct a row in a broker export.

Non-cash rows such as a spouse transfer can be supplied alongside a broker export as Transfers, gifts and fund income describes. For a correction that Correct a row in a broker export does not cover, make it in a working copy of the export, make sure the original activity is not also imported, and check both the final holdings and each broker balance. Keep the downloaded export unchanged for your records.

cgt-calc reads one RAW file in a run. Keep every row you write yourself in that file: a second RAW file stops the run.

Correct a row in a broker export

Two optional columns let a RAW row correct a broker export without editing it. Add them to the header, usually after the seven:

date,action,symbol,quantity,price,fees,currency,broker,replaces

You can add broker alone if no row replaces another. Leave both cells blank on a row that does not use them.

Add a row to a broker's records

Put the broker's name in broker, as the terminal lists it under Final balance: for example Charles Schwab, Interactive Brokers or Trading212. Letter case and spaces do not matter, so trading 212 works too. The row then joins that broker's cash balance, and a DIVIDEND_TAX row is matched to that broker's dividends. The name has to be that of another input in the same run: any other name stops the run and lists the names you can use. A blank broker keeps the row in the RAW file's own Unknown balance, as before.

Replace a row of the export

When a row of the export is wrong, a RAW row can take its place. Name the broker and put the date of the export row in replaces; the other columns hold the corrected row. Two kinds of row can be replaced:

  • Dividend tax (DIVIDEND_TAX). The row keeps the export row's amount and currency and moves it to another date. Use it when cgt-calc warns that tax “could have been taken from the dividend on” either of two dates, and date the tax on the dividend it belongs to, as your broker's statement shows.
  • A vest (STOCK_ACTIVITY). The row keeps the export row's quantity and can change its date and its price. Use it when your employer taxed the shares on another day than the one cgt-calc uses: Which day a vest is dated in the Schwab guide says why, and Correct several vests how. If the shares were split or consolidated between the two dates, the quantity is in the wrong units for the new date and cgt-calc does not always detect it: edit the vest in a working copy of the export instead. A row can also give a Schwab vest with no price its date and price when you have no award file: see Vests without an award file.

Say Schwab withheld a further 5 dollars of tax on 27 June 2024 that belongs to the dividend of 3 June. Schwab's row is replaced by one dated on the dividend:

2024-06-03,DIVIDEND_TAX,FOO,1,-5.00,0.00,USD,Charles Schwab,2024-06-27

A refund is positive in the export, and is positive here too. For a vest of 60 shares that cgt-calc dates 12 June 2023 but your employer taxed on 15 June at 22 dollars a share:

2023-06-15,STOCK_ACTIVITY,ZQX,60,22.00,0.00,USD,Charles Schwab,2023-06-12

cgt-calc replaces the export row with the same broker, action and symbol, dated on the replaces date and with the same quantity (a vest) or the same amount and currency (tax). The date is the one cgt-calc uses for the row, which is not always the date in the file: for a Schwab vest priced from your award file it is the Date of the vest's Lapse row, and for one with no price it is the day Schwab posted it. To see every row with the date cgt-calc uses, run with --dump-transactions. The dump is saved before any replacement, so it shows the export row and your RAW row side by side, not which one the calculation used. To correct several Schwab vests, see Correct several vests.

The run names each replacement:

Using RAW row 2 (DIVIDEND_TAX FOO on 2024-06-03) in place of the Charles Schwab row dated 2024-06-27 (row 4 of schwab.csv)

When cgt-calc refuses a replacement

A replacement that cgt-calc cannot place stops the run, rather than adding the row a second time. The error names the RAW row:

  • Cannot find the ... row this ... row replaces: no export row matches. The error lists that broker's rows nearest the date, with the dates cgt-calc uses. Check the replaces date and the quantity or amount.
  • Cannot find a ... row left: two RAW rows replace the same export row. Remove the repeated one.
  • Several ... rows match this replacement and they differ: the export has more than one matching row, and they differ in ISIN or market or, for a vest, in price, fees, currency or account, so cgt-calc cannot tell which you mean. Edit the row in a working copy of the export instead. Matching tax rows that differ only in account are interchangeable, and one of them is replaced.
  • A ... row cannot replace a row of a broker export: only dividend tax and vests can be replaced. Edit a working copy of the export for anything else.
  • Cannot replace the ... vest ... in units after the ... split: cgt-calc reads each vest in a Schwab Equity Awards export in units after the later splits of NVIDIA and Alphabet shares. A vest of NVDA before 10 June 2024, or of GOOG or GOOGL before 16 July 2022, is therefore in units that did not exist on its date, and so is a RAW row that would move a later vest to before the split. A RAW row on that date would count the wrong number of shares. Edit the vest's date and price in a working copy of the Equity Awards export instead, keeping its quantity, and give the price per share in the units the export uses.
  • Cannot replace the ... vest ..., which has no price in the Schwab history: your row is all cgt-calc has for the vest's cost, so it needs a price above zero, USD as its currency and no fees. A split or consolidation of the share on either date or between them is refused as well, if your main history records it or it is an NVIDIA or Alphabet split that cgt-calc already knows of: the vest's quantity may be in the wrong units for your row's date. Edit the vest's date, quantity and price in a working copy of the history instead.
  • Several ... vests match this replacement and none has a price: Schwab posted two vests of the same quantity on the same day, and nothing tells them apart. Pass the award file, or edit the vests in a working copy of the history.
  • The broker '...' is not the broker of any other input: correct the name to that of a broker export in the same run. You can leave broker blank only if the row does not replace an export row; it then stays in the RAW file's own Unknown balance.
  • A row that replaces a row of a broker export names that broker: fill in broker.

Say which market a ticker is from

A ticker names a security only on one market. OPEN, for example, is Opendoor in the US and an iShares fund in London. cgt-calc's bundled ISIN list gives funds based outside the US their London tickers, and cgt-calc adds a fund's excess reported income to your holding. When nothing in your files says which security such a ticker is, cgt-calc takes the fund and, for a ticker that is also a US symbol, warns: see Tickers that are also US symbols.

Add a market column to say where each row's security is listed:

Value Meaning
US A US symbol, on an exchange such as the NYSE or Nasdaq, or over the counter
LSE A ticker on the London Stock Exchange, AIM included
blank Not known, as for a row without the column

Letter case does not matter. Any other value stops the run with Unknown market; for a security listed elsewhere, leave the cell blank.

date,action,symbol,quantity,price,fees,currency,market
2022-05-03,BUY,OPEN,100,2.00,0.00,GBP,US
2023-01-31,SELL,OPEN,40,3.00,0.00,GBP,US

With US, cgt-calc does not match OPEN to the London fund, so the fund's income is not added. With LSE, the fund's income is added. Either way, cgt-calc does not warn.

A market applies to the ticker across the whole run, because all rows under one ticker are one holding: rows whose market is blank, in this file or another input, share it. A row in an ISIN translation file that you wrote still applies whatever the market says.

A market also tells cgt-calc that an old ticker is a renamed company's where another exchange used the ticker for another security: an RMG row marked LSE is read as Royal Mail's IDS, and an MMC row marked US as Marsh & McLennan Companies' MRSH. A row whose market is blank is read from the rest of your files. See Renames kept to one market.

Four refusals protect a holding from being pooled with another security:

  • is from market ... on another row: one ticker has rows of both markets, for example an LSE row beside a Charles Schwab row, which is always US. See is from market.
  • is a London ticker on this row: an LSE row uses a London ticker of a bundled fund, and another export gives the ticker the ISIN of something else. See is a London ticker on this row.
  • names no ISIN or market on this row: a row with a blank market uses a renamed company's old ticker, such as RMG, and the rest of your files show both that company and another security under it. See Renames kept to one market.
  • has no ISIN on this row and no market: a row with a blank market uses GDX, SMH, WCLD or DFNS, and no other row gives the ticker a market. Another export, such as Trading 212's, gives the ticker to General Dynamics or a fund's London line, while in the US it is another security's symbol. See has no ISIN on this row and no market.

Known limitations

  • The format has no ISIN or source-country column. For a dividend with withholding tax, when cgt-calc cannot match the ticker to a known ISIN, it guesses the source country from the currency when possible: USD is treated as US and PLN as Poland. An investment domiciled elsewhere can consequently receive the wrong treaty treatment without a source-country warning; that warning is issued only when withholding tax was deducted and cgt-calc cannot infer a country from the currency. Verify foreign dividend income and tax against the broker statement rather than assuming that treaty limits were applied.
  • For the same reason, a ticker that is both a London fund's and a US security's, such as OPEN, is matched to the fund, with a warning, unless the row's market says which. See Say which market a ticker is from.
  • The format does not identify the instrument type. It is intended for ordinary shares and funds; do not rely on it for options, futures, bonds, contracts for difference, crypto assets or another instrument whose UK tax treatment differs.
  • The seven columns cannot describe every internal action. Ticker renames and cancelled purchases are examples that a RAW row cannot express; use only the documented actions above.

Troubleshooting

To report a problem with a RAW file, follow Reporting problems and redact the file as it describes.

Unknown action

Use an action from Actions to use. Do not copy another name from the cgt-calc source code: some actions exist only for broker imports and a RAW row cannot supply their additional data. For a real event that the table does not cover, do not force it into the nearest-looking action. Verify its UK tax treatment and, if cgt-calc should support it, open an issue as Reporting problems describes.

Price missing or Quantity missing

The row leaves the named cell blank, so cgt-calc cannot calculate its amount from quantity and price. Fill in both cells: when both are blank, the error names only price. For a cash-only action, set quantity to 1 and put the full amount in price: positive for money received and negative for money paid. See How the cash amount is calculated.

A header or column-count error

Start the file with a header that names the seven columns from Create the CSV, each once and in any order, and the optional broker and replaces columns and market column if you use them. If the message lists a missing or unknown name, correct that name where it stands rather than pasting a new header over it. Every row has as many cells as the header, blank where a row does not use them, and gives its values in the header's order, so keep every comma, including the empty symbol field in a cash row. Save the file as UTF-8 CSV rather than converting a PDF or pasting a formatted currency value such as £1,000 into one field.

Reached a negative balance for broker Unknown

Check the sign of every cash row and include the deposits, sales and income that funded later purchases or withdrawals. If this RAW file supplements a named broker export, remember that their balances are separate unless a row names that broker in its broker column; see Correct a row in a broker export.

Tried to sell

Include the earlier acquisition and any split, spin-off or transfer that established the holding. Use the same ticker throughout unless the broker-specific history supplies a supported rename, and prefer the security's current ticker: an old one that another security has since taken, such as FB, stops the run when one file's rows fall on both sides of that day. The check covers one file at a time, so FB rows in separate files are each read by their own date without an error. Check the final portfolio and every disposal against the broker records rather than adding a made-up purchase to make the calculation run.

If the message says the same file buys the shares lower down the same date, the holding runs short only because the sale is written above that purchase. cgt-calc reads the rows of one date in the order you wrote them, as the order the trades happened, and checks the holding after each row. This can happen when rows copied from a statement that lists the newest first are then sorted by date, which leaves each day's rows reversed. Check your broker's records for the order the trades really happened in:

  • If the purchase came first, write it above the sale.
  • If the sale came first, keep that order and do not move the purchase above it. Unless it was a short sale, of shares you did not yet hold, the shares it sold were already held, so look for the missing acquisition as described above. cgt-calc does not accept a short sale in a RAW file.

also has units from on a STOCK_SPLIT row

A broker's own split row states the change at that one account, and the holding also has units that another input put there, so applying it to the whole pool would restate the holding by a ratio that was never the corporate one. Add up the holdings across your accounts and write one RAW STOCK_SPLIT row stating the change to all of them together; where a date has both, the RAW row is used and the broker's own row for the same event is ignored. See Holdings spread across brokers.

cannot be placed either side of it

A same-day row changes the quantity of the security, but cgt-calc cannot establish whether that quantity uses the units before or after the reorganisation. This happens across separate inputs, within a broker export whose row order is not a record of what happened first, and when a timed row falls at or between the two timestamps of a paired reorganisation. If you know the real order, move that day's rows for the symbol out of working copies of their exports and into your RAW file in that order, with the reorganisation as one STOCK_SPLIT row stating the change to the whole holding (see Share reorganisations). Otherwise, work that day out by hand and leave its rows out.

Moving a row moves its cash too: RAW rows keep a balance of their own, separate from the broker's (see Combining RAW with a broker export). So that the balance check still passes:

  • For each purchase you move, add a TRANSFER row on the same date depositing its cost, in the same currency.
  • A sale you move takes its proceeds out of the broker's balance. If they paid for a later purchase there, the run stops with Reached a negative balance for that broker. Add them back as a deposit in the working copy of that export, and add a TRANSFER row on the same date taking them out of your RAW file. If that export has no row for a deposit, run with --no-balance-check instead, once you have checked that the shortfall is only those proceeds.