|
@ -1,4 +1,3 @@ |
|
|
import { OrderType } from '@ghostfolio/api/models/order-type'; |
|
|
|
|
|
import { parseDate, resetHours } from '@ghostfolio/common/helper'; |
|
|
import { parseDate, resetHours } from '@ghostfolio/common/helper'; |
|
|
import { DataSource } from '@prisma/client'; |
|
|
import { DataSource } from '@prisma/client'; |
|
|
import Big from 'big.js'; |
|
|
import Big from 'big.js'; |
|
@ -155,7 +154,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('144.38'), |
|
|
unitPrice: new Big('144.38'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -166,7 +165,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('147.99'), |
|
|
unitPrice: new Big('147.99'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -177,7 +176,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('15'), |
|
|
quantity: new Big('15'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Sell, |
|
|
type: 'SELL', |
|
|
unitPrice: new Big('151.41'), |
|
|
unitPrice: new Big('151.41'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -248,7 +247,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('144.38'), |
|
|
unitPrice: new Big('144.38'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -259,7 +258,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Something else', |
|
|
name: 'Something else', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTX', |
|
|
symbol: 'VTX', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('147.99'), |
|
|
unitPrice: new Big('147.99'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -270,7 +269,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('5'), |
|
|
quantity: new Big('5'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Sell, |
|
|
type: 'SELL', |
|
|
unitPrice: new Big('151.41'), |
|
|
unitPrice: new Big('151.41'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -360,7 +359,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('20'), |
|
|
quantity: new Big('20'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('197.15'), |
|
|
unitPrice: new Big('197.15'), |
|
|
fee: new Big(0) |
|
|
fee: new Big(0) |
|
|
} |
|
|
} |
|
@ -462,7 +461,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Amazon.com, Inc.', |
|
|
name: 'Amazon.com, Inc.', |
|
|
quantity: new Big('5'), |
|
|
quantity: new Big('5'), |
|
|
symbol: 'AMZN', |
|
|
symbol: 'AMZN', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('2021.99'), |
|
|
unitPrice: new Big('2021.99'), |
|
|
fee: new Big(0) |
|
|
fee: new Big(0) |
|
|
} |
|
|
} |
|
@ -617,7 +616,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Amazon.com, Inc.', |
|
|
name: 'Amazon.com, Inc.', |
|
|
quantity: new Big('5'), |
|
|
quantity: new Big('5'), |
|
|
symbol: 'AMZN', |
|
|
symbol: 'AMZN', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('2021.99'), |
|
|
unitPrice: new Big('2021.99'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -628,7 +627,7 @@ describe('PortfolioCalculator', () => { |
|
|
name: 'Amazon.com, Inc.', |
|
|
name: 'Amazon.com, Inc.', |
|
|
quantity: new Big('5'), |
|
|
quantity: new Big('5'), |
|
|
symbol: 'AMZN', |
|
|
symbol: 'AMZN', |
|
|
type: OrderType.Sell, |
|
|
type: 'SELL', |
|
|
unitPrice: new Big('2412.23'), |
|
|
unitPrice: new Big('2412.23'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2391,7 +2390,7 @@ const ordersMixedSymbols: PortfolioOrder[] = [ |
|
|
name: 'Tesla, Inc.', |
|
|
name: 'Tesla, Inc.', |
|
|
quantity: new Big('50'), |
|
|
quantity: new Big('50'), |
|
|
symbol: 'TSLA', |
|
|
symbol: 'TSLA', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('42.97'), |
|
|
unitPrice: new Big('42.97'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2402,7 +2401,7 @@ const ordersMixedSymbols: PortfolioOrder[] = [ |
|
|
name: 'Bitcoin USD', |
|
|
name: 'Bitcoin USD', |
|
|
quantity: new Big('0.5614682'), |
|
|
quantity: new Big('0.5614682'), |
|
|
symbol: 'BTCUSD', |
|
|
symbol: 'BTCUSD', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('3562.089535970158'), |
|
|
unitPrice: new Big('3562.089535970158'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2413,7 +2412,7 @@ const ordersMixedSymbols: PortfolioOrder[] = [ |
|
|
name: 'Amazon.com, Inc.', |
|
|
name: 'Amazon.com, Inc.', |
|
|
quantity: new Big('5'), |
|
|
quantity: new Big('5'), |
|
|
symbol: 'AMZN', |
|
|
symbol: 'AMZN', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('2021.99'), |
|
|
unitPrice: new Big('2021.99'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2427,7 +2426,7 @@ const ordersVTI: PortfolioOrder[] = [ |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('144.38'), |
|
|
unitPrice: new Big('144.38'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2438,7 +2437,7 @@ const ordersVTI: PortfolioOrder[] = [ |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('147.99'), |
|
|
unitPrice: new Big('147.99'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2449,7 +2448,7 @@ const ordersVTI: PortfolioOrder[] = [ |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('15'), |
|
|
quantity: new Big('15'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Sell, |
|
|
type: 'SELL', |
|
|
unitPrice: new Big('151.41'), |
|
|
unitPrice: new Big('151.41'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2460,7 +2459,7 @@ const ordersVTI: PortfolioOrder[] = [ |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('177.69'), |
|
|
unitPrice: new Big('177.69'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
@ -2471,7 +2470,7 @@ const ordersVTI: PortfolioOrder[] = [ |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
name: 'Vanguard Total Stock Market Index Fund ETF Shares', |
|
|
quantity: new Big('10'), |
|
|
quantity: new Big('10'), |
|
|
symbol: 'VTI', |
|
|
symbol: 'VTI', |
|
|
type: OrderType.Buy, |
|
|
type: 'BUY', |
|
|
unitPrice: new Big('203.15'), |
|
|
unitPrice: new Big('203.15'), |
|
|
currency: 'USD', |
|
|
currency: 'USD', |
|
|
dataSource: DataSource.YAHOO, |
|
|
dataSource: DataSource.YAHOO, |
|
|