Skip to content

Commit

Permalink
Fix etoro number parse (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbcelly authored Jan 6, 2025
1 parent 79fd3ff commit df14603
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
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.22.0
next-version: 0.22.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.22.0",
"version": "0.22.1",
"type": "module",
"description": "Convert multiple broker exports to Ghostfolio import",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion samples/etoro-export.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ Date,Type,Details,Amount,Units,Realized Equity Change,Realized Equity,Balance,Po
16/01/2024 20:08:09,Position closed,AMD/USD,61.27,0.388423,38.57,"4,581.91",0.80,2602058508,Stocks,0.00
17/01/2024 00:04:27,Dividend,KER/EUR,0.03,-,0.03,"4,581.91",0.80,697085768,Stocks,0.00
17/01/2024 00:04:28,Dividend,KER/EUR,0.01,-,0.01,"4,581.91",0.80,831716072,Stocks,0.00
17/01/2024 00:04:28,Dividend,KER/EUR,0.01,-,0.01,"4,581.91",0.80,1074146904,Stocks,0.00
17/01/2024 00:04:28,Dividend,KER/EUR,0.01,-,0.01,"4,581.91",0.80,1074146904,Stocks,0.00
14/04/2020 14:00:25,Open Position,NKE/USD," 100,00 ",0.398451," 0,00 "," 212,87 "," 12,87 ",1074146905,CFD," 0,00 "
15/04/2020 00:46:41,Overnight fee,Daily,"(0,10)",-,"(0,10)"," 212,77 "," 12,77 ",1074146905,CFD," 0,00 "
2 changes: 1 addition & 1 deletion src/converters/etoroConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("etoroConverter", () => {
// Assert
expect(actualExport).toBeTruthy();
expect(actualExport.activities.length).toBeGreaterThan(0);
expect(actualExport.activities.length).toBe(18);
expect(actualExport.activities.length).toBe(19);

done();
}, () => { done.fail("Should not have an error!"); });
Expand Down
2 changes: 1 addition & 1 deletion src/converters/etoroConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class EtoroConverter extends AbstractConverter {
return 1;
}

return parseFloat(columnValue);
return parseFloat(columnValue.replace(/[()]/g, '').replace(',', '.'));
}

return columnValue;
Expand Down

0 comments on commit df14603

Please sign in to comment.