This tool allows you to convert a multiple transaction exports (CSV) to an import file that can be read by Ghostfolio. Currently there is support for:
- DEGIRO
- eToro
- Finpension
- Freetrade
- Interactive Brokers (IBKR)
- Rabobank
- Schwab
- Swissquote
- Trading 212
- XTB
Is your broker not in the list? Feel free to create an issue or, even better, build it yourself and create a pull request! For more info, see contributing.
See the transaction export instructions for each of the supported brokers below.
View transaction export instructions
Login to your DEGIRO account and create an export file (via Inbox > Account Overview, see image below). Choose the period from which you wish to export your history and click download.
Login to your eToro account and navigate to "Portfolio". Then select "History" in the top menu. Next, click on the icon on the far right and select "Account statement". Choose the dates of interest and click "Create". On the next page, click on the Excel icon on the top right to download the file. After downloading, open the file in Excel and delete all the tabs except the "Account Activity" tab. Then use Excel to convert the file to CSV.
Login to your Finpension account. Select your portfolio from the landing page. Then to the right of the screen select “Transactions”, on the following page to the right notice “transaction report (CSV-file)” and click to email or click to download locally.
Open the Freetrade app. Select your portfolio from the option in the top-left under the "Portfolio" heading. Select "Activity" from the list of icons along the bottom of the screen. Select the share icon in the top-right corner and then follow the on-screen instructions.
Login to your Interactive Brokers account. Navigate to Account Management and click "Reporting" in the sidebar. Next, click on the "Flex Queries"-tab in the "Reporting" section. From the Flex "Queries section", Click the plus (+) icon on the right side to create a new Flex Query. Create a new Flex Query for Trades, and another one for Dividends. Set the export format to "CSV". See the required columns below the image.
For trades, select "Trades". Then select the following properties: Buy/Sell, TradeDate, ISIN, Quantity, TradePrice, TradeMoney, CurrencyPrimary, IBCommission, IBCommissionCurrency
.
For dividends, select "Cash Transactions". Then select the following properties: Type, SettleDate, ISIN, Description, Amount, CurrencyPrimary
.
Login to Rabobank and navigate to your investments. Navigate to "Transactions & Contract Notes" (Mutaties & Nota's). Select the range you wish to export at the top. Then scroll to the bottom of the page and click "Export as .csv"
Login to your Schwab account. Go to “Accounts” then “History”. Select the account you want to download details from. Select the “Date Range” and select “Export” (csv). Save the file.
Login to your Swissquote account. From the bar menu click on “Transactions”. Select the desired time period as well as types and then select the “export CSV” button to the right.
Login to your Trading 212 account and create an export file (via History > Download icon). Choose the period from which you wish to export your history and click download.
Login to your XTB account and from the top bar click on "Account history", then "Cash operations". Click the "Export button". Choose the period from which you wish to export your history, select report type "Cash Operations" choose file format "csv" then click "Export Report" button.
You can run the tool on your local machine by cloning this repository. You can also run the tool inside a Docker container. See the runtime specific instructions below.
View instructions
To run the Docker container you need to have Docker installed on your machine. The image is published to Docker Hub.
Contrary to the locally run version of the tool, the containerized version tries to determine which file type to process by looking to the header line inside the file. So there is no need to specify which converter to use.
You can then run the image like:
docker run --rm -v {local_in-folder}:/var/tmp/e2g-input -v {local_out_folder}:/var/tmp/e2g-output --env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx dickwolff/export-to-ghostfolio
The following parameters can be given to the Docker run command.
Command | Optional | Description |
---|---|---|
-v {local_in-folder}:/var/tmp/e2g-input |
N | The input folder where you put the files to be processed |
-v {local_out_folder}:/var/tmp/e2g-output |
N | The output folder where the Ghostfolio import JSON will be placed. Also the input file will be moved here when an error ocurred while processing the file. |
-v {local_cache_folder}:/var/tmp/e2g-cache |
Y | The folder where Yahoo Finance symbols will be cached |
--env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx |
N | Your Ghostolio account ID 1 |
--env USE_POLLING=true |
Y | When set to true, the container will continously look for new files to process and the container will not stop. |
--env DEBUG_LOGGING=true |
Y | When set to true, the container will show logs in more detail, useful for error tracing. |
--env FORCE_DEGIRO_V2=true |
Y | When set to true, the converter will use the DEGIRO V2 converter (currently in beta) when a DEGIRO file was found. |
--env PURGE_CACHE=true |
Y | When set to true, the file cache will be purged on start. |
--env GHOSTFOLIO_VALIDATE=true |
Y | When set to true, the tool with automatically validate the generated file against Ghostfolio. |
--env GHOSTFOLIO_IMPORT=true |
Y | When set to true, the tool will try to automatically import the generated file into Ghostfolio. |
--env GHOSTFOLIO_URL=http://xxxxxxx |
Y | The endpoint of your local Ghostfolio instance. E.g. http://192.168.1.15:3333 . Use ONLY with a local Ghostfolio instance! |
--env GHOSTFOLIO_SECRET=xxxxxxx |
Y | The credentials of your Ghostfolio user. Used to authenticate with the import API endpoint. Use ONLY with a local Ghostfolio instance! |
Use this option if you wish to run using an isolated docker environment where you have full control over the image and thus can trust it to contain only what is expected.
Clone this repository to your system and then run:
docker build -t export-to-ghostfolio .
docker run --rm -v {local_in-folder}:/var/tmp/e2g-input -v {local_out_folder}:/var/tmp/e2g-output --env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx -t export-to-ghostfolio
You can use the same options as above for using the image on Dockerhub
The tool uses cacache
to store data retrieved from Yahoo Finance inside the container. This way the load on Yahoo Finance is reduced and the tool should run faster. The cached data is stored inside the container in /var/tmp/e2g-cache
. If you feel you need to invalidate your cache, you can do so by adding --env PURGE_CACHE=true
to your run command. This will clear the cache on container start, and the tool will recreate the cache the next time it has to retrieve data from Yahoo Finance.
View instructions
The tool requires you to install the latest LTS version of Node, which you can download here. The tool can run on any OS on which you can install Node.
Next, clone the repo to your local machine and open with your editor of choice (e.g. Visual Studio Code).
Run npm install
to install all required packages.
The repository contains a sample .env
file. Rename this from .env.sample
.
- Put your export file path in the
INPUT_FILE
variable. This has to be relative to the root of the project. - Put the Ghostfolio account name where you want your transactions to end up at in
GHOSTFOLIO_ACCOUNT_ID
- Optionally you can enable debug logging by setting the
DEBUG_LOGGING
variable toTRUE
.
You can now run npm run start [exporttype]
. See the table with run commands below. The tool will open your export and will convert this. It retrieves the symbols that are supported with YAHOO Finance (e.g. for European stocks like ASML
, it will retrieve ASML.AS
by the corresponding ISIN).
Exporter | Run command |
---|---|
DEGIRO | run start degiro |
eToro | run start etoro |
Finpension | run start finpension (or fp ) |
Freetrade | run start freetrade (or ft ) |
IBKR | run start ibkr |
Rabobank | run start rabobank |
Schwab | run start schwab |
Swissquote | run start swissquote (or sq ) |
Trading 212 | run start trading212 (or t212 ) |
XTB | run start xtb |
The tool uses cacache
to store data retrieved from Yahoo Finance on disk. This way the load on Yahoo Finance is reduced and the tool should run faster. The cached data is stored in /var/tmp/e2g-cache
. If you feel you need to invalidate your cache, you can do so by removing the folder and the tool will recreate the cache when you run it the next time.
The export file can now be imported in Ghostfolio by going to Portfolio > Activities and pressing the 3 dots at the top right of the table. Since Ghostfolio 1.221.0, you can now preview the import and validate the data has been converted correctly. When it is to your satisfaction, press import to add the activities to your portfolio.
We welcome any contribution to the repository. Feel free to create an issue or, even better, build it yourself and create a pull request!
The tool can be run two ways, manually and via Docker. Both entrypoints of the tool can be found in the ‘src/‘ folder. The tool uses a mock in the tests, which allow the tests to be run in a consistent and repeatable manner. This way there is no necessity for a live Yahoo Finance service. The mock was added because of inconsistencies in between test runs and rate-limiting issues with Yahoo Finance (with multiple consequetive runs, especially when running locally).
Whenever you add a new converter or create a fix for an existing one, please refer to the Wiki for instructions on how to extend the mock with testdata.
Footnotes
-
You can retrieve your Ghostfolio account ID by going to Accounts > Edit for your account and copying the Account ID field ↩