Browse Source

refactoring

pull/5697/head
David Requeno 3 weeks ago
parent
commit
e56b138521
  1. 240
      libs/ui/src/lib/holdings-table/holdings-table.component.stories.ts

240
libs/ui/src/lib/holdings-table/holdings-table.component.stories.ts

@ -41,8 +41,8 @@ const holdings = [
name: 'Apple Inc',
netPerformance: 3855,
netPerformancePercent: 0.460353475041796,
netPerformancePercentWithCurrencyEffect: 0.460353475041796,
netPerformanceWithCurrencyEffect: 3855,
netPerformancePercentWithCurrencyEffect: 0.036440677966101696,
netPerformanceWithCurrencyEffect: 430,
quantity: 50,
sectors: [
{
@ -62,6 +62,49 @@ const holdings = [
assetClassLabel: 'Equity',
assetSubClass: 'STOCK' as any,
assetSubClassLabel: 'Stock',
countries: [
{
code: 'DE',
weight: 1,
continent: 'Europe',
name: 'Germany'
}
],
currency: 'EUR',
dataSource: 'YAHOO' as any,
dateOfFirstActivity: new Date('2021-04-23T00:00:00.000Z'),
dividend: 192,
grossPerformance: 2226.700251889169,
grossPerformancePercent: 0.49083842309827874,
grossPerformancePercentWithCurrencyEffect: 0.29306136948826367,
grossPerformanceWithCurrencyEffect: 1532.8272791336772,
holdings: [],
investment: 4536.523929471033,
marketPrice: 322.2,
name: 'Allianz SE',
netPerformance: 2222.2921914357685,
netPerformancePercent: 0.48986674069961134,
netPerformancePercentWithCurrencyEffect: 0.034489367670592026,
netPerformanceWithCurrencyEffect: 225.48257403052068,
quantity: 20,
sectors: [
{
name: 'Financial Services',
weight: 1
}
],
symbol: 'ALV.DE',
tags: [],
transactionCount: 2,
url: 'https://www.allianz.com',
valueInBaseCurrency: 6763.224181360202
},
{
allocationInPercentage: 0.08038536990007467,
assetClass: 'EQUITY' as any,
assetClassLabel: 'Equity',
assetSubClass: 'STOCK' as any,
assetSubClassLabel: 'Stock',
countries: [
{
code: 'US',
@ -72,21 +115,95 @@ const holdings = [
],
currency: 'USD',
dataSource: 'YAHOO' as any,
dateOfFirstActivity: new Date('2021-11-15T00:00:00.000Z'),
dateOfFirstActivity: new Date('2018-10-01T00:00:00.000Z'),
dividend: 0,
grossPerformance: 1250,
grossPerformancePercent: 0.25000000000000006,
grossPerformancePercentWithCurrencyEffect: 0.25000000000000006,
grossPerformanceWithCurrencyEffect: 1250,
grossPerformance: 12758.05,
grossPerformancePercent: 1.2619300787837724,
grossPerformancePercentWithCurrencyEffect: 1.2619300787837724,
grossPerformanceWithCurrencyEffect: 12758.05,
holdings: [],
investment: 5000,
marketPrice: 125,
investment: 10109.95,
marketPrice: 228.68,
name: 'Amazon.com, Inc.',
netPerformance: 12677.26,
netPerformancePercent: 1.253938941339967,
netPerformancePercentWithCurrencyEffect: -0.037866008722316276,
netPerformanceWithCurrencyEffect: -899.99926757812,
quantity: 100,
sectors: [
{
name: 'Consumer Discretionary',
weight: 1
}
],
symbol: 'AMZN',
tags: [],
transactionCount: 1,
url: 'https://www.aboutamazon.com',
valueInBaseCurrency: 22868
},
{
allocationInPercentage: 0.19216416482928922,
assetClass: 'LIQUIDITY' as any,
assetClassLabel: 'Liquidity',
assetSubClass: 'CRYPTOCURRENCY' as any,
assetSubClassLabel: 'Cryptocurrency',
countries: [],
currency: 'USD',
dataSource: 'COINGECKO' as any,
dateOfFirstActivity: new Date('2017-08-16T00:00:00.000Z'),
dividend: 0,
grossPerformance: 52666.7898248,
grossPerformancePercent: 26.333394912400003,
grossPerformancePercentWithCurrencyEffect: 26.333394912400003,
grossPerformanceWithCurrencyEffect: 52666.7898248,
holdings: [],
investment: 1999.9999999999998,
marketPrice: 97364,
name: 'Bitcoin',
netPerformance: 52636.8898248,
netPerformancePercent: 26.3184449124,
netPerformancePercentWithCurrencyEffect: -0.04760906442310894,
netPerformanceWithCurrencyEffect: -2732.737808972287,
quantity: 0.5614682,
sectors: [],
symbol: 'bitcoin',
tags: [],
transactionCount: 1,
url: null,
valueInBaseCurrency: 54666.7898248
},
{
allocationInPercentage: 0.04307127421937313,
assetClass: 'EQUITY' as any,
assetClassLabel: 'Equity',
assetSubClass: 'STOCK' as any,
assetSubClassLabel: 'Stock',
countries: [
{
code: 'US',
weight: 1,
continent: 'North America',
name: 'United States'
}
],
currency: 'USD',
dataSource: 'YAHOO' as any,
dateOfFirstActivity: new Date('2023-01-03T00:00:00.000Z'),
dividend: 0,
grossPerformance: 5065.5,
grossPerformancePercent: 0.7047750229568411,
grossPerformancePercentWithCurrencyEffect: 0.7047750229568411,
grossPerformanceWithCurrencyEffect: 5065.5,
holdings: [],
investment: 7187.4,
marketPrice: 408.43,
name: 'Microsoft Corporation',
netPerformance: 1250,
netPerformancePercent: 0.25,
netPerformancePercentWithCurrencyEffect: 0.25,
netPerformanceWithCurrencyEffect: 1250,
quantity: 50,
netPerformance: 5065.5,
netPerformancePercent: 0.7047750229568411,
netPerformancePercentWithCurrencyEffect: -0.015973588391056275,
netPerformanceWithCurrencyEffect: -198.899926757814,
quantity: 30,
sectors: [
{
name: 'Technology',
@ -97,10 +214,10 @@ const holdings = [
tags: [],
transactionCount: 1,
url: 'https://www.microsoft.com',
valueInBaseCurrency: 6250
valueInBaseCurrency: 12252.9
},
{
allocationInPercentage: 0.015000000000000003,
allocationInPercentage: 0.18762679306394897,
assetClass: 'EQUITY' as any,
assetClassLabel: 'Equity',
assetSubClass: 'STOCK' as any,
@ -115,21 +232,21 @@ const holdings = [
],
currency: 'USD',
dataSource: 'YAHOO' as any,
dateOfFirstActivity: new Date('2022-01-10T00:00:00.000Z'),
dateOfFirstActivity: new Date('2017-01-03T00:00:00.000Z'),
dividend: 0,
grossPerformance: -500,
grossPerformancePercent: -0.1,
grossPerformancePercentWithCurrencyEffect: -0.1,
grossPerformanceWithCurrencyEffect: -500,
grossPerformance: 51227.500000005,
grossPerformancePercent: 23.843379101756675,
grossPerformancePercentWithCurrencyEffect: 23.843379101756675,
grossPerformanceWithCurrencyEffect: 51227.500000005,
holdings: [],
investment: 5000,
marketPrice: 90,
name: 'Tesla Inc',
netPerformance: -500,
netPerformancePercent: -0.1,
netPerformancePercentWithCurrencyEffect: -0.1,
netPerformanceWithCurrencyEffect: -500,
quantity: 50,
investment: 2148.499999995,
marketPrice: 355.84,
name: 'Tesla, Inc.',
netPerformance: 51197.500000005,
netPerformancePercent: 23.829415871596066,
netPerformancePercentWithCurrencyEffect: -0.12051410125545206,
netPerformanceWithCurrencyEffect: -7314.00091552734,
quantity: 150,
sectors: [
{
name: 'Consumer Discretionary',
@ -140,7 +257,50 @@ const holdings = [
tags: [],
transactionCount: 1,
url: 'https://www.tesla.com',
valueInBaseCurrency: 4500
valueInBaseCurrency: 53376
},
{
allocationInPercentage: 0.053051250766657634,
assetClass: 'EQUITY' as any,
assetClassLabel: 'Equity',
assetSubClass: 'ETF' as any,
assetSubClassLabel: 'ETF',
countries: [
{
code: 'US',
weight: 1,
continent: 'North America',
name: 'United States'
}
],
currency: 'USD',
dataSource: 'YAHOO' as any,
dateOfFirstActivity: new Date('2019-03-01T00:00:00.000Z'),
dividend: 0,
grossPerformance: 6845.8,
grossPerformancePercent: 1.0164758094605268,
grossPerformancePercentWithCurrencyEffect: 1.0164758094605268,
grossPerformanceWithCurrencyEffect: 6845.8,
holdings: [],
investment: 8246.2,
marketPrice: 301.84,
name: 'Vanguard Total Stock Market Index Fund ETF Shares',
netPerformance: 6746.3,
netPerformancePercent: 1.0017018833976383,
netPerformancePercentWithCurrencyEffect: 0.01085061564051406,
netPerformanceWithCurrencyEffect: 161.99969482422,
quantity: 50,
sectors: [
{
name: 'Equity',
weight: 1
}
],
symbol: 'VTI',
tags: [],
transactionCount: 5,
url: 'https://www.vanguard.com',
valueInBaseCurrency: 15092
}
];
@ -166,9 +326,9 @@ export default {
type Story = StoryObj<GfHoldingsTableComponent>;
export const Default: Story = {
export const Loading: Story = {
args: {
holdings,
holdings: undefined,
baseCurrency: 'USD',
deviceType: 'desktop',
hasPermissionToOpenDetails: true,
@ -179,40 +339,40 @@ export const Default: Story = {
}
};
export const WithoutQuantities: Story = {
export const Default: Story = {
args: {
holdings,
baseCurrency: 'USD',
deviceType: 'desktop',
hasPermissionToOpenDetails: true,
hasPermissionToShowQuantities: false,
hasPermissionToShowQuantities: true,
hasPermissionToShowValues: true,
locale: 'en-US',
pageSize: Number.MAX_SAFE_INTEGER
}
};
export const WithoutValues: Story = {
export const WithoutQuantities: Story = {
args: {
holdings,
baseCurrency: 'USD',
deviceType: 'desktop',
hasPermissionToOpenDetails: true,
hasPermissionToShowQuantities: true,
hasPermissionToShowValues: false,
hasPermissionToShowQuantities: false,
hasPermissionToShowValues: true,
locale: 'en-US',
pageSize: Number.MAX_SAFE_INTEGER
}
};
export const Mobile: Story = {
export const WithoutValues: Story = {
args: {
holdings,
baseCurrency: 'USD',
deviceType: 'mobile',
deviceType: 'desktop',
hasPermissionToOpenDetails: true,
hasPermissionToShowQuantities: true,
hasPermissionToShowValues: true,
hasPermissionToShowValues: false,
locale: 'en-US',
pageSize: Number.MAX_SAFE_INTEGER
}

Loading…
Cancel
Save