Skip to content

Commit

Permalink
Add free fund interest tax
Browse files Browse the repository at this point in the history
  • Loading branch information
dickwolff committed Jan 19, 2025
1 parent 22efdb1 commit ff2e91d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion samples/xtb-export.csv
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ ID;Type;Time;Symbol;Comment;Amount
579262886;Dividend;12.07.2024 13:01:17;XRAY.US;XRAY.US USD 0.1600/ SHR;4.8
547615089;Stocks/ETF purchase;14.05.2024 17:21:10;FLOA.UK;OPEN BUY 16/16.7399 @ 5.9140;-94.62
547615042;Stocks/ETF purchase;14.05.2024 17:21:09;CSPX.UK;OPEN BUY 0.1799 @ 550.30;-99
547615041;Stocks/ETF purchase;14.05.2024 17:21:09;FLOA.UK;OPEN BUY 0.7399/16.7399 @ 5.9140;-4.38
547615041;Stocks/ETF purchase;14.05.2024 17:21:09;FLOA.UK;OPEN BUY 0.7399/16.7399 @ 5.9140;-4.38
543857396;Free funds interests tax;07.05.2024 09:36:50;;Free-funds Interest Tax 2024-04;-2
2 changes: 1 addition & 1 deletion src/converters/xtbConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("xtbConverter", () => {
// Assert
expect(actualExport).toBeTruthy();
expect(actualExport.activities.length).toBeGreaterThan(0);
expect(actualExport.activities.length).toBe(26);
expect(actualExport.activities.length).toBe(27);

done();
}, () => { done.fail("Should not have an error!"); });
Expand Down
13 changes: 9 additions & 4 deletions src/converters/xtbConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ export class XtbConverter extends AbstractConverter {
else if (type.indexOf("stocks/etf sale") > -1 || type.indexOf("ações/etf vende") > -1) {
return "sell";
}
else if (
type.indexOf("sec fee") > -1 ||
type.indexOf("swap") > -1 ||
type.indexOf("commission") > -1 ||
type.indexOf("free funds interests tax") > -1) {

return "fee";
}
else if (type.indexOf("free funds interests") > -1) {
return "interest";
}
else if (type.indexOf("sec fee") > -1 || type.indexOf("swap") > -1 || type.indexOf("commission") > -1) {
return "fee";
}
else if (type.indexOf("dividend") > -1) {
return "dividend";
}
Expand Down Expand Up @@ -122,7 +127,7 @@ export class XtbConverter extends AbstractConverter {
fee: 0,
quantity: 1,
type: GhostfolioOrderType[record.type],
unitPrice: record.amount,
unitPrice: Math.abs(record.amount),
currency: process.env.XTB_ACCOUNT_CURRENCY || "EUR",
dataSource: "MANUAL",
date: date.format("YYYY-MM-DDTHH:mm:ssZ"),
Expand Down

0 comments on commit ff2e91d

Please sign in to comment.