Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine 2 transaction fee records if they are about the same product #146

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 0.21.0
next-version: 0.21.1
assembly-informational-format: "{NuGetVersion}"
mode: ContinuousDeployment
branches:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "export-to-ghostfolio",
"version": "0.21.0",
"version": "0.21.1",
"type": "module",
"description": "Convert multiple broker exports to Ghostfolio import",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions samples/degiro-export.csv
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ Datum,Tijd,Valutadatum,Product,ISIN,Omschrijving,FX,Mutatie,,Saldo,,Order Id
23-08-2024,12:21,23-08-2024,,,DEGIRO courtesy,,EUR,0.24,EUR,61.30,
23-08-2024,12:21,23-08-2024,,,DEGIRO courtesy,,EUR,0.61,EUR,61.06,
14-09-2023,08:49,14-09-2023,PROSUS NV,NL0013654783,STOCK DIVIDEND: Koop 999 @ 0 EUR,,EUR,0.00,EUR,9999.99,
13-09-2024,10:36,13-09-2024,ISHARES ASIA PACIFIC DIVIDEND UCITS ETF,IE00B14X4T88,Taxe sur les Opérations Boursières belge (TOB),,EUR,-0.45,EUR,8.31,72592e9b-xxxx-xxxx-xxxx-xxxxxxxxxxxx
13-09-2024,10:36,13-09-2024,ISHARES ASIA PACIFIC DIVIDEND UCITS ETF,IE00B14X4T88,Frais DEGIRO de courtage et/ou de parties tierces,,EUR,-1.00,EUR,8.76,72592e9b-xxxx-xxxx-xxxx-xxxxxxxxxxxx
13-09-2024,10:36,13-09-2024,ISHARES ASIA PACIFIC DIVIDEND UCITS ETF,IE00B14X4T88,"Achat 18 iShares Asia Pacific Dividend UCITS ETF USD (Dist)@20,81 EUR (IE00B14X4T88)",,EUR,-374.58,EUR,9.76,72592e9b-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2 changes: 1 addition & 1 deletion src/converters/degiroConverterV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("degiroConverterV2", () => {
// Assert
expect(actualExport).toBeTruthy();
expect(actualExport.activities.length).toBeGreaterThan(0);
expect(actualExport.activities.length).toBe(24);
expect(actualExport.activities.length).toBe(25);

done();
}, () => { done.fail("Should not have an error!"); });
Expand Down
2 changes: 1 addition & 1 deletion src/converters/degiroConverterV3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("degiroConverterV3", () => {
// Assert
expect(actualExport).toBeTruthy();
expect(actualExport.activities.length).toBeGreaterThan(0);
expect(actualExport.activities.length).toBe(24);
expect(actualExport.activities.length).toBe(25);

done();
}, () => { done.fail("Should not have an error!"); });
Expand Down
15 changes: 14 additions & 1 deletion src/converters/degiroConverterV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,20 @@ export class DeGiroConverterV3 extends AbstractConverter {
// Check wether it is a buy/sell record set.
if (this.isBuyOrSellRecordSet(record, matchingRecord)) {
result.activities.push(this.combineRecords(record, matchingRecord, security));
} else {
}
// Check wether both records are transaction fee records. This happens among others for Belgium customers.
// In this case, combine the transaction fee records into one record.
else if (this.isTransactionFeeRecord(record, true) && this.isTransactionFeeRecord(matchingRecord, true)) {

// Combine the details and prepare the record for the next for-loop iteration.
record.description = `${record.description}; ${matchingRecord.description}`;
record.amount = `${parseFloat(record.amount) + parseFloat(matchingRecord.amount)}`;

records[idx + 1] = record;
}
else {

// It's a dividend record set.
result.activities.push(this.mapDividendRecord(record, matchingRecord, security));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/testing/data/yahooFinanceQuoteSummaryResults.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/testing/data/yahooFinanceSearchResults.json

Large diffs are not rendered by default.

Loading