Browse Source

Test fixes & NPM Install

pull/5027/head
Dan 1 month ago
parent
commit
9927a634cb
  1. 10
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts
  2. 14
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts
  3. 15
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts
  4. 53
      package-lock.json

10
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts

@ -88,7 +88,8 @@ describe('PortfolioCalculator', () => {
currentRateService,
exchangeRateDataService,
portfolioSnapshotService,
redisCacheService
redisCacheService,
null
);
});
@ -135,6 +136,8 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: 0,
netPerformanceWithCurrencyEffect: 0,
netWorth: 0,
timeWeightedPerformanceInPercentage: 0,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0,
totalAccountBalance: 0,
totalInvestment: 0,
totalInvestmentValueWithCurrencyEffect: 0,
@ -153,6 +156,8 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: 0.12422837255001412, // 5535.42 ÷ 44558.42 = 0.12422837255001412
netPerformanceWithCurrencyEffect: 5535.42,
netWorth: 50098.3, // 1 * 50098.3 = 50098.3
timeWeightedPerformanceInPercentage: 0,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0,
totalAccountBalance: 0,
totalInvestment: 44558.42,
totalInvestmentValueWithCurrencyEffect: 44558.42,
@ -172,6 +177,9 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: -0.032837340282712,
netPerformanceWithCurrencyEffect: -1463.18,
netWorth: 43099.7,
timeWeightedPerformanceInPercentage: -0.13969735500006986,
timeWeightedPerformanceInPercentageWithCurrencyEffect:
-0.13969735500006986,
totalAccountBalance: 0,
totalInvestment: 44558.42,
totalInvestmentValueWithCurrencyEffect: 44558.42,

14
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts

@ -1,5 +1,6 @@
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
import { OrderService } from '@ghostfolio/api/app/order/order.service';
import {
activityDummyData,
loadActivityExportFile,
@ -60,6 +61,7 @@ describe('PortfolioCalculator', () => {
let portfolioCalculatorFactory: PortfolioCalculatorFactory;
let portfolioSnapshotService: PortfolioSnapshotService;
let redisCacheService: RedisCacheService;
let orderService: OrderService;
beforeAll(() => {
activityDtos = loadActivityExportFile(
@ -83,12 +85,15 @@ describe('PortfolioCalculator', () => {
redisCacheService = new RedisCacheService(null, null);
orderService = new OrderService(null, null, null, null, null, null);
portfolioCalculatorFactory = new PortfolioCalculatorFactory(
configurationService,
currentRateService,
exchangeRateDataService,
portfolioSnapshotService,
redisCacheService
redisCacheService,
orderService
);
});
@ -135,6 +140,8 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: 0,
netPerformanceWithCurrencyEffect: 0,
netWorth: 0,
timeWeightedPerformanceInPercentage: 0,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0,
totalAccountBalance: 0,
totalInvestment: 0,
totalInvestmentValueWithCurrencyEffect: 0,
@ -153,6 +160,8 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: 0.12422837255001412, // 5535.42 ÷ 44558.42 = 0.12422837255001412
netPerformanceWithCurrencyEffect: 5535.42, // 1 * (50098.3 - 44558.42) - 4.46 = 5535.42
netWorth: 50098.3, // 1 * 50098.3 = 50098.3
timeWeightedPerformanceInPercentage: 0,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0,
totalAccountBalance: 0,
totalInvestment: 44558.42,
totalInvestmentValueWithCurrencyEffect: 44558.42,
@ -172,6 +181,9 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentageWithCurrencyEffect: -0.032837340282712,
netPerformanceWithCurrencyEffect: -1463.18,
netWorth: 43099.7,
timeWeightedPerformanceInPercentage: -0.13969735500006986,
timeWeightedPerformanceInPercentageWithCurrencyEffect:
-0.13969735500006986,
totalAccountBalance: 0,
totalInvestment: 44558.42,
totalInvestmentValueWithCurrencyEffect: 44558.42,

15
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts

@ -155,13 +155,13 @@ describe('PortfolioCalculator', () => {
expect(portfolioSnapshot.historicalData[1]).toEqual({
date: '2022-03-07',
investmentValueWithCurrencyEffect: 151.6,
netPerformance: 0,
netPerformanceInPercentage: 0,
netPerformanceInPercentageWithCurrencyEffect: 0,
netPerformanceWithCurrencyEffect: 0,
netPerformance: 24,
netPerformanceInPercentage: 0.158311345646438,
netPerformanceInPercentageWithCurrencyEffect: 0.158311345646438,
netPerformanceWithCurrencyEffect: 24,
timeWeightedPerformanceInPercentage: 0,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0,
netWorth: 151.6,
netWorth: 175.6,
totalAccountBalance: 0,
totalInvestment: 151.6,
totalInvestmentValueWithCurrencyEffect: 151.6,
@ -180,8 +180,9 @@ describe('PortfolioCalculator', () => {
netPerformanceInPercentage: 0.13100263852242744,
netPerformanceInPercentageWithCurrencyEffect: 0.13100263852242744,
netPerformanceWithCurrencyEffect: 19.86,
timeWeightedPerformanceInPercentage: 0.13100263852242744,
timeWeightedPerformanceInPercentageWithCurrencyEffect: 0.13100263852242744,
timeWeightedPerformanceInPercentage: -0.02357630979498861,
timeWeightedPerformanceInPercentageWithCurrencyEffect:
-0.02357630979498861,
netWorth: 0,
totalAccountBalance: 0,
totalInvestment: 0,

53
package-lock.json

@ -21162,59 +21162,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/globby": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz",
"integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==",
"license": "MIT",
"dependencies": {
"@sindresorhus/merge-streams": "^2.1.0",
"fast-glob": "^3.3.3",
"ignore": "^7.0.3",
"path-type": "^6.0.0",
"slash": "^5.1.0",
"unicorn-magic": "^0.3.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/globby/node_modules/ignore": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.4.tgz",
"integrity": "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A==",
"license": "MIT",
"engines": {
"node": ">= 4"
}
},
"node_modules/globby/node_modules/path-type": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz",
"integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/globby/node_modules/slash": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz",
"integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==",
"license": "MIT",
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",

Loading…
Cancel
Save