Skip to content

Commit

Permalink
Add investimental broker (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielgradinaru committed Jul 9, 2024
1 parent 6f69ba8 commit 74f78a3
Show file tree
Hide file tree
Showing 12 changed files with 451 additions and 18 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.14.1
next-version: 0.15.0
assembly-informational-format: "{NuGetVersion}"
mode: ContinuousDeployment
branches:
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This tool allows you to convert a multiple transaction exports (CSV) to an impor
- [Finpension](https://finpension.ch)
- [Freetrade](https://freetrade.io)
- [Interactive Brokers (IBKR)](https://www.interactivebrokers.com)
- [Investimental](https://www.investimental.ro/)
- [Rabobank](https://rabobank.nl)
- [Schwab](https://www.schwab.com)
- [Swissquote](https://en.swissquote.com/)
Expand Down Expand Up @@ -72,6 +73,12 @@ For trades, select "Trades". Then select the following properties: `Buy/Sell, Tr

For dividends, select "Cash Transactions". Then select the following properties: `Type, SettleDate, ISIN, Description, Amount, CurrencyPrimary`.

### Investimental

Login to your Investimental account and click on the "Orders Daily Log". Select account and desired time period then click refresh button. Transactions should appear and then click on the download button.

![Export instructions for Investimental](./assets/export-investimental.png)

### Rabobank

Login to Rabobank and navigate to your investments. Navigate to "Transactions & Contract Notes" (Mutaties & Nota's). Select the range you wish to export at the top. Then scroll to the bottom of the page and click "Export as .csv"
Expand Down Expand Up @@ -186,20 +193,21 @@ The repository contains a sample `.env` file. Rename this from `.env.sample`.

You can now run `npm run start [exporttype]`. See the table with run commands below. The tool will open your export and will convert this. It retrieves the symbols that are supported with YAHOO Finance (e.g. for European stocks like `ASML`, it will retrieve `ASML.AS` by the corresponding ISIN).

| Exporter | Run command |
| ----------- | ----------------------------------- |
| Bitvavo | `run start bitvavo` (or `bv`) |
| BUX | `run start bux` |
| DEGIRO | `run start degiro` |
| eToro | `run start etoro` |
| Finpension | `run start finpension` (or `fp`) |
| Freetrade | `run start freetrade` (or `ft`) |
| IBKR | `run start ibkr` |
| Rabobank | `run start rabobank` |
| Schwab | `run start schwab` |
| Swissquote | `run start swissquote` (or `sq`) |
| Trading 212 | `run start trading212` (or `t212`) |
| XTB | `run start xtb` |
| Exporter | Run command |
| ------------- | ----------------------------------- |
| Bitvavo | `run start bitvavo` (or `bv`) |
| BUX | `run start bux` |
| DEGIRO | `run start degiro` |
| eToro | `run start etoro` |
| Finpension | `run start finpension` (or `fp`) |
| Freetrade | `run start freetrade` (or `ft`) |
| IBKR | `run start ibkr` |
| Investimental | `run start investimental` |
| Rabobank | `run start rabobank` |
| Schwab | `run start schwab` |
| Swissquote | `run start swissquote` (or `sq`) |
| Trading 212 | `run start trading212` (or `t212`) |
| XTB | `run start xtb` |

### Caching

Expand Down
Binary file added assets/export-investimental.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.14.1",
"version": "0.15.0",
"type": "module",
"description": "Convert multiple broker exports to Ghostfolio import",
"scripts": {
Expand Down
52 changes: 52 additions & 0 deletions samples/investimental-export.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Order ID,Order Number,Side,Exchange,Symbol,Market,Price,Volume,Disclosed,Value,Fee,Term,Validity,Trigger Type,Trigger Price,Settlement Term,Settlement Date,Settlement Type,Short Sell,Account ID,Account Name,Last Trade ID,Last Trade Ticket,Status,Initiated By,Updated By,Update Type,Update Time,Request ID,Request Type,Request Status
6750,58525243,Buy,BVB,TVBETETF,REGS,24.655000,20,,493.100000,3.270000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-03-05 10:15:40,,,
6750,58525243,Buy,BVB,TVBETETF,REGS,24.745000,20,,494.900000,3.280000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-03-05 11:32:23,,,
6750,58525243,Buy,BVB,TVBETETF,REGS,24.745000,20,,494.900000,3.280000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-03-05 11:32:44,12177,Change,Deleted
6750,58525243,Buy,BVB,TVBETETF,REGS,24.745000,20,,0.000000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],7573,24141773,Inactive,JD123456,JD123456,Fil,2024-03-05 12:06:20,,,
9058,58948320,Buy,BVB,TVBETETF,REGS,25.000000,99,,2475.000000,10.610000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-04-11 10:11:27,,,
9058,58948320,Buy,BVB,TVBETETF,REGS,25.000000,99,,2475.000000,10.610000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-04-11 15:43:27,16109,Change,Deleted
9058,58948320,Buy,BVB,TVBETETF,REGS,25.700000,96,,2467.200000,10.580000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-04-11 15:43:55,,,
9058,58948320,Buy,BVB,TVBETETF,REGS,25.700000,96,,2467.200000,10.580000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Inactive,JD123456,RIVER,OOT,2024-04-12 00:00:12,,,
9202,58974306,Buy,BVB,TVBETETF,REGS,25.930000,96,,2489.280000,10.660000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-04-12 13:26:12,,,
9202,58974306,Buy,BVB,TVBETETF,REGS,25.930000,96,,0.000000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],10266,24404999,Inactive,JD123456,JD123456,Fil,2024-04-12 14:41:34,,,
9359,58996052,Buy,BVB,R2704A,POFB,100.000000,300,,30000.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-04-15 12:37:00,,,
9359,58996052,Buy,BVB,R2704A,POFB,100.000000,300,,0.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],10738,24454742,Inactive,JD123456,JD123456,Fil,2024-04-18 09:26:50,,,
10938,59236035,Buy,BVB,TVBETETF,REGS,26.160000,95,,2485.200000,10.650000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-13 10:30:27,,,
10938,59236035,Buy,BVB,TVBETETF,REGS,26.160000,95,,2485.200000,10.650000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-13 11:18:48,18840,Change,Deleted
10938,59236035,Buy,BVB,TVBETETF,REGS,26.390000,94,,2480.660000,10.630000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-13 11:19:20,,,
10938,59236035,Buy,BVB,TVBETETF,REGS,26.390000,94,,0.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],11895,24563391,Inactive,JD123456,JD123456,Fil,2024-05-13 11:43:07,,,
12753,59442013,Buy,BVB,ICBETNETF,REGS,74.570000,267,,19910.190000,61.180000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-29 10:10:35,,,
12753,59442013,Buy,BVB,ICBETNETF,REGS,74.550000,267,,19904.850000,61.160000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-29 10:11:35,,,
12753,59442013,Buy,BVB,ICBETNETF,REGS,74.550000,267,,0.000000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],13906,24704498,Inactive,JD123456,JD123456,Fil,2024-05-29 10:12:07,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.750000,210,,5827.500000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-29 10:16:18,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.600000,210,,5796.000000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-29 12:01:13,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.700000,210,,5817.000000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-29 12:02:31,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.650000,210,,5806.500000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-29 12:03:14,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.640000,210,,5804.400000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-29 12:04:07,,,
12779,59442559,Sell,BVB,TVBETETF,REGS,27.640000,210,,5804.400000,0.000000,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Inactive,JD123456,RIVER,OOT,2024-05-30 00:00:12,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.800000,210,,5838.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-31 09:45:00,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.740000,210,,5825.400000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 10:05:49,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.500000,210,,5775.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 10:51:42,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.300000,210,,5733.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 10:52:08,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.250000,210,,5722.500000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 11:08:23,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.230000,210,,5718.300000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 11:35:12,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.210000,210,,5714.100000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 11:39:49,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.205000,210,,5713.050000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:01:14,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.200000,210,,5712.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:04:31,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.180000,210,,5707.800000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:34:00,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.120000,210,,5695.200000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:34:50,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.100000,210,,5691.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:38:12,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.200000,210,,5712.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:40:58,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.185000,210,,5708.850000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:41:15,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.185000,200,,5437.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15086,24734177,Active,JD123456,JD123456,Fil,2024-05-31 12:41:49,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.185000,145,,3941.825000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15087,24734207,Active,JD123456,JD123456,Fil,2024-05-31 12:44:12,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.190000,145,,3942.550000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,24734207,Active,JD123456,JD123456,Chg,2024-05-31 12:46:59,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.190000,137,,3725.030000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15092,24734255,Active,JD123456,JD123456,Fil,2024-05-31 12:47:24,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.190000,64,,1740.160000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15093,24734266,Active,JD123456,JD123456,Fil,2024-05-31 12:48:32,,,
13268,59479550,Sell,BVB,TVBETETF,REGS,27.190000,64,,0.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15094,24734269,Inactive,JD123456,JD123456,Fil,2024-05-31 12:48:44,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.060000,78,,5698.680000,18.550000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,New,2024-05-31 12:49:37,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.070000,78,,5699.460000,18.550000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 12:49:57,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.190000,77,,5635.630000,18.360000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 13:02:10,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.200000,77,,5636.400000,18.360000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 13:06:03,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.210000,77,,5637.170000,18.360000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Active,JD123456,JD123456,Chg,2024-05-31 13:13:16,,,
13375,59489119,Buy,BVB,ICBETNETF,REGS,73.210000,77,,0.000000,0.000000,Open,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],15122,24734950,Inactive,JD123456,JD123456,Fil,2024-05-31 13:33:56,,,
5 changes: 5 additions & 0 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FinpensionConverter } from "./converters/finpensionConverter";
import { FreetradeConverter } from "./converters/freetradeConverter";
import { GhostfolioExport } from "./models/ghostfolioExport";
import { IbkrConverter } from "./converters/ibkrConverter";
import { InvestimentalConverter } from "./converters/investimentalConverter";
import { RabobankConverter } from "./converters/rabobankConverter";
import { SchwabConverter } from "./converters/schwabConverter";
import { SwissquoteConverter } from "./converters/swissquoteConverter";
Expand Down Expand Up @@ -104,6 +105,10 @@ async function createConverter(converterType: string): Promise<AbstractConverter
console.log("[i] Processing file using IBKR converter");
converter = new IbkrConverter(securityService);
break;
case "investimental":
console.log("[i] Processing file using Investimental converter");
converter = new InvestimentalConverter(securityService);
break;
case "rabobank":
console.log("[i] Processing file using Rabobank converter");
converter = new RabobankConverter(securityService);
Expand Down
125 changes: 125 additions & 0 deletions src/converters/investimentalConverter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { InvestimentalConverter } from "./investimentalConverter";
import { SecurityService } from "../securityService";
import { GhostfolioExport } from "../models/ghostfolioExport";
import YahooFinanceServiceMock from "../testing/yahooFinanceServiceMock";


describe("investimentalConverter", () => {

beforeEach(() => {
jest.spyOn(console, "log").mockImplementation(jest.fn());
});

afterEach(() => {
jest.clearAllMocks();
});

it("should construct", () => {

// Act
const sut = new InvestimentalConverter(new SecurityService(new YahooFinanceServiceMock()));

// Assert
expect(sut).toBeTruthy();
});

it("should process sample CSV file", (done) => {

// Arange
const sut = new InvestimentalConverter(new SecurityService(new YahooFinanceServiceMock()));
const inputFile = "samples/investimental-export.csv";

// Act
sut.readAndProcessFile(inputFile, (actualExport: GhostfolioExport) => {

// Assert
expect(actualExport).toBeTruthy();
expect(actualExport.activities.length).toBeGreaterThan(0);
expect(actualExport.activities.length).toBe(6);

done();
}, () => { done.fail("Should not have an error!"); });
});

describe("should throw an error if", () => {
it("the input file does not exist", (done) => {

// Arrange
const sut = new InvestimentalConverter(new SecurityService(new YahooFinanceServiceMock()));

let tempFileName = "tmp/testinput/investimental-filedoesnotexist.csv";

// Act
sut.readAndProcessFile(tempFileName, () => { done.fail("Should not succeed!"); }, (err: Error) => {

// Assert
expect(err).toBeTruthy();

done();
});
});

it("the input file is empty", (done) => {

// Arrange
const sut = new InvestimentalConverter(new SecurityService(new YahooFinanceServiceMock()));

let tempFileContent = "Order ID,Order Number,Side,Exchange,Symbol,Market,Price,Volume,Disclosed,Value,Fee,Term,Validity,Trigger Type,Trigger Price,Settlement Term,Settlement Date,Settlement Type,Short Sell,Account ID,Account Name,Last Trade ID,Last Trade Ticket,Status,Initiated By,Updated By,Update Type,Update Time,Request ID,Request Type,Request Status\n";

// Act
sut.processFileContents(tempFileContent, () => { done.fail("Should not succeed!"); }, (err: Error) => {

// Assert
expect(err).toBeTruthy();
expect(err.message).toContain("An error ocurred while parsing");

done();
});
});

it("Yahoo Finance throws an error", (done) => {

// Arrange
let tempFileContent = "Order ID,Order Number,Side,Exchange,Symbol,Market,Price,Volume,Disclosed,Value,Fee,Term,Validity,Trigger Type,Trigger Price,Settlement Term,Settlement Date,Settlement Type,Short Sell,Account ID,Account Name,Last Trade ID,Last Trade Ticket,Status,Initiated By,Updated By,Update Type,Update Time,Request ID,Request Type,Request Status\n";
tempFileContent += "6750,58525243,Buy,BVB,TVBETETF,REGS,24.745000,20,,494.900000,0,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Inactive,JD123456,JD123456,Fil,2024-03-05 12:06:20,,,";

// Mock Yahoo Finance service to throw error.
const yahooFinanceServiceMock = new YahooFinanceServiceMock();
jest.spyOn(yahooFinanceServiceMock, "search").mockImplementation(() => { throw new Error("Unit test error"); });
const sut = new InvestimentalConverter(new SecurityService(yahooFinanceServiceMock));

// Act
sut.processFileContents(tempFileContent, () => { done.fail("Should not succeed!"); }, (err: Error) => {

// Assert
expect(err).toBeTruthy();
expect(err.message).toContain("Unit test error");

done();
});
});
});

it("should log when YahooX Finance returns no symbol", (done) => {

// Arrange
let tempFileContent = "Order ID,Order Number,Side,Exchange,Symbol,Market,Price,Volume,Disclosed,Value,Fee,Term,Validity,Trigger Type,Trigger Price,Settlement Term,Settlement Date,Settlement Type,Short Sell,Account ID,Account Name,Last Trade ID,Last Trade Ticket,Status,Initiated By,Updated By,Update Type,Update Time,Request ID,Request Type,Request Status\n";
tempFileContent += "6750,58525243,Buy,BVB,TVBETETF,REGS,24.745000,20,,494.900000,0,Day,,None,,T+2,,Net,No,JD123456RR1,JOHN DOE [RON],0,0,Inactive,JD123456,JD123456,Fil,2024-03-05 12:06:20,,,";

// Mock Yahoo Finance service to return no quotes.
const yahooFinanceServiceMock = new YahooFinanceServiceMock();
jest.spyOn(yahooFinanceServiceMock, "search").mockImplementation(() => { return Promise.resolve({ quotes: [] }) });
const sut = new InvestimentalConverter(new SecurityService(yahooFinanceServiceMock));

// Bit hacky, but it works.
const consoleSpy = jest.spyOn((sut as any).progress, "log");

// Act
sut.processFileContents(tempFileContent, () => {

expect(consoleSpy).toHaveBeenCalledWith("[i] No result found for action buy, symbol TVBETETF, currency RON! Please add this manually..\n");

done();
}, () => done.fail("Should not have an error!"));
});
});
Loading

0 comments on commit 74f78a3

Please sign in to comment.