Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

1.2 KB
Raw Blame
import {
  EnhancedAssetProfile,
  PortfolioDetails,
  PortfolioPosition
} from '@ghostfolio/common/interfaces';
import { Market } from '@ghostfolio/common/types';
import type { Order } from '@ghostfolio/prisma/browser';

export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 {
  alias?: string;
  hasDetails: boolean;
  holdings: Pick<
    PortfolioPosition,
    | 'allocationInPercentage'
    | 'assetProfile'
    | 'dateOfFirstActivity'
    | 'markets'
    | 'netPerformancePercentWithCurrencyEffect'
    | 'valueInPercentage'
  >[];
  latestActivities: (Pick<
    Order,
    'currency' | 'date' | 'fee' | 'quantity' | 'type' | 'unitPrice'
  > & {
    assetProfile: Pick<
      EnhancedAssetProfile,
      'currency' | 'dataSource' | 'name' | 'symbol'
    >;
    value: number;
    valueInBaseCurrency: number;
  })[];
  markets: {
    [key in Market]: Pick<
      NonNullable<PortfolioDetails['markets']>[key],
      'id' | 'valueInPercentage'
    >;
  };
}

interface PublicPortfolioResponseV1 {
  createdAt: Date;
  performance: {
    '1d': {
      relativeChange: number;
    };
    max: {
      relativeChange: number;
    };
    ytd: {
      relativeChange: number;
    };
  };
}