A tool to convert financial data for Firefly III
Project description
Firefly Cash Converter
A Python tool for converting financial transaction data from various sources (Barclays, PayPal, Trade Republic, etc.) and transferring them to Firefly III personal finance manager.
Prerequisites
- Python >= 3.11
- A running Firefly III instance (for the
transfercommand)
Installation
Install directly from the GitHub repository:
pip install git+https://github.com/phdorp/gnucash-convert.git@main
This will install the cash command-line tool for converting and transferring financial transactions.
Configuration
For the transfer command, you need a config.toml file with your Firefly III instance details. Create one based on this template:
[firefly_interface]
base_url = "http://your-firefly-instance"
api_token = "your-api-token-here"
duplicate_transaction = "ignore" # options: "error", "ignore"
See the examples/config.toml file for reference.
Usage
The tool provides two main commands: convert and transfer.
Supported Sources
| Source | Convert | Transfer |
|---|---|---|
barclays |
✓ | ✓ |
paypal |
✓ | ✓ |
trade_republic |
✓ | ✓ |
common |
✗ | ✓ |
Convert
The convert command converts transaction data from various sources to a common CSV format compatible with Firefly III:
cash convert <source> <input_file> [options]
Options:
source: Source format (choices:barclays,paypal,trade_republic)input_file: Path to the input file to be converted (without file extension)--output: Output directory (default: current directory)--file_name: Output file name without extension (default:transactions)--account_name: Name of the account to assign to transactions--filter_query: Optional pandas query to filter transactions (see Filter Queries)
Example:
Change directory to the examples directory.
The following command transforms the transactions stored in tmp/trade_republic.csv to the common Firefly representation.
Only transactions after the date 2025-07-01 are converted.
cash convert trade_republic tmp/trade_republic --account_name "My Trading Account" --filter_query "date >= '2025-07-01'"
Transfer
The transfer command loads transaction data and directly transfers it to your Firefly III instance via API:
cash transfer <source> [options]
Options:
source: Source format (choices:barclays,paypal,trade_republic,common)--config_path: Path to configuration file (default:./config.toml)--account_name: Name of the account to assign to transactions--input_directory: Directory containing input files (default:tmp)--input_name: Name of the input file (defaults to source name)--filter_query: Optional pandas query to filter transactions (see Filter Queries)
Example with manual file:
Change directory to the examples directory and launch your Firefly server.
Adapt the file config.toml to your needs.
The following command transfers transactions after the date 2025-07-01 to your Firefly server:
cash transfer trade_republic --account_name "My Trading Account" --filter_query "date >= '2025-07-01'"
Example with Pytr (Trade Republic):
If you own a Trade Republic account, you can download your transaction data with the pytr package:
pip install pytr
The following command enables an almost automated transfer of your transaction data (2FA code must be entered manually):
pytr export_transactions tmp/trade_republic.csv --store_credentials --format csv
cash transfer trade_republic --account_name "My Trading Account"
Filter Queries
The --filter_query option accepts pandas query expressions for filtering transactions. Common examples:
- Filter by date:
"date >= '2025-07-01'" - Date range:
"date >= '2025-01-01' and date <= '2025-12-31'" - Amount filters:
"amount > 100"or"amount < 0"(negative for expenses) - Combine conditions:
"date >= '2025-01-01' and amount > 50"
For more complex queries, refer to the pandas query documentation.
Tests
The tests of the firefly interface rely on a local firefly server.
Setup Test Server
- Start the Firefly III server:
cd ./test/fireflyServer
sudo docker compose up
- Create an API token automatically:
Option A: Using Python script (recommended)
# Create token and save to .env file
python3 test/fireflyServer/setupToken.py --save
# Or just display the token
python3 test/fireflyServer/setupToken.py
Option B: Manual setup
Register an account at http://localhost:80 and create a personal access token manually in the Profile section. Then store the token:
echo 'TEST_API_TOKEN="your-token-here"' > .env
The automated scripts use these default credentials:
- Email:
test@example.com - Password:
password123
You can customize them with environment variables:
export FIREFLY_EMAIL="custom@example.com"
export FIREFLY_PASSWORD="custompass"
python3 test/fireflyServer/setupToken.py --save
Run Tests
Once the test server is running and the API token is configured in the .env file, install the package with dev dependencies and run the tests:
# Install package with dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest --cov=fireflyConverter test/
Note: The .env file is automatically loaded by the test suite using python-dotenv (included in dev dependencies).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file firefly_cash_converter-0.1.0.tar.gz.
File metadata
- Download URL: firefly_cash_converter-0.1.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b5e9c97a4206d4f0d35d8f529e3f598ffdcf18e9184e20059a089d986435745
|
|
| MD5 |
7f924aabfa606fbb74160f4ca2e6083d
|
|
| BLAKE2b-256 |
1143b1ed526de68fde981cd91599f3a9fd071cff15bc2816e310a18c0e57e66f
|
Provenance
The following attestation bundles were made for firefly_cash_converter-0.1.0.tar.gz:
Publisher:
python-publish.yml on phdorp/firefly-cash-converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firefly_cash_converter-0.1.0.tar.gz -
Subject digest:
7b5e9c97a4206d4f0d35d8f529e3f598ffdcf18e9184e20059a089d986435745 - Sigstore transparency entry: 785005735
- Sigstore integration time:
-
Permalink:
phdorp/firefly-cash-converter@1b4f51ca88f223026167c9c1aa7ab814af71b075 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/phdorp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1b4f51ca88f223026167c9c1aa7ab814af71b075 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file firefly_cash_converter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: firefly_cash_converter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5e28a5816058248f2ca027414bb927e3df5e5cd458471f703ebe0f6e1f69c44
|
|
| MD5 |
aa65c7f5f185a123b73ef57b84ac0986
|
|
| BLAKE2b-256 |
e45d41558ab146973ed56031a5723b3f403d5881f27f88378660935ecfa77b37
|
Provenance
The following attestation bundles were made for firefly_cash_converter-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on phdorp/firefly-cash-converter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firefly_cash_converter-0.1.0-py3-none-any.whl -
Subject digest:
e5e28a5816058248f2ca027414bb927e3df5e5cd458471f703ebe0f6e1f69c44 - Sigstore transparency entry: 785005740
- Sigstore integration time:
-
Permalink:
phdorp/firefly-cash-converter@1b4f51ca88f223026167c9c1aa7ab814af71b075 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/phdorp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1b4f51ca88f223026167c9c1aa7ab814af71b075 -
Trigger Event:
workflow_dispatch
-
Statement type: