feat: add transactions export command#74
feat: add transactions export command#74johann-taberlet wants to merge 2 commits intoazerpas:mainfrom
Conversation
|
Thank you very much for the contribution @johann-taberlet A few things top of my head:
|
|
Thanks for the feedback @azerpas! All changes implemented in the latest commit:
Final usage: bourso export transactions -a <account_id> --start-date "01/01/2026" --end-date "31/01/2026" -f json -o /path/to/transactions.jsonAll 11 tests still passing, build OK. Tested manually with both CSV (stdout) and JSON (stdout) output. |
|
@azerpas Any blocker to merge this PR ? 🙏🏻 |
|
Hello, boursobank user here I worked on a personal solution in python by reverse-engineering the API (and this repository for the virtual-pad horror) and it happens that this will not work for every accounts. Indeed, this will only work for classical accounts (livret-a, bourso+, main, ...). Indeed for PEA accounts, the endpoint URL is
The output file will be a CSV with following fields : ("Date opération","Date valeur","Opération","Valeur","Code ISIN","Montant","Quantité","Cours") This is the only information I can give you as I do now own any other accounts (no CTO for instance) Maybe worth documenting this may not work for every account type ! |
|
+1 on this, would love to see it merged when you have a chance @azerpas. Transaction export is the feature I’m missing most right now. |
|
Sorry for the lack of responsiveness, I was away for a few weeks. Approved 👍 EDIT: @johann-taberlet could you please sign your commits for the PR to be merged? Thanks in advance |
Add a new `transactions` subcommand to export account transactions over a date range using BoursoBank's CSV export endpoint. - Add `Transaction` struct to `bourso_api::account` - Add `get_transactions()` method on `BoursoWebClient` - Handle redirect to `api.boursobank.com` for file download - Parse BoursoBank CSV (semicolon-separated, French number format) - Support CSV (default) and JSON output formats - Add unit tests for CSV parsing and amount conversion
- Move `transactions` under new `export` subcommand (`bourso export transactions`) - Rename `--from`/`--to` to `--start-date`/`--end-date` - Rename `--output` (format) to `--format`/`-f` - Add `--output`/`-o` for file output path (defaults to stdout)
79cc79e to
8d49d1a
Compare
Summary
Adds a new
transactionssubcommand to export account transactions over a date range, using BoursoBank's CSV export endpoint (/budget/exporter-mouvements).Changes
bourso_api::account: AddTransactionstruct with all fields from BoursoBank CSV exportbourso_api::client::transaction: Addget_transactions()method onBoursoWebClient/budget/exporter-mouvementsendpoint with date range and account filterapi.boursobank.comfor file download (since the client usesPolicy::none())Vecgracefully when an HTML error page is returnedtransactionssubcommand with--account,--from,--to,--outputargscsvcrate for robust CSV parsingTest plan
cargo build --releasecompiles without errorscargo test -p bourso_api— 11 tests pass (3 new:test_parse_amount,test_extract_transactions,test_extract_transactions_empty_html)-o json) works correctly