Common format for history export file (CSV)

I love and rely on your history exports to feed my accounts and reporting in Google Sheets.

It would be much simpler to automate the import and analysis of these history export downloads if you would adopt a common (18 column) CSV format to log Orders, Dividends and Transactions.

For example, (reporting in EUR) the 18 column headers would be:
Action, Time, ISIN, Ticker, Name, No. of shares, Price / share, Currency (Price / share), Exchange rate, Result (EUR), Total (EUR), Withholding tax, Currency (Withholding tax), Charge amount (EUR), Stamp duty reserve tax (EUR), Notes, ID, Currency conversion fee (EUR)

Appreciate the suggestion, @steve1943 - I’ve passed it along for consideration and will update the thread once I have more info :pray:

Agreed, sometimes if you export recent transactions that don’t have certain fields inputted, such as you purchased a US stock where Stamp Duty is non applicable the column wont be in your export, and when copy/pasting or importing the data in to your own spreadhseets this can place data in the wrong columns depending on how you process this.

Personally I just export 12 months every time now to alleviate this, as I will normally always have utilised all fields in a 12month periods.

An API to our data would be much more preferable though.

Want to add my voice to say that this would be a really great feature.

I currently extract my transactions to perform analysis and first have to check that the headers are all aligned first.

It would be great if the report could be standardised to remove this step

Hello,
Can you please start to standardize the history export columns in the .csv files?

I’ve noticed today you have added additional columns to the export, I assume this is a result of the multi currency feature being implemented? but its just a pain in the ass when using an export script to append new transactions to my spreadsheet and before this if a specific columm had no data to show in the export it would be missed out so again it would cause an issue merging.

Maybe my rudimentary way of appending to my spreadsheet is the problem, not sure if anyone else struggles with this issue.

It would be ideal if we could request a complete new export of our entire history periodically so we know the data isnt miss-aligned.

Thank you

I’ll run your feedback regarding the columns past the team, Scott. Thanks for sharing.

Edit: Dougal is correct about the history export.

I’m fairly certain you can do this in the History section of the app, it’s how I download my data into CSV.

You cannot request a full history, only 12 month intervals and this you get different column headers depending on your history and this makes appending new data to existing documents a pain.

I would also suggest including the “Trading Type” or the actual “Exchange” name. In most European countries profits are taxed differently depending on the exchange on which the transaction happened.
For example, sell transactions of Trading Type: TOTV (traded on a trading venue) is tax-free if it is a European exchange. But sell transactions of Trading Type: OTC (over-the-counter) are taxable.

Hi Kris, is there any update on this?
many of us use this feature to import trades etc in our own spreadsheets or reporting tools for analysis or tax reasons.

Currently working with T212 is very difficult as there is no consistent set of columns.
2 key issues cause problems 1 - which columns are shown changes, worse 2 - the order of the columns changes.

As an aside I would love to know how your system even does the second, as I would have assumed it would be harder to rearrange columns, then that a standard set.

Hope this can be resolved in the coming weeks, as it has been years already!

Many thanks!

Forgot about this, as I have come to terms with the fact T212 struggle to fix the simple stuff and are always on to the next big thing.

They really need a team dedicated to fixing the smaller user friendly requests, as they are always ignored and when bigger updates come through they make changes not many want changed.

I really like T212 but some of the simple things get overlooked too often.

Any update on this? I too am finding when i export different tax years of data the columns are arranged differently depending on what i traded. This makes it unnecessarily difficult to keep a track of your trades for the purposes of calculating CGT

I understand, why that would be desirable, but it seems to me like an issue that you can easily solve yourself. Quick python code for that:

#!/usr/bin/env python3

import csv
import sys
from pathlib import Path

TARGET_COLUMNS = [
    "Action",
    "Time",
    "ISIN",
    "Ticker",
    "Name",
    "No. of shares",
    "Price / share",
    "Currency (Price / share)",
    "Exchange rate",
    "Result (EUR)",
    "Total (EUR)",
    "Withholding tax",
    "Currency (Withholding tax)",
    "Charge amount (EUR)",
    "Stamp duty reserve tax (EUR)",
    "Notes",
    "ID",
    "Currency conversion fee (EUR)",
]


def main():
    if len(sys.argv) > 1:
        infile = open(sys.argv[1], newline="", encoding="utf-8-sig")
    else:
        infile = sys.stdin

    with infile:
        reader = csv.DictReader(infile)

        if reader.fieldnames is None:
            print("Error: CSV has no header row.", file=sys.stderr)
            sys.exit(1)

        source_columns = reader.fieldnames

        added = [c for c in TARGET_COLUMNS if c not in source_columns]
        removed = [c for c in source_columns if c not in TARGET_COLUMNS]

        if added:
            print(
                f"Added columns: {', '.join(added)}",
                file=sys.stderr,
            )
        else:
            print("Added columns: none", file=sys.stderr)

        if removed:
            print(
                f"Removed columns: {', '.join(removed)}",
                file=sys.stderr,
            )
        else:
            print("Removed columns: none", file=sys.stderr)

        writer = csv.DictWriter(
            sys.stdout,
            fieldnames=TARGET_COLUMNS,
            lineterminator="\n",
        )

        writer.writeheader()

        for row in reader:
            output_row = {col: row.get(col, "") for col in TARGET_COLUMNS}
            writer.writerow(output_row)


if __name__ == "__main__":
    main()

This will generated exactly the output as requested by the first post. I am not sure, if the output has changed since that post was made, but my columns are named differently and I have others, which would all be removed by the script. But the script tells you what it did, so you can check and adjust the column names in the script.

Usage:

python3 csv-convert.py < from_x_to_y_exported.csv > output.csv

Output:

Added columns: Result (EUR), Total (EUR), Charge amount (EUR), Stamp duty reserve tax (EUR), Currency conversion fee (EUR)
Removed columns: Gross Total, Currency (Gross Total), Currency conversion fee, Currency (Currency conversion fee), Merchant name, Merchant category, Taxes, Currency (Taxes), Net Total, Currency (Net Total), French transaction tax, Currency (French transaction tax)

Given that there is stamp duty, French transaction tax and probably more, such as Italy, there would be a lot of empty columns, so I understand they omit headers that don’t apply. I’d probably do post processing in python anyways. As long as we get all the data somehow, I am happy.