Compare commits
39 Commits
2.97.0
...
2.103.0-al
Author | SHA1 | Date | |
---|---|---|---|
40de0cead5 | |||
43f5bb7773 | |||
e85cc0fcfc | |||
dc1948016f | |||
4410040a14 | |||
b2ed0b2c80 | |||
42fe653e1e | |||
8a81fa814f | |||
98f3fa9d7c | |||
202e27fe25 | |||
757ff527d0 | |||
41f5801b5e | |||
4c7657a90e | |||
aef650753e | |||
420f331be9 | |||
e0068c4d5d | |||
85661884a6 | |||
8f6203d296 | |||
2fa723dc3c | |||
a500fb72c5 | |||
02db0db733 | |||
c87b08ca8b | |||
fcc2ab1a48 | |||
7efda2f890 | |||
3794a61d2d | |||
c1d1ea9dde | |||
0d676a46c8 | |||
97db144e01 | |||
cec55127c8 | |||
f3f359bcfb | |||
601e6f4147 | |||
e228b4925c | |||
62e3ffe413 | |||
6af885fde0 | |||
dd15bba359 | |||
43fca7ff43 | |||
faa6af5694 | |||
d2ea7a0bfb | |||
3f6319e00b |
10
.github/workflows/build-code.yml
vendored
10
.github/workflows/build-code.yml
vendored
@ -24,16 +24,16 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
cache: 'yarn'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: npm ci
|
||||
|
||||
- name: Check formatting
|
||||
run: yarn format:check
|
||||
run: npm run format:check
|
||||
|
||||
- name: Execute tests
|
||||
run: yarn test
|
||||
run: npm test
|
||||
|
||||
- name: Build application
|
||||
run: yarn build:production
|
||||
run: npm run build:production
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,8 +5,8 @@
|
||||
/tmp
|
||||
|
||||
# dependencies
|
||||
/.yarn
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
@ -34,10 +34,8 @@
|
||||
/coverage
|
||||
/dist
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
testem.log
|
||||
/typings
|
||||
yarn-error.log
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
|
75
CHANGELOG.md
75
CHANGELOG.md
@ -5,6 +5,81 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 2.103.0-alpha - 2024-08-08
|
||||
|
||||
### Changed
|
||||
|
||||
- Optimized the docker image layers to reduce the image size
|
||||
- Updated the binary targets of `debian-openssl` for `prisma`
|
||||
|
||||
## 2.102.0 - 2024-08-07
|
||||
|
||||
### Added
|
||||
|
||||
- Added support to clone an activity from the account detail dialog (experimental)
|
||||
- Added support to edit an activity from the account detail dialog (experimental)
|
||||
- Added support to clone an activity from the holding detail dialog (experimental)
|
||||
- Added support to edit an activity from the holding detail dialog (experimental)
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved the caching of the benchmarks in the markets overview by returning cached data and recalculating in the background when it expires
|
||||
- Improved the language localization for German (`de`)
|
||||
- Improved the language localization for Polish (`pl`)
|
||||
- Upgraded `Nx` from version `19.5.1` to `19.5.6`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the cache flush endpoint response
|
||||
|
||||
## 2.101.0 - 2024-08-03
|
||||
|
||||
### Changed
|
||||
|
||||
- Hardened container security by switching to a non-root user, setting the filesystem to read-only, and dropping unnecessary capabilities
|
||||
|
||||
## 2.100.0 - 2024-08-03
|
||||
|
||||
### Added
|
||||
|
||||
- Added support to manage tags of holdings in the holding detail dialog
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved the color assignment in the chart of the holdings tab on the home page (experimental)
|
||||
- Persisted the view mode of the holdings tab on the home page (experimental)
|
||||
- Improved the language localization for Catalan (`ca`)
|
||||
- Improved the language localization for Spanish (`es`)
|
||||
|
||||
## 2.99.0 - 2024-07-29
|
||||
|
||||
### Changed
|
||||
|
||||
- Migrated the usage of `yarn` to `npm`
|
||||
- Upgraded `storybook` from version `7.0.9` to `8.2.5`
|
||||
- Downgraded `marked` from version `13.0.0` to `12.0.2`
|
||||
|
||||
## 2.98.0 - 2024-07-27
|
||||
|
||||
### Added
|
||||
|
||||
- Set up the language localization for Catalan (`ca`)
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved the account selector of the create or update activity dialog
|
||||
- Improved the handling of the numerical precision in the value component
|
||||
- Skipped derived currencies in the get quotes functionality of the data provider service
|
||||
- Improved the language localization for Spanish (`es`)
|
||||
- Upgraded `angular` from version `18.0.4` to `18.1.1`
|
||||
- Upgraded `Nx` from version `19.4.3` to `19.5.1`
|
||||
- Upgraded `prisma` from version `5.16.1` to `5.17.0`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the dividend import from a data provider for holdings without an account
|
||||
- Fixed an issue in the public page related to a non-existent access
|
||||
|
||||
## 2.97.0 - 2024-07-20
|
||||
|
||||
### Added
|
||||
|
@ -30,26 +30,26 @@ Use `@if (user?.settings?.isExperimentalFeatures) {}` in HTML template
|
||||
|
||||
#### Upgrade
|
||||
|
||||
1. Run `yarn nx migrate latest`
|
||||
1. Make sure `package.json` changes make sense and then run `yarn install`
|
||||
1. Run `yarn nx migrate --run-migrations` (Run `YARN_NODE_LINKER="node-modules" NX_MIGRATE_SKIP_INSTALL=1 yarn nx migrate --run-migrations` due to https://github.com/nrwl/nx/issues/16338)
|
||||
1. Run `npx nx migrate latest`
|
||||
1. Make sure `package.json` changes make sense and then run `npm install`
|
||||
1. Run `npx nx migrate --run-migrations`
|
||||
|
||||
### Prisma
|
||||
|
||||
#### Access database via GUI
|
||||
|
||||
Run `yarn database:gui`
|
||||
Run `npm run database:gui`
|
||||
|
||||
https://www.prisma.io/studio
|
||||
|
||||
#### Synchronize schema with database for prototyping
|
||||
|
||||
Run `yarn database:push`
|
||||
Run `npm run database:push`
|
||||
|
||||
https://www.prisma.io/docs/concepts/components/prisma-migrate/db-push
|
||||
|
||||
#### Create schema migration
|
||||
|
||||
Run `yarn prisma migrate dev --name added_job_title`
|
||||
Run `npm run prisma migrate dev --name added_job_title`
|
||||
|
||||
https://www.prisma.io/docs/concepts/components/prisma-migrate#getting-started-with-prisma-migrate
|
||||
|
47
Dockerfile
47
Dockerfile
@ -1,25 +1,25 @@
|
||||
FROM --platform=$BUILDPLATFORM node:20-slim as builder
|
||||
FROM --platform=$BUILDPLATFORM node:20-slim AS builder
|
||||
|
||||
# Build application and add additional files
|
||||
WORKDIR /ghostfolio
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-suggests \
|
||||
g++ \
|
||||
git \
|
||||
make \
|
||||
openssl \
|
||||
python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Only add basic files without the application itself to avoid rebuilding
|
||||
# layers when files (package.json etc.) have not changed
|
||||
COPY ./CHANGELOG.md CHANGELOG.md
|
||||
COPY ./LICENSE LICENSE
|
||||
COPY ./package.json package.json
|
||||
COPY ./yarn.lock yarn.lock
|
||||
COPY ./.yarnrc .yarnrc
|
||||
COPY ./package-lock.json package-lock.json
|
||||
COPY ./prisma/schema.prisma prisma/schema.prisma
|
||||
|
||||
RUN apt update && apt install -y \
|
||||
g++ \
|
||||
git \
|
||||
make \
|
||||
openssl \
|
||||
python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN yarn install
|
||||
RUN npm install
|
||||
|
||||
# See https://github.com/nrwl/nx/issues/6586 for further details
|
||||
COPY ./decorate-angular-cli.js decorate-angular-cli.js
|
||||
@ -33,34 +33,35 @@ COPY ./tsconfig.base.json tsconfig.base.json
|
||||
COPY ./libs libs
|
||||
COPY ./apps apps
|
||||
|
||||
RUN yarn build:production
|
||||
RUN npm run build:production
|
||||
|
||||
# Prepare the dist image with additional node_modules
|
||||
WORKDIR /ghostfolio/dist/apps/api
|
||||
# package.json was generated by the build process, however the original
|
||||
# yarn.lock needs to be used to ensure the same versions
|
||||
COPY ./yarn.lock /ghostfolio/dist/apps/api/yarn.lock
|
||||
# package-lock.json needs to be used to ensure the same versions
|
||||
COPY ./package-lock.json /ghostfolio/dist/apps/api/package-lock.json
|
||||
|
||||
RUN yarn
|
||||
RUN npm install
|
||||
COPY prisma /ghostfolio/dist/apps/api/prisma
|
||||
|
||||
# Overwrite the generated package.json with the original one to ensure having
|
||||
# all the scripts
|
||||
COPY package.json /ghostfolio/dist/apps/api
|
||||
RUN yarn database:generate-typings
|
||||
RUN npm run database:generate-typings
|
||||
|
||||
# Image to run, copy everything needed from builder
|
||||
FROM node:20-slim
|
||||
|
||||
LABEL org.opencontainers.image.source="https://github.com/ghostfolio/ghostfolio"
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN apt update && apt install -y \
|
||||
curl \
|
||||
openssl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y --no-install-suggests \
|
||||
curl \
|
||||
openssl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps
|
||||
COPY ./docker/entrypoint.sh /ghostfolio/entrypoint.sh
|
||||
COPY --chown=node:node --from=builder /ghostfolio/dist/apps /ghostfolio/apps
|
||||
COPY --chown=node:node ./docker/entrypoint.sh /ghostfolio/entrypoint.sh
|
||||
WORKDIR /ghostfolio/apps/api
|
||||
EXPOSE ${PORT:-3333}
|
||||
USER node
|
||||
CMD [ "/ghostfolio/entrypoint.sh" ]
|
||||
|
19
README.md
19
README.md
@ -71,7 +71,7 @@ The backend is based on [NestJS](https://nestjs.com) using [PostgreSQL](https://
|
||||
|
||||
### Frontend
|
||||
|
||||
The frontend is built with [Angular](https://angular.io) and uses [Angular Material](https://material.angular.io) with utility classes from [Bootstrap](https://getbootstrap.com).
|
||||
The frontend is built with [Angular](https://angular.dev) and uses [Angular Material](https://material.angular.io) with utility classes from [Bootstrap](https://getbootstrap.com).
|
||||
|
||||
## Self-hosting
|
||||
|
||||
@ -150,15 +150,14 @@ Ghostfolio is available for various home server systems, including [CasaOS](http
|
||||
|
||||
- [Docker](https://www.docker.com/products/docker-desktop)
|
||||
- [Node.js](https://nodejs.org/en/download) (version 20+)
|
||||
- [Yarn](https://yarnpkg.com/en/docs/install)
|
||||
- Create a local copy of this Git repository (clone)
|
||||
- Copy the file `.env.dev` to `.env` and populate it with your data (`cp .env.dev .env`)
|
||||
|
||||
### Setup
|
||||
|
||||
1. Run `yarn install`
|
||||
1. Run `npm install`
|
||||
1. Run `docker compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io)
|
||||
1. Run `yarn database:setup` to initialize the database schema
|
||||
1. Run `npm run database:setup` to initialize the database schema
|
||||
1. Run `git config core.hooksPath ./git-hooks/` to setup git hooks
|
||||
1. Start the server and the client (see [_Development_](#Development))
|
||||
1. Open https://localhost:4200/en in your browser
|
||||
@ -168,31 +167,31 @@ Ghostfolio is available for various home server systems, including [CasaOS](http
|
||||
|
||||
#### Debug
|
||||
|
||||
Run `yarn watch:server` and click _Debug API_ in [Visual Studio Code](https://code.visualstudio.com)
|
||||
Run `npm run watch:server` and click _Debug API_ in [Visual Studio Code](https://code.visualstudio.com)
|
||||
|
||||
#### Serve
|
||||
|
||||
Run `yarn start:server`
|
||||
Run `npm run start:server`
|
||||
|
||||
### Start Client
|
||||
|
||||
Run `yarn start:client` and open https://localhost:4200/en in your browser
|
||||
Run `npm run start:client` and open https://localhost:4200/en in your browser
|
||||
|
||||
### Start _Storybook_
|
||||
|
||||
Run `yarn start:storybook`
|
||||
Run `npm run start:storybook`
|
||||
|
||||
### Migrate Database
|
||||
|
||||
With the following command you can keep your database schema in sync:
|
||||
|
||||
```bash
|
||||
yarn database:push
|
||||
npm run database:push
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Run `yarn test`
|
||||
Run `npm test`
|
||||
|
||||
## Public API
|
||||
|
||||
|
@ -21,9 +21,9 @@ import {
|
||||
AdminMarketData,
|
||||
AdminMarketDataDetails,
|
||||
AdminMarketDataItem,
|
||||
AssetProfileIdentifier,
|
||||
EnhancedSymbolProfile,
|
||||
Filter,
|
||||
UniqueAsset
|
||||
Filter
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { MarketDataPreset } from '@ghostfolio/common/types';
|
||||
|
||||
@ -59,7 +59,9 @@ export class AdminService {
|
||||
currency,
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset & { currency?: string }): Promise<SymbolProfile | never> {
|
||||
}: AssetProfileIdentifier & { currency?: string }): Promise<
|
||||
SymbolProfile | never
|
||||
> {
|
||||
try {
|
||||
if (dataSource === 'MANUAL') {
|
||||
return this.symbolProfileService.add({
|
||||
@ -96,7 +98,10 @@ export class AdminService {
|
||||
}
|
||||
}
|
||||
|
||||
public async deleteProfileData({ dataSource, symbol }: UniqueAsset) {
|
||||
public async deleteProfileData({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
await this.marketDataService.deleteMany({ dataSource, symbol });
|
||||
await this.symbolProfileService.delete({ dataSource, symbol });
|
||||
}
|
||||
@ -325,7 +330,7 @@ export class AdminService {
|
||||
public async getMarketDataBySymbol({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset): Promise<AdminMarketDataDetails> {
|
||||
}: AssetProfileIdentifier): Promise<AdminMarketDataDetails> {
|
||||
let activitiesCount: EnhancedSymbolProfile['activitiesCount'] = 0;
|
||||
let currency: EnhancedSymbolProfile['currency'] = '-';
|
||||
let dateOfFirstActivity: EnhancedSymbolProfile['dateOfFirstActivity'];
|
||||
@ -386,7 +391,7 @@ export class AdminService {
|
||||
symbol,
|
||||
symbolMapping,
|
||||
url
|
||||
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
|
||||
}: AssetProfileIdentifier & Prisma.SymbolProfileUpdateInput) {
|
||||
const symbolProfileOverrides = {
|
||||
assetClass: assetClass as AssetClass,
|
||||
assetSubClass: assetSubClass as AssetSubClass,
|
||||
@ -394,28 +399,28 @@ export class AdminService {
|
||||
url: url as string
|
||||
};
|
||||
|
||||
const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset =
|
||||
{
|
||||
comment,
|
||||
countries,
|
||||
currency,
|
||||
dataSource,
|
||||
holdings,
|
||||
scraperConfiguration,
|
||||
sectors,
|
||||
symbol,
|
||||
symbolMapping,
|
||||
...(dataSource === 'MANUAL'
|
||||
? { assetClass, assetSubClass, name, url }
|
||||
: {
|
||||
SymbolProfileOverrides: {
|
||||
upsert: {
|
||||
create: symbolProfileOverrides,
|
||||
update: symbolProfileOverrides
|
||||
}
|
||||
const updatedSymbolProfile: AssetProfileIdentifier &
|
||||
Prisma.SymbolProfileUpdateInput = {
|
||||
comment,
|
||||
countries,
|
||||
currency,
|
||||
dataSource,
|
||||
holdings,
|
||||
scraperConfiguration,
|
||||
sectors,
|
||||
symbol,
|
||||
symbolMapping,
|
||||
...(dataSource === 'MANUAL'
|
||||
? { assetClass, assetSubClass, name, url }
|
||||
: {
|
||||
SymbolProfileOverrides: {
|
||||
upsert: {
|
||||
create: symbolProfileOverrides,
|
||||
update: symbolProfileOverrides
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
await this.symbolProfileService.updateSymbolProfile(updatedSymbolProfile);
|
||||
|
||||
|
@ -4,9 +4,9 @@ import { getInterval } from '@ghostfolio/api/helper/portfolio.helper';
|
||||
import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.interceptor';
|
||||
import { TransformDataSourceInResponseInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-response/transform-data-source-in-response.interceptor';
|
||||
import type {
|
||||
AssetProfileIdentifier,
|
||||
BenchmarkMarketDataDetails,
|
||||
BenchmarkResponse,
|
||||
UniqueAsset
|
||||
BenchmarkResponse
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { permissions } from '@ghostfolio/common/permissions';
|
||||
import type { DateRange, RequestWithUser } from '@ghostfolio/common/types';
|
||||
@ -41,7 +41,9 @@ export class BenchmarkController {
|
||||
@HasPermission(permissions.accessAdminControl)
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
public async addBenchmark(@Body() { dataSource, symbol }: UniqueAsset) {
|
||||
public async addBenchmark(
|
||||
@Body() { dataSource, symbol }: AssetProfileIdentifier
|
||||
) {
|
||||
try {
|
||||
const benchmark = await this.benchmarkService.addBenchmark({
|
||||
dataSource,
|
||||
|
@ -17,11 +17,11 @@ import {
|
||||
resetHours
|
||||
} from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
Benchmark,
|
||||
BenchmarkMarketDataDetails,
|
||||
BenchmarkProperty,
|
||||
BenchmarkResponse,
|
||||
UniqueAsset
|
||||
BenchmarkResponse
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { BenchmarkTrend } from '@ghostfolio/common/types';
|
||||
|
||||
@ -29,15 +29,19 @@ import { Injectable, Logger } from '@nestjs/common';
|
||||
import { SymbolProfile } from '@prisma/client';
|
||||
import { Big } from 'big.js';
|
||||
import {
|
||||
addHours,
|
||||
differenceInDays,
|
||||
eachDayOfInterval,
|
||||
format,
|
||||
isAfter,
|
||||
isSameDay,
|
||||
subDays
|
||||
} from 'date-fns';
|
||||
import { isNumber, last, uniqBy } from 'lodash';
|
||||
import ms from 'ms';
|
||||
|
||||
import { BenchmarkValue } from './interfaces/benchmark-value.interface';
|
||||
|
||||
@Injectable()
|
||||
export class BenchmarkService {
|
||||
private readonly CACHE_KEY_BENCHMARKS = 'BENCHMARKS';
|
||||
@ -61,7 +65,10 @@ export class BenchmarkService {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public async getBenchmarkTrends({ dataSource, symbol }: UniqueAsset) {
|
||||
public async getBenchmarkTrends({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
const historicalData = await this.marketDataService.marketDataItems({
|
||||
orderBy: {
|
||||
date: 'desc'
|
||||
@ -89,99 +96,26 @@ export class BenchmarkService {
|
||||
enableSharing = false,
|
||||
useCache = true
|
||||
} = {}): Promise<BenchmarkResponse['benchmarks']> {
|
||||
let benchmarks: BenchmarkResponse['benchmarks'];
|
||||
|
||||
if (useCache) {
|
||||
try {
|
||||
benchmarks = JSON.parse(
|
||||
await this.redisCacheService.get(this.CACHE_KEY_BENCHMARKS)
|
||||
const cachedBenchmarkValue = await this.redisCacheService.get(
|
||||
this.CACHE_KEY_BENCHMARKS
|
||||
);
|
||||
|
||||
if (benchmarks) {
|
||||
return benchmarks;
|
||||
const { benchmarks, expiration }: BenchmarkValue =
|
||||
JSON.parse(cachedBenchmarkValue);
|
||||
|
||||
if (isAfter(new Date(), new Date(expiration))) {
|
||||
this.calculateAndCacheBenchmarks({
|
||||
enableSharing
|
||||
});
|
||||
}
|
||||
|
||||
return benchmarks;
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles({
|
||||
enableSharing
|
||||
});
|
||||
|
||||
const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] =
|
||||
[];
|
||||
const promisesBenchmarkTrends: Promise<{
|
||||
trend50d: BenchmarkTrend;
|
||||
trend200d: BenchmarkTrend;
|
||||
}>[] = [];
|
||||
|
||||
const quotes = await this.dataProviderService.getQuotes({
|
||||
items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => {
|
||||
return { dataSource, symbol };
|
||||
}),
|
||||
requestTimeout: ms('30 seconds'),
|
||||
useCache: false
|
||||
});
|
||||
|
||||
for (const { dataSource, symbol } of benchmarkAssetProfiles) {
|
||||
promisesAllTimeHighs.push(
|
||||
this.marketDataService.getMax({ dataSource, symbol })
|
||||
);
|
||||
promisesBenchmarkTrends.push(
|
||||
this.getBenchmarkTrends({ dataSource, symbol })
|
||||
);
|
||||
}
|
||||
|
||||
const [allTimeHighs, benchmarkTrends] = await Promise.all([
|
||||
Promise.all(promisesAllTimeHighs),
|
||||
Promise.all(promisesBenchmarkTrends)
|
||||
]);
|
||||
let storeInCache = useCache;
|
||||
|
||||
benchmarks = allTimeHighs.map((allTimeHigh, index) => {
|
||||
const { marketPrice } =
|
||||
quotes[benchmarkAssetProfiles[index].symbol] ?? {};
|
||||
|
||||
let performancePercentFromAllTimeHigh = 0;
|
||||
|
||||
if (allTimeHigh?.marketPrice && marketPrice) {
|
||||
performancePercentFromAllTimeHigh = this.calculateChangeInPercentage(
|
||||
allTimeHigh.marketPrice,
|
||||
marketPrice
|
||||
);
|
||||
} else {
|
||||
storeInCache = false;
|
||||
}
|
||||
|
||||
return {
|
||||
dataSource: benchmarkAssetProfiles[index].dataSource,
|
||||
marketCondition: this.getMarketCondition(
|
||||
performancePercentFromAllTimeHigh
|
||||
),
|
||||
name: benchmarkAssetProfiles[index].name,
|
||||
performances: {
|
||||
allTimeHigh: {
|
||||
date: allTimeHigh?.date,
|
||||
performancePercent:
|
||||
performancePercentFromAllTimeHigh >= 0
|
||||
? 0
|
||||
: performancePercentFromAllTimeHigh
|
||||
}
|
||||
},
|
||||
symbol: benchmarkAssetProfiles[index].symbol,
|
||||
trend50d: benchmarkTrends[index].trend50d,
|
||||
trend200d: benchmarkTrends[index].trend200d
|
||||
};
|
||||
});
|
||||
|
||||
if (storeInCache) {
|
||||
await this.redisCacheService.set(
|
||||
this.CACHE_KEY_BENCHMARKS,
|
||||
JSON.stringify(benchmarks),
|
||||
ms('2 hours') / 1000
|
||||
);
|
||||
}
|
||||
|
||||
return benchmarks;
|
||||
return this.calculateAndCacheBenchmarks({ enableSharing });
|
||||
}
|
||||
|
||||
public async getBenchmarkAssetProfiles({
|
||||
@ -228,7 +162,7 @@ export class BenchmarkService {
|
||||
endDate?: Date;
|
||||
startDate: Date;
|
||||
userCurrency: string;
|
||||
} & UniqueAsset): Promise<BenchmarkMarketDataDetails> {
|
||||
} & AssetProfileIdentifier): Promise<BenchmarkMarketDataDetails> {
|
||||
const marketData: { date: string; value: number }[] = [];
|
||||
|
||||
const days = differenceInDays(endDate, startDate) + 1;
|
||||
@ -348,7 +282,7 @@ export class BenchmarkService {
|
||||
public async addBenchmark({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset): Promise<Partial<SymbolProfile>> {
|
||||
}: AssetProfileIdentifier): Promise<Partial<SymbolProfile>> {
|
||||
const assetProfile = await this.prismaService.symbolProfile.findFirst({
|
||||
where: {
|
||||
dataSource,
|
||||
@ -385,7 +319,7 @@ export class BenchmarkService {
|
||||
public async deleteBenchmark({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset): Promise<Partial<SymbolProfile>> {
|
||||
}: AssetProfileIdentifier): Promise<Partial<SymbolProfile>> {
|
||||
const assetProfile = await this.prismaService.symbolProfile.findFirst({
|
||||
where: {
|
||||
dataSource,
|
||||
@ -419,6 +353,95 @@ export class BenchmarkService {
|
||||
};
|
||||
}
|
||||
|
||||
private async calculateAndCacheBenchmarks({
|
||||
enableSharing = false
|
||||
}): Promise<BenchmarkResponse['benchmarks']> {
|
||||
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles({
|
||||
enableSharing
|
||||
});
|
||||
|
||||
const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] =
|
||||
[];
|
||||
const promisesBenchmarkTrends: Promise<{
|
||||
trend50d: BenchmarkTrend;
|
||||
trend200d: BenchmarkTrend;
|
||||
}>[] = [];
|
||||
|
||||
const quotes = await this.dataProviderService.getQuotes({
|
||||
items: benchmarkAssetProfiles.map(({ dataSource, symbol }) => {
|
||||
return { dataSource, symbol };
|
||||
}),
|
||||
requestTimeout: ms('30 seconds'),
|
||||
useCache: false
|
||||
});
|
||||
|
||||
for (const { dataSource, symbol } of benchmarkAssetProfiles) {
|
||||
promisesAllTimeHighs.push(
|
||||
this.marketDataService.getMax({ dataSource, symbol })
|
||||
);
|
||||
promisesBenchmarkTrends.push(
|
||||
this.getBenchmarkTrends({ dataSource, symbol })
|
||||
);
|
||||
}
|
||||
|
||||
const [allTimeHighs, benchmarkTrends] = await Promise.all([
|
||||
Promise.all(promisesAllTimeHighs),
|
||||
Promise.all(promisesBenchmarkTrends)
|
||||
]);
|
||||
let storeInCache = true;
|
||||
|
||||
const benchmarks = allTimeHighs.map((allTimeHigh, index) => {
|
||||
const { marketPrice } =
|
||||
quotes[benchmarkAssetProfiles[index].symbol] ?? {};
|
||||
|
||||
let performancePercentFromAllTimeHigh = 0;
|
||||
|
||||
if (allTimeHigh?.marketPrice && marketPrice) {
|
||||
performancePercentFromAllTimeHigh = this.calculateChangeInPercentage(
|
||||
allTimeHigh.marketPrice,
|
||||
marketPrice
|
||||
);
|
||||
} else {
|
||||
storeInCache = false;
|
||||
}
|
||||
|
||||
return {
|
||||
dataSource: benchmarkAssetProfiles[index].dataSource,
|
||||
marketCondition: this.getMarketCondition(
|
||||
performancePercentFromAllTimeHigh
|
||||
),
|
||||
name: benchmarkAssetProfiles[index].name,
|
||||
performances: {
|
||||
allTimeHigh: {
|
||||
date: allTimeHigh?.date,
|
||||
performancePercent:
|
||||
performancePercentFromAllTimeHigh >= 0
|
||||
? 0
|
||||
: performancePercentFromAllTimeHigh
|
||||
}
|
||||
},
|
||||
symbol: benchmarkAssetProfiles[index].symbol,
|
||||
trend50d: benchmarkTrends[index].trend50d,
|
||||
trend200d: benchmarkTrends[index].trend200d
|
||||
};
|
||||
});
|
||||
|
||||
if (storeInCache) {
|
||||
const expiration = addHours(new Date(), 2);
|
||||
|
||||
await this.redisCacheService.set(
|
||||
this.CACHE_KEY_BENCHMARKS,
|
||||
JSON.stringify(<BenchmarkValue>{
|
||||
benchmarks,
|
||||
expiration: expiration.getTime()
|
||||
}),
|
||||
ms('12 hours') / 1000
|
||||
);
|
||||
}
|
||||
|
||||
return benchmarks;
|
||||
}
|
||||
|
||||
private getMarketCondition(
|
||||
aPerformanceInPercent: number
|
||||
): Benchmark['marketCondition'] {
|
||||
|
@ -0,0 +1,6 @@
|
||||
import { BenchmarkResponse } from '@ghostfolio/common/interfaces';
|
||||
|
||||
export interface BenchmarkValue {
|
||||
benchmarks: BenchmarkResponse['benchmarks'];
|
||||
expiration: number;
|
||||
}
|
2
apps/api/src/app/cache/cache.controller.ts
vendored
2
apps/api/src/app/cache/cache.controller.ts
vendored
@ -14,6 +14,6 @@ export class CacheController {
|
||||
@Post('flush')
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
public async flushCache(): Promise<void> {
|
||||
return this.redisCacheService.reset();
|
||||
await this.redisCacheService.reset();
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
getAssetProfileIdentifier,
|
||||
parseDate
|
||||
} from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AccountWithPlatform,
|
||||
OrderWithAccount,
|
||||
@ -51,7 +51,7 @@ export class ImportService {
|
||||
dataSource,
|
||||
symbol,
|
||||
userCurrency
|
||||
}: UniqueAsset & { userCurrency: string }): Promise<Activity[]> {
|
||||
}: AssetProfileIdentifier & { userCurrency: string }): Promise<Activity[]> {
|
||||
try {
|
||||
const { firstBuyDate, historicalData, orders } =
|
||||
await this.portfolioService.getPosition(dataSource, undefined, symbol);
|
||||
@ -72,9 +72,13 @@ export class ImportService {
|
||||
})
|
||||
]);
|
||||
|
||||
const accounts = orders.map((order) => {
|
||||
return order.Account;
|
||||
});
|
||||
const accounts = orders
|
||||
.filter(({ Account }) => {
|
||||
return !!Account;
|
||||
})
|
||||
.map(({ Account }) => {
|
||||
return Account;
|
||||
});
|
||||
|
||||
const Account = this.isUniqueAccount(accounts) ? accounts[0] : undefined;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
||||
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { HttpException, Injectable } from '@nestjs/common';
|
||||
import { DataSource } from '@prisma/client';
|
||||
@ -17,7 +17,7 @@ export class LogoService {
|
||||
public async getLogoByDataSourceAndSymbol({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset) {
|
||||
}: AssetProfileIdentifier) {
|
||||
if (!DataSource[dataSource]) {
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.NOT_FOUND),
|
||||
|
@ -36,7 +36,7 @@ import { parseISO } from 'date-fns';
|
||||
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
|
||||
|
||||
import { CreateOrderDto } from './create-order.dto';
|
||||
import { Activities } from './interfaces/activities.interface';
|
||||
import { Activities, Activity } from './interfaces/activities.interface';
|
||||
import { OrderService } from './order.service';
|
||||
import { UpdateOrderDto } from './update-order.dto';
|
||||
|
||||
@ -140,6 +140,38 @@ export class OrderController {
|
||||
return { activities, count };
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
@UseInterceptors(RedactValuesInResponseInterceptor)
|
||||
@UseInterceptors(TransformDataSourceInResponseInterceptor)
|
||||
public async getOrderById(
|
||||
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId,
|
||||
@Param('id') id: string
|
||||
): Promise<Activity> {
|
||||
const impersonationUserId =
|
||||
await this.impersonationService.validateImpersonationId(impersonationId);
|
||||
const userCurrency = this.request.user.Settings.settings.baseCurrency;
|
||||
|
||||
const { activities } = await this.orderService.getOrders({
|
||||
userCurrency,
|
||||
userId: impersonationUserId || this.request.user.id,
|
||||
withExcludedAccounts: true
|
||||
});
|
||||
|
||||
const activity = activities.find((activity) => {
|
||||
return activity.id === id;
|
||||
});
|
||||
|
||||
if (!activity) {
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.NOT_FOUND),
|
||||
StatusCodes.NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
return activity;
|
||||
}
|
||||
|
||||
@HasPermission(permissions.createOrder)
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
|
@ -11,9 +11,9 @@ import {
|
||||
} from '@ghostfolio/common/config';
|
||||
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
EnhancedSymbolProfile,
|
||||
Filter,
|
||||
UniqueAsset
|
||||
Filter
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { OrderWithAccount } from '@ghostfolio/common/types';
|
||||
|
||||
@ -46,6 +46,39 @@ export class OrderService {
|
||||
private readonly symbolProfileService: SymbolProfileService
|
||||
) {}
|
||||
|
||||
public async assignTags({
|
||||
dataSource,
|
||||
symbol,
|
||||
tags,
|
||||
userId
|
||||
}: { tags: Tag[]; userId: string } & AssetProfileIdentifier) {
|
||||
const orders = await this.prismaService.order.findMany({
|
||||
where: {
|
||||
userId,
|
||||
SymbolProfile: {
|
||||
dataSource,
|
||||
symbol
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(
|
||||
orders.map(({ id }) =>
|
||||
this.prismaService.order.update({
|
||||
data: {
|
||||
tags: {
|
||||
// The set operation replaces all existing connections with the provided ones
|
||||
set: tags.map(({ id }) => {
|
||||
return { id };
|
||||
})
|
||||
}
|
||||
},
|
||||
where: { id }
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public async createOrder(
|
||||
data: Prisma.OrderCreateInput & {
|
||||
accountId?: string;
|
||||
@ -252,7 +285,7 @@ export class OrderService {
|
||||
return count;
|
||||
}
|
||||
|
||||
public async getLatestOrder({ dataSource, symbol }: UniqueAsset) {
|
||||
public async getLatestOrder({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.prismaService.order.findFirst({
|
||||
orderBy: {
|
||||
date: 'desc'
|
||||
@ -431,7 +464,7 @@ export class OrderService {
|
||||
this.prismaService.order.count({ where })
|
||||
]);
|
||||
|
||||
const uniqueAssets = uniqBy(
|
||||
const assetProfileIdentifiers = uniqBy(
|
||||
orders.map(({ SymbolProfile }) => {
|
||||
return {
|
||||
dataSource: SymbolProfile.dataSource,
|
||||
@ -446,8 +479,9 @@ export class OrderService {
|
||||
}
|
||||
);
|
||||
|
||||
const assetProfiles =
|
||||
await this.symbolProfileService.getSymbolProfiles(uniqueAssets);
|
||||
const assetProfiles = await this.symbolProfileService.getSymbolProfiles(
|
||||
assetProfileIdentifiers
|
||||
);
|
||||
|
||||
const activities = orders.map((order) => {
|
||||
const assetProfile = assetProfiles.find(({ dataSource, symbol }) => {
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator';
|
||||
import { SymbolMetrics, UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
SymbolMetrics
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { PortfolioSnapshot, TimelinePosition } from '@ghostfolio/common/models';
|
||||
|
||||
export class MWRPortfolioCalculator extends PortfolioCalculator {
|
||||
@ -27,7 +30,7 @@ export class MWRPortfolioCalculator extends PortfolioCalculator {
|
||||
};
|
||||
start: Date;
|
||||
step?: number;
|
||||
} & UniqueAsset): SymbolMetrics {
|
||||
} & AssetProfileIdentifier): SymbolMetrics {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ import {
|
||||
resetHours
|
||||
} from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
DataProviderInfo,
|
||||
HistoricalDataItem,
|
||||
InvestmentItem,
|
||||
ResponseError,
|
||||
SymbolMetrics,
|
||||
UniqueAsset
|
||||
SymbolMetrics
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { PortfolioSnapshot, TimelinePosition } from '@ghostfolio/common/models';
|
||||
import { DateRange, GroupBy } from '@ghostfolio/common/types';
|
||||
@ -356,15 +356,15 @@ export abstract class PortfolioCalculator {
|
||||
dataSource: item.dataSource,
|
||||
fee: item.fee,
|
||||
firstBuyDate: item.firstBuyDate,
|
||||
grossPerformance: !hasErrors ? grossPerformance ?? null : null,
|
||||
grossPerformance: !hasErrors ? (grossPerformance ?? null) : null,
|
||||
grossPerformancePercentage: !hasErrors
|
||||
? grossPerformancePercentage ?? null
|
||||
? (grossPerformancePercentage ?? null)
|
||||
: null,
|
||||
grossPerformancePercentageWithCurrencyEffect: !hasErrors
|
||||
? grossPerformancePercentageWithCurrencyEffect ?? null
|
||||
? (grossPerformancePercentageWithCurrencyEffect ?? null)
|
||||
: null,
|
||||
grossPerformanceWithCurrencyEffect: !hasErrors
|
||||
? grossPerformanceWithCurrencyEffect ?? null
|
||||
? (grossPerformanceWithCurrencyEffect ?? null)
|
||||
: null,
|
||||
investment: totalInvestment,
|
||||
investmentWithCurrencyEffect: totalInvestmentWithCurrencyEffect,
|
||||
@ -372,15 +372,15 @@ export abstract class PortfolioCalculator {
|
||||
marketSymbolMap[endDateString]?.[item.symbol]?.toNumber() ?? null,
|
||||
marketPriceInBaseCurrency:
|
||||
marketPriceInBaseCurrency?.toNumber() ?? null,
|
||||
netPerformance: !hasErrors ? netPerformance ?? null : null,
|
||||
netPerformance: !hasErrors ? (netPerformance ?? null) : null,
|
||||
netPerformancePercentage: !hasErrors
|
||||
? netPerformancePercentage ?? null
|
||||
? (netPerformancePercentage ?? null)
|
||||
: null,
|
||||
netPerformancePercentageWithCurrencyEffect: !hasErrors
|
||||
? netPerformancePercentageWithCurrencyEffect ?? null
|
||||
? (netPerformancePercentageWithCurrencyEffect ?? null)
|
||||
: null,
|
||||
netPerformanceWithCurrencyEffect: !hasErrors
|
||||
? netPerformanceWithCurrencyEffect ?? null
|
||||
? (netPerformanceWithCurrencyEffect ?? null)
|
||||
: null,
|
||||
quantity: item.quantity,
|
||||
symbol: item.symbol,
|
||||
@ -905,7 +905,7 @@ export abstract class PortfolioCalculator {
|
||||
};
|
||||
start: Date;
|
||||
step?: number;
|
||||
} & UniqueAsset): SymbolMetrics;
|
||||
} & AssetProfileIdentifier): SymbolMetrics;
|
||||
|
||||
public getTransactionPoints() {
|
||||
return this.transactionPoints;
|
||||
|
@ -2,7 +2,10 @@ import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/po
|
||||
import { PortfolioOrderItem } from '@ghostfolio/api/app/portfolio/interfaces/portfolio-order-item.interface';
|
||||
import { getFactor } from '@ghostfolio/api/helper/portfolio.helper';
|
||||
import { DATE_FORMAT } from '@ghostfolio/common/helper';
|
||||
import { SymbolMetrics, UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
SymbolMetrics
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { PortfolioSnapshot, TimelinePosition } from '@ghostfolio/common/models';
|
||||
|
||||
import { Logger } from '@nestjs/common';
|
||||
@ -151,7 +154,7 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
|
||||
};
|
||||
start: Date;
|
||||
step?: number;
|
||||
} & UniqueAsset): SymbolMetrics {
|
||||
} & AssetProfileIdentifier): SymbolMetrics {
|
||||
const currentExchangeRate = exchangeRates[format(new Date(), DATE_FORMAT)];
|
||||
const currentValues: { [date: string]: Big } = {};
|
||||
const currentValuesWithCurrencyEffect: { [date: string]: Big } = {};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
|
||||
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
|
||||
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { DataSource, MarketData } from '@prisma/client';
|
||||
|
||||
@ -24,32 +24,32 @@ jest.mock('@ghostfolio/api/services/market-data/market-data.service', () => {
|
||||
});
|
||||
},
|
||||
getRange: ({
|
||||
assetProfileIdentifiers,
|
||||
dateRangeEnd,
|
||||
dateRangeStart,
|
||||
uniqueAssets
|
||||
dateRangeStart
|
||||
}: {
|
||||
assetProfileIdentifiers: AssetProfileIdentifier[];
|
||||
dateRangeEnd: Date;
|
||||
dateRangeStart: Date;
|
||||
uniqueAssets: UniqueAsset[];
|
||||
}) => {
|
||||
return Promise.resolve<MarketData[]>([
|
||||
{
|
||||
createdAt: dateRangeStart,
|
||||
dataSource: uniqueAssets[0].dataSource,
|
||||
dataSource: assetProfileIdentifiers[0].dataSource,
|
||||
date: dateRangeStart,
|
||||
id: '8fa48fde-f397-4b0d-adbc-fb940e830e6d',
|
||||
marketPrice: 1841.823902,
|
||||
state: 'CLOSE',
|
||||
symbol: uniqueAssets[0].symbol
|
||||
symbol: assetProfileIdentifiers[0].symbol
|
||||
},
|
||||
{
|
||||
createdAt: dateRangeEnd,
|
||||
dataSource: uniqueAssets[0].dataSource,
|
||||
dataSource: assetProfileIdentifiers[0].dataSource,
|
||||
date: dateRangeEnd,
|
||||
id: '082d6893-df27-4c91-8a5d-092e84315b56',
|
||||
marketPrice: 1847.839966,
|
||||
state: 'CLOSE',
|
||||
symbol: uniqueAssets[0].symbol
|
||||
symbol: assetProfileIdentifiers[0].symbol
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ import { DataProviderService } from '@ghostfolio/api/services/data-provider/data
|
||||
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
|
||||
import { resetHours } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
DataProviderInfo,
|
||||
ResponseError,
|
||||
UniqueAsset
|
||||
ResponseError
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import type { RequestWithUser } from '@ghostfolio/common/types';
|
||||
|
||||
@ -80,17 +80,16 @@ export class CurrentRateService {
|
||||
);
|
||||
}
|
||||
|
||||
const uniqueAssets: UniqueAsset[] = dataGatheringItems.map(
|
||||
({ dataSource, symbol }) => {
|
||||
const assetProfileIdentifiers: AssetProfileIdentifier[] =
|
||||
dataGatheringItems.map(({ dataSource, symbol }) => {
|
||||
return { dataSource, symbol };
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
promises.push(
|
||||
this.marketDataService
|
||||
.getRange({
|
||||
dateQuery,
|
||||
uniqueAssets
|
||||
assetProfileIdentifiers,
|
||||
dateQuery
|
||||
})
|
||||
.then((data) => {
|
||||
return data.map(({ dataSource, date, marketPrice, symbol }) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
export interface GetValueObject extends UniqueAsset {
|
||||
export interface GetValueObject extends AssetProfileIdentifier {
|
||||
date: Date;
|
||||
marketPrice: number;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { AccessService } from '@ghostfolio/api/app/access/access.service';
|
||||
import { OrderService } from '@ghostfolio/api/app/order/order.service';
|
||||
import { UserService } from '@ghostfolio/api/app/user/user.service';
|
||||
import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator';
|
||||
import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard';
|
||||
import {
|
||||
hasNotDefinedValuesInObject,
|
||||
@ -29,7 +30,8 @@ import {
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
hasReadRestrictedAccessPermission,
|
||||
isRestrictedView
|
||||
isRestrictedView,
|
||||
permissions
|
||||
} from '@ghostfolio/common/permissions';
|
||||
import type {
|
||||
DateRange,
|
||||
@ -38,12 +40,14 @@ import type {
|
||||
} from '@ghostfolio/common/types';
|
||||
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Headers,
|
||||
HttpException,
|
||||
Inject,
|
||||
Param,
|
||||
Put,
|
||||
Query,
|
||||
UseGuards,
|
||||
UseInterceptors,
|
||||
@ -51,12 +55,13 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { AssetClass, AssetSubClass } from '@prisma/client';
|
||||
import { AssetClass, AssetSubClass, DataSource } from '@prisma/client';
|
||||
import { Big } from 'big.js';
|
||||
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
|
||||
|
||||
import { PortfolioHoldingDetail } from './interfaces/portfolio-holding-detail.interface';
|
||||
import { PortfolioService } from './portfolio.service';
|
||||
import { UpdateHoldingTagsDto } from './update-holding-tags.dto';
|
||||
|
||||
@Controller('portfolio')
|
||||
export class PortfolioController {
|
||||
@ -496,9 +501,6 @@ export class PortfolioController {
|
||||
@Param('accessId') accessId
|
||||
): Promise<PortfolioPublicDetails> {
|
||||
const access = await this.accessService.access({ id: accessId });
|
||||
const user = await this.userService.user({
|
||||
id: access.userId
|
||||
});
|
||||
|
||||
if (!access) {
|
||||
throw new HttpException(
|
||||
@ -508,6 +510,11 @@ export class PortfolioController {
|
||||
}
|
||||
|
||||
let hasDetails = true;
|
||||
|
||||
const user = await this.userService.user({
|
||||
id: access.userId
|
||||
});
|
||||
|
||||
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
|
||||
hasDetails = user.subscription.type === 'Premium';
|
||||
}
|
||||
@ -564,23 +571,23 @@ export class PortfolioController {
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
public async getPosition(
|
||||
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string,
|
||||
@Param('dataSource') dataSource,
|
||||
@Param('symbol') symbol
|
||||
@Param('dataSource') dataSource: DataSource,
|
||||
@Param('symbol') symbol: string
|
||||
): Promise<PortfolioHoldingDetail> {
|
||||
const position = await this.portfolioService.getPosition(
|
||||
const holding = await this.portfolioService.getPosition(
|
||||
dataSource,
|
||||
impersonationId,
|
||||
symbol
|
||||
);
|
||||
|
||||
if (position) {
|
||||
return position;
|
||||
if (!holding) {
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.NOT_FOUND),
|
||||
StatusCodes.NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.NOT_FOUND),
|
||||
StatusCodes.NOT_FOUND
|
||||
);
|
||||
return holding;
|
||||
}
|
||||
|
||||
@Get('report')
|
||||
@ -603,4 +610,36 @@ export class PortfolioController {
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
@HasPermission(permissions.updateOrder)
|
||||
@Put('position/:dataSource/:symbol/tags')
|
||||
@UseInterceptors(TransformDataSourceInRequestInterceptor)
|
||||
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
|
||||
public async updateHoldingTags(
|
||||
@Body() data: UpdateHoldingTagsDto,
|
||||
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string,
|
||||
@Param('dataSource') dataSource: DataSource,
|
||||
@Param('symbol') symbol: string
|
||||
): Promise<void> {
|
||||
const holding = await this.portfolioService.getPosition(
|
||||
dataSource,
|
||||
impersonationId,
|
||||
symbol
|
||||
);
|
||||
|
||||
if (!holding) {
|
||||
throw new HttpException(
|
||||
getReasonPhrase(StatusCodes.NOT_FOUND),
|
||||
StatusCodes.NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
await this.portfolioService.updateTags({
|
||||
dataSource,
|
||||
impersonationId,
|
||||
symbol,
|
||||
tags: data.tags,
|
||||
userId: this.request.user.id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
import { Big } from 'big.js';
|
||||
|
||||
import { PortfolioService } from './portfolio.service';
|
||||
|
||||
describe('PortfolioService', () => {
|
||||
let portfolioService: PortfolioService;
|
||||
|
||||
beforeAll(async () => {
|
||||
portfolioService = new PortfolioService(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
});
|
||||
|
||||
describe('annualized performance percentage', () => {
|
||||
it('Get annualized performance', async () => {
|
||||
expect(
|
||||
portfolioService
|
||||
.getAnnualizedPerformancePercent({
|
||||
daysInMarket: NaN, // differenceInDays of date-fns returns NaN for the same day
|
||||
netPerformancePercentage: new Big(0)
|
||||
})
|
||||
.toNumber()
|
||||
).toEqual(0);
|
||||
|
||||
expect(
|
||||
portfolioService
|
||||
.getAnnualizedPerformancePercent({
|
||||
daysInMarket: 0,
|
||||
netPerformancePercentage: new Big(0)
|
||||
})
|
||||
.toNumber()
|
||||
).toEqual(0);
|
||||
|
||||
/**
|
||||
* Source: https://www.readyratios.com/reference/analysis/annualized_rate.html
|
||||
*/
|
||||
expect(
|
||||
portfolioService
|
||||
.getAnnualizedPerformancePercent({
|
||||
daysInMarket: 65, // < 1 year
|
||||
netPerformancePercentage: new Big(0.1025)
|
||||
})
|
||||
.toNumber()
|
||||
).toBeCloseTo(0.729705);
|
||||
|
||||
expect(
|
||||
portfolioService
|
||||
.getAnnualizedPerformancePercent({
|
||||
daysInMarket: 365, // 1 year
|
||||
netPerformancePercentage: new Big(0.05)
|
||||
})
|
||||
.toNumber()
|
||||
).toBeCloseTo(0.05);
|
||||
|
||||
/**
|
||||
* Source: https://www.investopedia.com/terms/a/annualized-total-return.asp#annualized-return-formula-and-calculation
|
||||
*/
|
||||
expect(
|
||||
portfolioService
|
||||
.getAnnualizedPerformancePercent({
|
||||
daysInMarket: 575, // > 1 year
|
||||
netPerformancePercentage: new Big(0.2374)
|
||||
})
|
||||
.toNumber()
|
||||
).toBeCloseTo(0.145);
|
||||
});
|
||||
});
|
||||
});
|
@ -18,6 +18,7 @@ import { DataProviderService } from '@ghostfolio/api/services/data-provider/data
|
||||
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
|
||||
import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service';
|
||||
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
||||
import { getAnnualizedPerformancePercent } from '@ghostfolio/common/calculation-helper';
|
||||
import {
|
||||
DEFAULT_CURRENCY,
|
||||
EMERGENCY_FUND_TAG_ID,
|
||||
@ -58,7 +59,8 @@ import {
|
||||
DataSource,
|
||||
Order,
|
||||
Platform,
|
||||
Prisma
|
||||
Prisma,
|
||||
Tag
|
||||
} from '@prisma/client';
|
||||
import { Big } from 'big.js';
|
||||
import {
|
||||
@ -70,7 +72,7 @@ import {
|
||||
parseISO,
|
||||
set
|
||||
} from 'date-fns';
|
||||
import { isEmpty, isNumber, last, uniq, uniqBy } from 'lodash';
|
||||
import { isEmpty, uniq, uniqBy } from 'lodash';
|
||||
|
||||
import { PortfolioCalculator } from './calculator/portfolio-calculator';
|
||||
import {
|
||||
@ -206,24 +208,6 @@ export class PortfolioService {
|
||||
};
|
||||
}
|
||||
|
||||
public getAnnualizedPerformancePercent({
|
||||
daysInMarket,
|
||||
netPerformancePercentage
|
||||
}: {
|
||||
daysInMarket: number;
|
||||
netPerformancePercentage: Big;
|
||||
}): Big {
|
||||
if (isNumber(daysInMarket) && daysInMarket > 0) {
|
||||
const exponent = new Big(365).div(daysInMarket).toNumber();
|
||||
|
||||
return new Big(
|
||||
Math.pow(netPerformancePercentage.plus(1).toNumber(), exponent)
|
||||
).minus(1);
|
||||
}
|
||||
|
||||
return new Big(0);
|
||||
}
|
||||
|
||||
public async getDividends({
|
||||
activities,
|
||||
groupBy
|
||||
@ -713,7 +697,7 @@ export class PortfolioService {
|
||||
return Account;
|
||||
});
|
||||
|
||||
const dividendYieldPercent = this.getAnnualizedPerformancePercent({
|
||||
const dividendYieldPercent = getAnnualizedPerformancePercent({
|
||||
daysInMarket: differenceInDays(new Date(), parseDate(firstBuyDate)),
|
||||
netPerformancePercentage: timeWeightedInvestment.eq(0)
|
||||
? new Big(0)
|
||||
@ -721,7 +705,7 @@ export class PortfolioService {
|
||||
});
|
||||
|
||||
const dividendYieldPercentWithCurrencyEffect =
|
||||
this.getAnnualizedPerformancePercent({
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: differenceInDays(new Date(), parseDate(firstBuyDate)),
|
||||
netPerformancePercentage: timeWeightedInvestmentWithCurrencyEffect.eq(
|
||||
0
|
||||
@ -1321,6 +1305,24 @@ export class PortfolioService {
|
||||
};
|
||||
}
|
||||
|
||||
public async updateTags({
|
||||
dataSource,
|
||||
impersonationId,
|
||||
symbol,
|
||||
tags,
|
||||
userId
|
||||
}: {
|
||||
dataSource: DataSource;
|
||||
impersonationId: string;
|
||||
symbol: string;
|
||||
tags: Tag[];
|
||||
userId: string;
|
||||
}) {
|
||||
userId = await this.getUserId(impersonationId, userId);
|
||||
|
||||
await this.orderService.assignTags({ dataSource, symbol, tags, userId });
|
||||
}
|
||||
|
||||
private async getCashPositions({
|
||||
cashDetails,
|
||||
userCurrency,
|
||||
@ -1724,13 +1726,13 @@ export class PortfolioService {
|
||||
|
||||
const daysInMarket = differenceInDays(new Date(), firstOrderDate);
|
||||
|
||||
const annualizedPerformancePercent = this.getAnnualizedPerformancePercent({
|
||||
const annualizedPerformancePercent = getAnnualizedPerformancePercent({
|
||||
daysInMarket,
|
||||
netPerformancePercentage: new Big(netPerformancePercentage)
|
||||
})?.toNumber();
|
||||
|
||||
const annualizedPerformancePercentWithCurrencyEffect =
|
||||
this.getAnnualizedPerformancePercent({
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket,
|
||||
netPerformancePercentage: new Big(
|
||||
netPerformancePercentageWithCurrencyEffect
|
||||
|
7
apps/api/src/app/portfolio/update-holding-tags.dto.ts
Normal file
7
apps/api/src/app/portfolio/update-holding-tags.dto.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { Tag } from '@prisma/client';
|
||||
import { IsArray } from 'class-validator';
|
||||
|
||||
export class UpdateHoldingTagsDto {
|
||||
@IsArray()
|
||||
tags: Tag[];
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
||||
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { CACHE_MANAGER } from '@nestjs/cache-manager';
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||
@ -28,7 +28,7 @@ export class RedisCacheService {
|
||||
return `portfolio-snapshot-${userId}`;
|
||||
}
|
||||
|
||||
public getQuoteKey({ dataSource, symbol }: UniqueAsset) {
|
||||
public getQuoteKey({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return `quote-${getAssetProfileIdentifier({ dataSource, symbol })}`;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { HistoricalDataItem, UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
HistoricalDataItem
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
|
||||
export interface SymbolItem extends UniqueAsset {
|
||||
export interface SymbolItem extends AssetProfileIdentifier {
|
||||
currency: string;
|
||||
historicalData: HistoricalDataItem[];
|
||||
marketPrice: number;
|
||||
|
@ -40,13 +40,13 @@ export class SymbolService {
|
||||
const days = includeHistoricalData;
|
||||
|
||||
const marketData = await this.marketDataService.getRange({
|
||||
dateQuery: { gte: subDays(new Date(), days) },
|
||||
uniqueAssets: [
|
||||
assetProfileIdentifiers: [
|
||||
{
|
||||
dataSource: dataGatheringItem.dataSource,
|
||||
symbol: dataGatheringItem.symbol
|
||||
}
|
||||
]
|
||||
],
|
||||
dateQuery: { gte: subDays(new Date(), days) }
|
||||
});
|
||||
|
||||
historicalData = marketData.map(({ date, marketPrice: value }) => {
|
||||
|
@ -2,6 +2,7 @@ import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code';
|
||||
import type {
|
||||
ColorScheme,
|
||||
DateRange,
|
||||
HoldingsViewMode,
|
||||
ViewMode
|
||||
} from '@ghostfolio/common/types';
|
||||
|
||||
@ -66,6 +67,10 @@ export class UpdateUserSettingDto {
|
||||
@IsOptional()
|
||||
'filters.tags'?: string[];
|
||||
|
||||
@IsIn(<HoldingsViewMode[]>['CHART', 'TABLE'])
|
||||
@IsOptional()
|
||||
holdingsViewMode?: HoldingsViewMode;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
isExperimentalFeatures?: boolean;
|
||||
|
@ -190,7 +190,7 @@ export class UserService {
|
||||
(user.Settings.settings as UserSettings).dateRange =
|
||||
(user.Settings.settings as UserSettings).viewMode === 'ZEN'
|
||||
? 'max'
|
||||
: (user.Settings.settings as UserSettings)?.dateRange ?? 'max';
|
||||
: ((user.Settings.settings as UserSettings)?.dateRange ?? 'max');
|
||||
|
||||
// Set default value for view mode
|
||||
if (!(user.Settings.settings as UserSettings).viewMode) {
|
||||
@ -243,6 +243,9 @@ export class UserService {
|
||||
|
||||
// Reset benchmark
|
||||
user.Settings.settings.benchmark = undefined;
|
||||
|
||||
// Reset holdings view mode
|
||||
user.Settings.settings.holdingsViewMode = undefined;
|
||||
} else if (user.subscription?.type === 'Premium') {
|
||||
currentPermissions.push(permissions.reportDataGlitch);
|
||||
|
||||
|
@ -4,6 +4,12 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
||||
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
|
||||
<!--
|
||||
<url>
|
||||
<loc>https://ghostfol.io/ca</loc>
|
||||
<lastmod>${currentDate}T00:00:00+00:00</lastmod>
|
||||
</url>
|
||||
-->
|
||||
<url>
|
||||
<loc>https://ghostfol.io/de</loc>
|
||||
<lastmod>${currentDate}T00:00:00+00:00</lastmod>
|
||||
@ -441,10 +447,10 @@
|
||||
<lastmod>${currentDate}T00:00:00+00:00</lastmod>
|
||||
</url>
|
||||
<!--
|
||||
<url>
|
||||
<loc>https://ghostfol.io/pl</loc>
|
||||
<lastmod>${currentDate}T00:00:00+00:00</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://ghostfol.io/pl</loc>
|
||||
<lastmod>${currentDate}T00:00:00+00:00</lastmod>
|
||||
</url>
|
||||
-->
|
||||
<url>
|
||||
<loc>https://ghostfol.io/pt</loc>
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
GATHER_HISTORICAL_MARKET_DATA_PROCESS
|
||||
} from '@ghostfolio/common/config';
|
||||
import { DATE_FORMAT, getStartOfUtcDate } from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { Process, Processor } from '@nestjs/bull';
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
@ -35,7 +35,7 @@ export class DataGatheringProcessor {
|
||||
) {}
|
||||
|
||||
@Process({ concurrency: 1, name: GATHER_ASSET_PROFILE_PROCESS })
|
||||
public async gatherAssetProfile(job: Job<UniqueAsset>) {
|
||||
public async gatherAssetProfile(job: Job<AssetProfileIdentifier>) {
|
||||
try {
|
||||
Logger.log(
|
||||
`Asset profile data gathering has been started for ${job.data.symbol} (${job.data.dataSource})`,
|
||||
|
@ -20,7 +20,10 @@ import {
|
||||
getAssetProfileIdentifier,
|
||||
resetHours
|
||||
} from '@ghostfolio/common/helper';
|
||||
import { BenchmarkProperty, UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
BenchmarkProperty
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { InjectQueue } from '@nestjs/bull';
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||
@ -91,7 +94,7 @@ export class DataGatheringService {
|
||||
});
|
||||
}
|
||||
|
||||
public async gatherSymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public async gatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
await this.marketDataService.deleteMany({ dataSource, symbol });
|
||||
|
||||
const dataGatheringItems = (await this.getSymbolsMax()).filter(
|
||||
@ -146,23 +149,29 @@ export class DataGatheringService {
|
||||
}
|
||||
}
|
||||
|
||||
public async gatherAssetProfiles(aUniqueAssets?: UniqueAsset[]) {
|
||||
let uniqueAssets = aUniqueAssets?.filter((dataGatheringItem) => {
|
||||
return dataGatheringItem.dataSource !== 'MANUAL';
|
||||
});
|
||||
public async gatherAssetProfiles(
|
||||
aAssetProfileIdentifiers?: AssetProfileIdentifier[]
|
||||
) {
|
||||
let assetProfileIdentifiers = aAssetProfileIdentifiers?.filter(
|
||||
(dataGatheringItem) => {
|
||||
return dataGatheringItem.dataSource !== 'MANUAL';
|
||||
}
|
||||
);
|
||||
|
||||
if (!uniqueAssets) {
|
||||
uniqueAssets = await this.getAllAssetProfileIdentifiers();
|
||||
if (!assetProfileIdentifiers) {
|
||||
assetProfileIdentifiers = await this.getAllAssetProfileIdentifiers();
|
||||
}
|
||||
|
||||
if (uniqueAssets.length <= 0) {
|
||||
if (assetProfileIdentifiers.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const assetProfiles =
|
||||
await this.dataProviderService.getAssetProfiles(uniqueAssets);
|
||||
const symbolProfiles =
|
||||
await this.symbolProfileService.getSymbolProfiles(uniqueAssets);
|
||||
const assetProfiles = await this.dataProviderService.getAssetProfiles(
|
||||
assetProfileIdentifiers
|
||||
);
|
||||
const symbolProfiles = await this.symbolProfileService.getSymbolProfiles(
|
||||
assetProfileIdentifiers
|
||||
);
|
||||
|
||||
for (const [symbol, assetProfile] of Object.entries(assetProfiles)) {
|
||||
const symbolMapping = symbolProfiles.find((symbolProfile) => {
|
||||
@ -248,7 +257,7 @@ export class DataGatheringService {
|
||||
'DataGatheringService'
|
||||
);
|
||||
|
||||
if (uniqueAssets.length === 1) {
|
||||
if (assetProfileIdentifiers.length === 1) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@ -284,7 +293,9 @@ export class DataGatheringService {
|
||||
);
|
||||
}
|
||||
|
||||
public async getAllAssetProfileIdentifiers(): Promise<UniqueAsset[]> {
|
||||
public async getAllAssetProfileIdentifiers(): Promise<
|
||||
AssetProfileIdentifier[]
|
||||
> {
|
||||
const symbolProfiles = await this.prismaService.symbolProfile.findMany({
|
||||
orderBy: [{ symbol: 'asc' }]
|
||||
});
|
||||
@ -305,7 +316,7 @@ export class DataGatheringService {
|
||||
}
|
||||
|
||||
private async getAssetProfileIdentifiersWithCompleteMarketData(): Promise<
|
||||
UniqueAsset[]
|
||||
AssetProfileIdentifier[]
|
||||
> {
|
||||
return (
|
||||
await this.prismaService.marketData.groupBy({
|
||||
|
@ -14,8 +14,13 @@ import {
|
||||
DERIVED_CURRENCIES,
|
||||
PROPERTY_DATA_SOURCE_MAPPING
|
||||
} from '@ghostfolio/common/config';
|
||||
import { DATE_FORMAT, getStartOfUtcDate } from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
DATE_FORMAT,
|
||||
getCurrencyFromSymbol,
|
||||
getStartOfUtcDate,
|
||||
isDerivedCurrency
|
||||
} from '@ghostfolio/common/helper';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
import type { Granularity, UserWithSettings } from '@ghostfolio/common/types';
|
||||
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||
@ -70,7 +75,7 @@ export class DataProviderService {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async getAssetProfiles(items: UniqueAsset[]): Promise<{
|
||||
public async getAssetProfiles(items: AssetProfileIdentifier[]): Promise<{
|
||||
[symbol: string]: Partial<SymbolProfile>;
|
||||
}> {
|
||||
const response: {
|
||||
@ -168,7 +173,7 @@ export class DataProviderService {
|
||||
}
|
||||
|
||||
public async getHistorical(
|
||||
aItems: UniqueAsset[],
|
||||
aItems: AssetProfileIdentifier[],
|
||||
aGranularity: Granularity = 'month',
|
||||
from: Date,
|
||||
to: Date
|
||||
@ -238,7 +243,7 @@ export class DataProviderService {
|
||||
from,
|
||||
to
|
||||
}: {
|
||||
dataGatheringItems: UniqueAsset[];
|
||||
dataGatheringItems: AssetProfileIdentifier[];
|
||||
from: Date;
|
||||
to: Date;
|
||||
}): Promise<{
|
||||
@ -345,7 +350,7 @@ export class DataProviderService {
|
||||
useCache = true,
|
||||
user
|
||||
}: {
|
||||
items: UniqueAsset[];
|
||||
items: AssetProfileIdentifier[];
|
||||
requestTimeout?: number;
|
||||
useCache?: boolean;
|
||||
user?: UserWithSettings;
|
||||
@ -371,7 +376,7 @@ export class DataProviderService {
|
||||
}
|
||||
|
||||
// Get items from cache
|
||||
const itemsToFetch: UniqueAsset[] = [];
|
||||
const itemsToFetch: AssetProfileIdentifier[] = [];
|
||||
|
||||
for (const { dataSource, symbol } of items) {
|
||||
if (useCache) {
|
||||
@ -423,13 +428,18 @@ export class DataProviderService {
|
||||
continue;
|
||||
}
|
||||
|
||||
const symbols = dataGatheringItems.map((dataGatheringItem) => {
|
||||
return dataGatheringItem.symbol;
|
||||
});
|
||||
const symbols = dataGatheringItems
|
||||
.filter(({ symbol }) => {
|
||||
return !isDerivedCurrency(getCurrencyFromSymbol(symbol));
|
||||
})
|
||||
.map(({ symbol }) => {
|
||||
return symbol;
|
||||
});
|
||||
|
||||
const maximumNumberOfSymbolsPerRequest =
|
||||
dataProvider.getMaxNumberOfSymbolsPerRequest?.() ??
|
||||
Number.MAX_SAFE_INTEGER;
|
||||
|
||||
for (
|
||||
let i = 0;
|
||||
i < symbols.length;
|
||||
@ -623,7 +633,7 @@ export class DataProviderService {
|
||||
dataGatheringItems
|
||||
}: {
|
||||
currency: string;
|
||||
dataGatheringItems: UniqueAsset[];
|
||||
dataGatheringItems: AssetProfileIdentifier[];
|
||||
}) {
|
||||
return dataGatheringItems.some(({ dataSource, symbol }) => {
|
||||
return (
|
||||
|
@ -361,13 +361,13 @@ export class ExchangeRateDataService {
|
||||
const symbol = `${currencyFrom}${currencyTo}`;
|
||||
|
||||
const marketData = await this.marketDataService.getRange({
|
||||
dateQuery: { gte: startDate, lt: endDate },
|
||||
uniqueAssets: [
|
||||
assetProfileIdentifiers: [
|
||||
{
|
||||
dataSource,
|
||||
symbol
|
||||
}
|
||||
]
|
||||
],
|
||||
dateQuery: { gte: startDate, lt: endDate }
|
||||
});
|
||||
|
||||
if (marketData?.length > 0) {
|
||||
@ -392,13 +392,13 @@ export class ExchangeRateDataService {
|
||||
}
|
||||
} else {
|
||||
const marketData = await this.marketDataService.getRange({
|
||||
dateQuery: { gte: startDate, lt: endDate },
|
||||
uniqueAssets: [
|
||||
assetProfileIdentifiers: [
|
||||
{
|
||||
dataSource,
|
||||
symbol: `${DEFAULT_CURRENCY}${currencyFrom}`
|
||||
}
|
||||
]
|
||||
],
|
||||
dateQuery: { gte: startDate, lt: endDate }
|
||||
});
|
||||
|
||||
for (const { date, marketPrice } of marketData) {
|
||||
@ -415,16 +415,16 @@ export class ExchangeRateDataService {
|
||||
}
|
||||
} else {
|
||||
const marketData = await this.marketDataService.getRange({
|
||||
dateQuery: {
|
||||
gte: startDate,
|
||||
lt: endDate
|
||||
},
|
||||
uniqueAssets: [
|
||||
assetProfileIdentifiers: [
|
||||
{
|
||||
dataSource,
|
||||
symbol: `${DEFAULT_CURRENCY}${currencyTo}`
|
||||
}
|
||||
]
|
||||
],
|
||||
dateQuery: {
|
||||
gte: startDate,
|
||||
lt: endDate
|
||||
}
|
||||
});
|
||||
|
||||
for (const { date, marketPrice } of marketData) {
|
||||
|
@ -1,4 +1,7 @@
|
||||
import { DataProviderInfo, UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
DataProviderInfo
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { MarketState } from '@ghostfolio/common/types';
|
||||
|
||||
import {
|
||||
@ -34,6 +37,6 @@ export interface IDataProviderResponse {
|
||||
marketState: MarketState;
|
||||
}
|
||||
|
||||
export interface IDataGatheringItem extends UniqueAsset {
|
||||
export interface IDataGatheringItem extends AssetProfileIdentifier {
|
||||
date?: Date;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { DateQuery } from '@ghostfolio/api/app/portfolio/interfaces/date-query.i
|
||||
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
|
||||
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
|
||||
import { resetHours } from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
@ -17,7 +17,7 @@ import {
|
||||
export class MarketDataService {
|
||||
public constructor(private readonly prismaService: PrismaService) {}
|
||||
|
||||
public async deleteMany({ dataSource, symbol }: UniqueAsset) {
|
||||
public async deleteMany({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.prismaService.marketData.deleteMany({
|
||||
where: {
|
||||
dataSource,
|
||||
@ -40,7 +40,7 @@ export class MarketDataService {
|
||||
});
|
||||
}
|
||||
|
||||
public async getMax({ dataSource, symbol }: UniqueAsset) {
|
||||
public async getMax({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.prismaService.marketData.findFirst({
|
||||
select: {
|
||||
date: true,
|
||||
@ -59,11 +59,11 @@ export class MarketDataService {
|
||||
}
|
||||
|
||||
public async getRange({
|
||||
dateQuery,
|
||||
uniqueAssets
|
||||
assetProfileIdentifiers,
|
||||
dateQuery
|
||||
}: {
|
||||
assetProfileIdentifiers: AssetProfileIdentifier[];
|
||||
dateQuery: DateQuery;
|
||||
uniqueAssets: UniqueAsset[];
|
||||
}): Promise<MarketData[]> {
|
||||
return this.prismaService.marketData.findMany({
|
||||
orderBy: [
|
||||
@ -76,13 +76,13 @@ export class MarketDataService {
|
||||
],
|
||||
where: {
|
||||
dataSource: {
|
||||
in: uniqueAssets.map(({ dataSource }) => {
|
||||
in: assetProfileIdentifiers.map(({ dataSource }) => {
|
||||
return dataSource;
|
||||
})
|
||||
},
|
||||
date: dateQuery,
|
||||
symbol: {
|
||||
in: uniqueAssets.map(({ symbol }) => {
|
||||
in: assetProfileIdentifiers.map(({ symbol }) => {
|
||||
return symbol;
|
||||
})
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
|
||||
import { UNKNOWN_KEY } from '@ghostfolio/common/config';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
EnhancedSymbolProfile,
|
||||
Holding,
|
||||
ScraperConfiguration,
|
||||
UniqueAsset
|
||||
ScraperConfiguration
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { Country } from '@ghostfolio/common/interfaces/country.interface';
|
||||
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
|
||||
@ -23,7 +23,7 @@ export class SymbolProfileService {
|
||||
return this.prismaService.symbolProfile.create({ data: assetProfile });
|
||||
}
|
||||
|
||||
public async delete({ dataSource, symbol }: UniqueAsset) {
|
||||
public async delete({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.prismaService.symbolProfile.delete({
|
||||
where: { dataSource_symbol: { dataSource, symbol } }
|
||||
});
|
||||
@ -36,7 +36,7 @@ export class SymbolProfileService {
|
||||
}
|
||||
|
||||
public async getSymbolProfiles(
|
||||
aUniqueAssets: UniqueAsset[]
|
||||
aAssetProfileIdentifiers: AssetProfileIdentifier[]
|
||||
): Promise<EnhancedSymbolProfile[]> {
|
||||
return this.prismaService.symbolProfile
|
||||
.findMany({
|
||||
@ -54,7 +54,7 @@ export class SymbolProfileService {
|
||||
SymbolProfileOverrides: true
|
||||
},
|
||||
where: {
|
||||
OR: aUniqueAssets.map(({ dataSource, symbol }) => {
|
||||
OR: aAssetProfileIdentifiers.map(({ dataSource, symbol }) => {
|
||||
return {
|
||||
dataSource,
|
||||
symbol
|
||||
@ -140,7 +140,7 @@ export class SymbolProfileService {
|
||||
symbolMapping,
|
||||
SymbolProfileOverrides,
|
||||
url
|
||||
}: Prisma.SymbolProfileUpdateInput & UniqueAsset) {
|
||||
}: AssetProfileIdentifier & Prisma.SymbolProfileUpdateInput) {
|
||||
return this.prismaService.symbolProfile.update({
|
||||
data: {
|
||||
assetClass,
|
||||
|
@ -36,6 +36,10 @@
|
||||
"ngswConfigPath": "apps/client/ngsw-config.json"
|
||||
},
|
||||
"configurations": {
|
||||
"development-ca": {
|
||||
"baseHref": "/ca/",
|
||||
"localize": ["ca"]
|
||||
},
|
||||
"development-de": {
|
||||
"baseHref": "/de/",
|
||||
"localize": ["de"]
|
||||
@ -212,6 +216,7 @@
|
||||
"includeContext": true,
|
||||
"outputPath": "src/locales",
|
||||
"targetFiles": [
|
||||
"messages.ca.xlf",
|
||||
"messages.de.xlf",
|
||||
"messages.es.xlf",
|
||||
"messages.fr.xlf",
|
||||
@ -240,6 +245,10 @@
|
||||
},
|
||||
"i18n": {
|
||||
"locales": {
|
||||
"ca": {
|
||||
"baseHref": "/ca/",
|
||||
"translation": "apps/client/src/locales/messages.ca.xlf"
|
||||
},
|
||||
"de": {
|
||||
"baseHref": "/de/",
|
||||
"translation": "apps/client/src/locales/messages.de.xlf"
|
||||
|
@ -145,6 +145,11 @@
|
||||
/></a>
|
||||
</li>
|
||||
<li> </li>
|
||||
<!--
|
||||
<li>
|
||||
<a href="../ca" title="Ghostfolio en català">Català</a>
|
||||
</li>
|
||||
-->
|
||||
<li>
|
||||
<a href="../de" title="Ghostfolio in Deutsch">Deutsch</a>
|
||||
</li>
|
||||
|
@ -255,10 +255,18 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
colorScheme: this.user?.settings?.colorScheme,
|
||||
deviceType: this.deviceType,
|
||||
hasImpersonationId: this.hasImpersonationId,
|
||||
hasPermissionToCreateOrder:
|
||||
!this.hasImpersonationId &&
|
||||
hasPermission(this.user?.permissions, permissions.createOrder) &&
|
||||
!this.user?.settings?.isRestrictedView,
|
||||
hasPermissionToReportDataGlitch: hasPermission(
|
||||
this.user?.permissions,
|
||||
permissions.reportDataGlitch
|
||||
),
|
||||
hasPermissionToUpdateOrder:
|
||||
!this.hasImpersonationId &&
|
||||
hasPermission(this.user?.permissions, permissions.updateOrder) &&
|
||||
!this.user?.settings?.isRestrictedView,
|
||||
locale: this.user?.settings?.locale
|
||||
},
|
||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Sort, SortDirection } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { Big } from 'big.js';
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import { isNumber } from 'lodash';
|
||||
@ -66,6 +67,7 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
||||
@Inject(MAT_DIALOG_DATA) public data: AccountDetailDialogParams,
|
||||
private dataService: DataService,
|
||||
public dialogRef: MatDialogRef<AccountDetailDialog>,
|
||||
private router: Router,
|
||||
private userService: UserService
|
||||
) {
|
||||
this.userService.stateChanged
|
||||
@ -92,6 +94,14 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
||||
this.fetchPortfolioPerformance();
|
||||
}
|
||||
|
||||
public onCloneActivity(aActivity: Activity) {
|
||||
this.router.navigate(['/portfolio', 'activities'], {
|
||||
queryParams: { activityId: aActivity.id, createDialog: true }
|
||||
});
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public onClose() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
@ -147,6 +157,14 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
||||
this.fetchActivities();
|
||||
}
|
||||
|
||||
public onUpdateActivity(aActivity: Activity) {
|
||||
this.router.navigate(['/portfolio', 'activities'], {
|
||||
queryParams: { activityId: aActivity.id, editDialog: true }
|
||||
});
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
private fetchAccount() {
|
||||
this.dataService
|
||||
.fetchAccount(this.data.accountId)
|
||||
|
@ -101,10 +101,17 @@
|
||||
[hasPermissionToFilter]="false"
|
||||
[hasPermissionToOpenDetails]="false"
|
||||
[locale]="user?.settings?.locale"
|
||||
[showActions]="false"
|
||||
[showActions]="
|
||||
!data.hasImpersonationId &&
|
||||
data.hasPermissionToCreateOrder &&
|
||||
user?.settings?.isExperimentalFeatures &&
|
||||
!user?.settings?.isRestrictedView
|
||||
"
|
||||
[sortColumn]="sortColumn"
|
||||
[sortDirection]="sortDirection"
|
||||
[totalItems]="totalItems"
|
||||
(activityToClone)="onCloneActivity($event)"
|
||||
(activityToUpdate)="onUpdateActivity($event)"
|
||||
(export)="onExport()"
|
||||
(sortChanged)="onSortChanged($event)"
|
||||
/>
|
||||
|
@ -2,4 +2,5 @@ export interface AccountDetailDialogParams {
|
||||
accountId: string;
|
||||
deviceType: string;
|
||||
hasImpersonationId: boolean;
|
||||
hasPermissionToCreateOrder: boolean;
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ import {
|
||||
} from '@ghostfolio/common/config';
|
||||
import { getDateFormatString } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
Filter,
|
||||
InfoItem,
|
||||
UniqueAsset,
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { AdminMarketDataItem } from '@ghostfolio/common/interfaces/admin-market-data.interface';
|
||||
@ -225,7 +225,7 @@ export class AdminMarketDataComponent
|
||||
});
|
||||
}
|
||||
|
||||
public onDeleteAssetProfile({ dataSource, symbol }: UniqueAsset) {
|
||||
public onDeleteAssetProfile({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.adminMarketDataService.deleteAssetProfile({ dataSource, symbol });
|
||||
}
|
||||
|
||||
@ -266,21 +266,27 @@ export class AdminMarketDataComponent
|
||||
.subscribe(() => {});
|
||||
}
|
||||
|
||||
public onGatherProfileDataBySymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public onGatherProfileDataBySymbol({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
this.adminService
|
||||
.gatherProfileDataBySymbol({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(() => {});
|
||||
}
|
||||
|
||||
public onGatherSymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public onGatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.adminService
|
||||
.gatherSymbol({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(() => {});
|
||||
}
|
||||
|
||||
public onOpenAssetProfileDialog({ dataSource, symbol }: UniqueAsset) {
|
||||
public onOpenAssetProfileDialog({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
dataSource,
|
||||
|
@ -2,8 +2,8 @@ import { AdminService } from '@ghostfolio/client/services/admin.service';
|
||||
import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config';
|
||||
import { getCurrencyFromSymbol, isCurrency } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AdminMarketDataItem,
|
||||
UniqueAsset
|
||||
AssetProfileIdentifier,
|
||||
AdminMarketDataItem
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
@ -13,7 +13,7 @@ import { EMPTY, catchError, finalize, forkJoin, takeUntil } from 'rxjs';
|
||||
export class AdminMarketDataService {
|
||||
public constructor(private adminService: AdminService) {}
|
||||
|
||||
public deleteAssetProfile({ dataSource, symbol }: UniqueAsset) {
|
||||
public deleteAssetProfile({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
const confirmation = confirm(
|
||||
$localize`Do you really want to delete this asset profile?`
|
||||
);
|
||||
@ -29,15 +29,19 @@ export class AdminMarketDataService {
|
||||
}
|
||||
}
|
||||
|
||||
public deleteAssetProfiles(uniqueAssets: UniqueAsset[]) {
|
||||
public deleteAssetProfiles(
|
||||
aAssetProfileIdentifiers: AssetProfileIdentifier[]
|
||||
) {
|
||||
const confirmation = confirm(
|
||||
$localize`Do you really want to delete these profiles?`
|
||||
);
|
||||
|
||||
if (confirmation) {
|
||||
const deleteRequests = uniqueAssets.map(({ dataSource, symbol }) => {
|
||||
return this.adminService.deleteProfileData({ dataSource, symbol });
|
||||
});
|
||||
const deleteRequests = aAssetProfileIdentifiers.map(
|
||||
({ dataSource, symbol }) => {
|
||||
return this.adminService.deleteProfileData({ dataSource, symbol });
|
||||
}
|
||||
);
|
||||
|
||||
forkJoin(deleteRequests)
|
||||
.pipe(
|
||||
|
@ -8,7 +8,7 @@ import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config';
|
||||
import { DATE_FORMAT } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AdminMarketDataDetails,
|
||||
UniqueAsset
|
||||
AssetProfileIdentifier
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { translate } from '@ghostfolio/ui/i18n';
|
||||
|
||||
@ -175,20 +175,23 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public onDeleteProfileData({ dataSource, symbol }: UniqueAsset) {
|
||||
public onDeleteProfileData({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.adminMarketDataService.deleteAssetProfile({ dataSource, symbol });
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public onGatherProfileDataBySymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public onGatherProfileDataBySymbol({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
this.adminService
|
||||
.gatherProfileDataBySymbol({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(() => {});
|
||||
}
|
||||
|
||||
public onGatherSymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public onGatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.adminService
|
||||
.gatherSymbol({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
@ -242,7 +245,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public onSetBenchmark({ dataSource, symbol }: UniqueAsset) {
|
||||
public onSetBenchmark({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.dataService
|
||||
.postBenchmark({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
@ -342,7 +345,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public onUnsetBenchmark({ dataSource, symbol }: UniqueAsset) {
|
||||
public onUnsetBenchmark({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.dataService
|
||||
.deleteBenchmark({ dataSource, symbol })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
|
@ -12,11 +12,7 @@
|
||||
<div class="d-flex my-3">
|
||||
<div class="w-50" i18n>User Count</div>
|
||||
<div class="w-50">
|
||||
<gf-value
|
||||
[locale]="user?.settings?.locale"
|
||||
[precision]="0"
|
||||
[value]="userCount"
|
||||
/>
|
||||
<gf-value [locale]="user?.settings?.locale" [value]="userCount" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex my-3">
|
||||
@ -24,7 +20,6 @@
|
||||
<div class="w-50">
|
||||
<gf-value
|
||||
[locale]="user?.settings?.locale"
|
||||
[precision]="0"
|
||||
[value]="transactionCount"
|
||||
/>
|
||||
@if (transactionCount && userCount) {
|
||||
|
@ -19,16 +19,24 @@ import { GfLineChartComponent } from '@ghostfolio/ui/line-chart';
|
||||
import { GfPortfolioProportionChartComponent } from '@ghostfolio/ui/portfolio-proportion-chart';
|
||||
import { GfValueComponent } from '@ghostfolio/ui/value';
|
||||
|
||||
import { COMMA, ENTER } from '@angular/cdk/keycodes';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
CUSTOM_ELEMENTS_SCHEMA,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
ElementRef,
|
||||
Inject,
|
||||
OnDestroy,
|
||||
OnInit
|
||||
OnInit,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import {
|
||||
MatAutocompleteModule,
|
||||
MatAutocompleteSelectedEvent
|
||||
} from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import {
|
||||
@ -36,14 +44,16 @@ import {
|
||||
MatDialogModule,
|
||||
MatDialogRef
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { SortDirection } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { Router } from '@angular/router';
|
||||
import { Account, Tag } from '@prisma/client';
|
||||
import { format, isSameMonth, isToday, parseISO } from 'date-fns';
|
||||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Observable, of, Subject } from 'rxjs';
|
||||
import { map, startWith, takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { HoldingDetailDialogParams } from './interfaces/interfaces';
|
||||
|
||||
@ -60,9 +70,11 @@ import { HoldingDetailDialogParams } from './interfaces/interfaces';
|
||||
GfLineChartComponent,
|
||||
GfPortfolioProportionChartComponent,
|
||||
GfValueComponent,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatChipsModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatTabsModule,
|
||||
NgxSkeletonLoaderModule
|
||||
],
|
||||
@ -73,6 +85,9 @@ import { HoldingDetailDialogParams } from './interfaces/interfaces';
|
||||
templateUrl: 'holding-detail-dialog.html'
|
||||
})
|
||||
export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||
|
||||
public activityForm: FormGroup;
|
||||
public accounts: Account[];
|
||||
public activities: Activity[];
|
||||
public assetClass: string;
|
||||
@ -88,6 +103,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
public dividendInBaseCurrencyPrecision = 2;
|
||||
public dividendYieldPercentWithCurrencyEffect: number;
|
||||
public feeInBaseCurrency: number;
|
||||
public filteredTagsObservable: Observable<Tag[]> = of([]);
|
||||
public firstBuyDate: string;
|
||||
public historicalDataItems: LineChartItem[];
|
||||
public investment: number;
|
||||
@ -107,10 +123,12 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
public sectors: {
|
||||
[name: string]: { name: string; value: number };
|
||||
};
|
||||
public separatorKeysCodes: number[] = [COMMA, ENTER];
|
||||
public sortColumn = 'date';
|
||||
public sortDirection: SortDirection = 'desc';
|
||||
public SymbolProfile: EnhancedSymbolProfile;
|
||||
public tags: Tag[];
|
||||
public tagsAvailable: Tag[];
|
||||
public totalItems: number;
|
||||
public transactionCount: number;
|
||||
public user: User;
|
||||
@ -123,10 +141,39 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
private dataService: DataService,
|
||||
public dialogRef: MatDialogRef<GfHoldingDetailDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: HoldingDetailDialogParams,
|
||||
private formBuilder: FormBuilder,
|
||||
private router: Router,
|
||||
private userService: UserService
|
||||
) {}
|
||||
|
||||
public ngOnInit() {
|
||||
const { tags } = this.dataService.fetchInfo();
|
||||
|
||||
this.activityForm = this.formBuilder.group({
|
||||
tags: <string[]>[]
|
||||
});
|
||||
|
||||
this.tagsAvailable = tags.map(({ id, name }) => {
|
||||
return {
|
||||
id,
|
||||
name: translate(name)
|
||||
};
|
||||
});
|
||||
|
||||
this.activityForm
|
||||
.get('tags')
|
||||
.valueChanges.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((tags) => {
|
||||
this.dataService
|
||||
.putHoldingTags({
|
||||
tags,
|
||||
dataSource: this.data.dataSource,
|
||||
symbol: this.data.symbol
|
||||
})
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe();
|
||||
});
|
||||
|
||||
this.dataService
|
||||
.fetchHoldingDetail({
|
||||
dataSource: this.data.dataSource,
|
||||
@ -248,12 +295,27 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
this.reportDataGlitchMail = `mailto:hi@ghostfol.io?Subject=Ghostfolio Data Glitch Report&body=Hello%0D%0DI would like to report a data glitch for%0D%0DSymbol: ${SymbolProfile?.symbol}%0DData Source: ${SymbolProfile?.dataSource}%0D%0DAdditional notes:%0D%0DCan you please take a look?%0D%0DKind regards`;
|
||||
this.sectors = {};
|
||||
this.SymbolProfile = SymbolProfile;
|
||||
|
||||
this.tags = tags.map(({ id, name }) => {
|
||||
return {
|
||||
id,
|
||||
name: translate(name)
|
||||
};
|
||||
});
|
||||
|
||||
this.activityForm.setValue({ tags: this.tags }, { emitEvent: false });
|
||||
|
||||
this.filteredTagsObservable = this.activityForm.controls[
|
||||
'tags'
|
||||
].valueChanges.pipe(
|
||||
startWith(this.activityForm.get('tags').value),
|
||||
map((aTags: Tag[] | null) => {
|
||||
return aTags
|
||||
? this.filterTags(aTags)
|
||||
: this.tagsAvailable.slice();
|
||||
})
|
||||
);
|
||||
|
||||
this.transactionCount = transactionCount;
|
||||
this.totalItems = transactionCount;
|
||||
this.value = value;
|
||||
@ -353,6 +415,25 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public onAddTag(event: MatAutocompleteSelectedEvent) {
|
||||
this.activityForm.get('tags').setValue([
|
||||
...(this.activityForm.get('tags').value ?? []),
|
||||
this.tagsAvailable.find(({ id }) => {
|
||||
return id === event.option.value;
|
||||
})
|
||||
]);
|
||||
|
||||
this.tagInput.nativeElement.value = '';
|
||||
}
|
||||
|
||||
public onCloneActivity(aActivity: Activity) {
|
||||
this.router.navigate(['/portfolio', 'activities'], {
|
||||
queryParams: { activityId: aActivity.id, createDialog: true }
|
||||
});
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public onClose() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
@ -377,8 +458,34 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public onRemoveTag(aTag: Tag) {
|
||||
this.activityForm.get('tags').setValue(
|
||||
this.activityForm.get('tags').value.filter(({ id }) => {
|
||||
return id !== aTag.id;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public onUpdateActivity(aActivity: Activity) {
|
||||
this.router.navigate(['/portfolio', 'activities'], {
|
||||
queryParams: { activityId: aActivity.id, editDialog: true }
|
||||
});
|
||||
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.unsubscribeSubject.next();
|
||||
this.unsubscribeSubject.complete();
|
||||
}
|
||||
|
||||
private filterTags(aTags: Tag[]) {
|
||||
const tagIds = aTags.map(({ id }) => {
|
||||
return id;
|
||||
});
|
||||
|
||||
return this.tagsAvailable.filter(({ id }) => {
|
||||
return !tagIds.includes(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@
|
||||
|
||||
<mat-tab-group
|
||||
animationDuration="0"
|
||||
class="mb-3"
|
||||
class="mb-5"
|
||||
[mat-stretch-tabs]="false"
|
||||
[ngClass]="{ 'd-none': !activities?.length }"
|
||||
>
|
||||
@ -346,12 +346,19 @@
|
||||
[hasPermissionToFilter]="false"
|
||||
[hasPermissionToOpenDetails]="false"
|
||||
[locale]="data.locale"
|
||||
[showActions]="false"
|
||||
[showActions]="
|
||||
!data.hasImpersonationId &&
|
||||
data.hasPermissionToCreateOrder &&
|
||||
user?.settings?.isExperimentalFeatures &&
|
||||
!user?.settings?.isRestrictedView
|
||||
"
|
||||
[showNameColumn]="false"
|
||||
[sortColumn]="sortColumn"
|
||||
[sortDirection]="sortDirection"
|
||||
[sortDisabled]="true"
|
||||
[totalItems]="totalItems"
|
||||
(activityToClone)="onCloneActivity($event)"
|
||||
(activityToUpdate)="onUpdateActivity($event)"
|
||||
(export)="onExport()"
|
||||
/>
|
||||
</mat-tab>
|
||||
@ -375,7 +382,49 @@
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
@if (tags?.length > 0) {
|
||||
<div
|
||||
class="row"
|
||||
[ngClass]="{
|
||||
'd-none': !data.hasPermissionToUpdateOrder
|
||||
}"
|
||||
>
|
||||
<div class="col">
|
||||
<mat-form-field appearance="outline" class="w-100 without-hint">
|
||||
<mat-label i18n>Tags</mat-label>
|
||||
<mat-chip-grid #tagsChipList>
|
||||
@for (tag of activityForm.get('tags')?.value; track tag.id) {
|
||||
<mat-chip-row
|
||||
matChipRemove
|
||||
[removable]="true"
|
||||
(removed)="onRemoveTag(tag)"
|
||||
>
|
||||
{{ tag.name }}
|
||||
<ion-icon class="ml-2" matPrefix name="close-outline" />
|
||||
</mat-chip-row>
|
||||
}
|
||||
<input
|
||||
#tagInput
|
||||
name="close-outline"
|
||||
[matAutocomplete]="autocompleteTags"
|
||||
[matChipInputFor]="tagsChipList"
|
||||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
||||
/>
|
||||
</mat-chip-grid>
|
||||
<mat-autocomplete
|
||||
#autocompleteTags="matAutocomplete"
|
||||
(optionSelected)="onAddTag($event)"
|
||||
>
|
||||
@for (tag of filteredTagsObservable | async; track tag.id) {
|
||||
<mat-option [value]="tag.id">
|
||||
{{ tag.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!data.hasPermissionToUpdateOrder && tagsAvailable?.length > 0) {
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="h5" i18n>Tags</div>
|
||||
|
@ -8,7 +8,9 @@ export interface HoldingDetailDialogParams {
|
||||
dataSource: DataSource;
|
||||
deviceType: string;
|
||||
hasImpersonationId: boolean;
|
||||
hasPermissionToCreateOrder: boolean;
|
||||
hasPermissionToReportDataGlitch: boolean;
|
||||
hasPermissionToUpdateOrder: boolean;
|
||||
locale: string;
|
||||
symbol: string;
|
||||
}
|
||||
|
@ -2,14 +2,14 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
|
||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
PortfolioPosition,
|
||||
UniqueAsset,
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
import {
|
||||
HoldingType,
|
||||
HoldingViewMode,
|
||||
HoldingsViewMode,
|
||||
ToggleOption
|
||||
} from '@ghostfolio/common/types';
|
||||
|
||||
@ -18,7 +18,7 @@ import { FormControl } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { DeviceDetectorService } from 'ngx-device-detector';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { skip, takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'gf-home-holdings',
|
||||
@ -26,6 +26,8 @@ import { takeUntil } from 'rxjs/operators';
|
||||
templateUrl: './home-holdings.html'
|
||||
})
|
||||
export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
public static DEFAULT_HOLDINGS_VIEW_MODE: HoldingsViewMode = 'TABLE';
|
||||
|
||||
public deviceType: string;
|
||||
public hasImpersonationId: boolean;
|
||||
public hasPermissionToAccessHoldingsChart: boolean;
|
||||
@ -37,7 +39,9 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
{ label: $localize`Closed`, value: 'CLOSED' }
|
||||
];
|
||||
public user: User;
|
||||
public viewModeFormControl = new FormControl<HoldingViewMode>('TABLE');
|
||||
public viewModeFormControl = new FormControl<HoldingsViewMode>(
|
||||
HomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE
|
||||
);
|
||||
|
||||
private unsubscribeSubject = new Subject<void>();
|
||||
|
||||
@ -81,6 +85,21 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
this.changeDetectorRef.markForCheck();
|
||||
}
|
||||
});
|
||||
|
||||
this.viewModeFormControl.valueChanges
|
||||
.pipe(
|
||||
// Skip inizialization: "new FormControl"
|
||||
skip(1),
|
||||
takeUntil(this.unsubscribeSubject)
|
||||
)
|
||||
.subscribe((holdingsViewMode) => {
|
||||
this.dataService
|
||||
.putUserSetting({ holdingsViewMode })
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(() => {
|
||||
this.userService.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public onChangeHoldingType(aHoldingType: HoldingType) {
|
||||
@ -89,7 +108,7 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
public onSymbolClicked({ dataSource, symbol }: UniqueAsset) {
|
||||
public onSymbolClicked({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
if (dataSource && symbol) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { dataSource, symbol, holdingDetailDialog: true }
|
||||
@ -122,9 +141,20 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit {
|
||||
this.hasPermissionToAccessHoldingsChart &&
|
||||
this.holdingType === 'ACTIVE'
|
||||
) {
|
||||
this.viewModeFormControl.enable();
|
||||
this.viewModeFormControl.enable({ emitEvent: false });
|
||||
|
||||
this.viewModeFormControl.setValue(
|
||||
this.deviceType === 'mobile'
|
||||
? HomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE
|
||||
: this.user?.settings?.holdingsViewMode ||
|
||||
HomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE,
|
||||
{ emitEvent: false }
|
||||
);
|
||||
} else if (this.holdingType === 'CLOSED') {
|
||||
this.viewModeFormControl.setValue('TABLE');
|
||||
this.viewModeFormControl.setValue(
|
||||
HomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE,
|
||||
{ emitEvent: false }
|
||||
);
|
||||
}
|
||||
|
||||
this.holdings = undefined;
|
||||
|
@ -5,9 +5,9 @@ import { ImpersonationStorageService } from '@ghostfolio/client/services/imperso
|
||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||
import { NUMERICAL_PRECISION_THRESHOLD } from '@ghostfolio/common/config';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
LineChartItem,
|
||||
PortfolioPerformance,
|
||||
UniqueAsset,
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
@ -26,7 +26,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||
export class HomeOverviewComponent implements OnDestroy, OnInit {
|
||||
public dateRangeOptions = ToggleComponent.DEFAULT_DATE_RANGE_OPTIONS;
|
||||
public deviceType: string;
|
||||
public errors: UniqueAsset[];
|
||||
public errors: AssetProfileIdentifier[];
|
||||
public hasError: boolean;
|
||||
public hasImpersonationId: boolean;
|
||||
public hasPermissionToCreateOrder: boolean;
|
||||
|
@ -47,6 +47,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit {
|
||||
public isWebAuthnEnabled: boolean;
|
||||
public language = document.documentElement.lang;
|
||||
public locales = [
|
||||
'ca',
|
||||
'de',
|
||||
'de-CH',
|
||||
'en-GB',
|
||||
|
@ -72,6 +72,14 @@
|
||||
<mat-option [value]="null" />
|
||||
<mat-option value="de">Deutsch</mat-option>
|
||||
<mat-option value="en">English</mat-option>
|
||||
@if (user?.settings?.isExperimentalFeatures) {
|
||||
<!--
|
||||
<mat-option value="ca"
|
||||
>Català (<ng-container i18n>Community</ng-container
|
||||
>)</mat-option
|
||||
>
|
||||
-->
|
||||
}
|
||||
@if (user?.settings?.isExperimentalFeatures) {
|
||||
<mat-option value="zh"
|
||||
>Chinese (<ng-container i18n>Community</ng-container
|
||||
@ -95,10 +103,12 @@
|
||||
>)</mat-option
|
||||
>
|
||||
@if (user?.settings?.isExperimentalFeatures) {
|
||||
<mat-option value="pl"
|
||||
>Polski (<ng-container i18n>Community</ng-container
|
||||
>)</mat-option
|
||||
>
|
||||
<!--
|
||||
<mat-option value="pl"
|
||||
>Polski (<ng-container i18n>Community</ng-container
|
||||
>)</mat-option
|
||||
>
|
||||
-->
|
||||
}
|
||||
<mat-option value="pt"
|
||||
>Português (<ng-container i18n>Community</ng-container
|
||||
|
@ -221,7 +221,11 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
|
||||
data: <AccountDetailDialogParams>{
|
||||
accountId: aAccountId,
|
||||
deviceType: this.deviceType,
|
||||
hasImpersonationId: this.hasImpersonationId
|
||||
hasImpersonationId: this.hasImpersonationId,
|
||||
hasPermissionToCreateOrder:
|
||||
!this.hasImpersonationId &&
|
||||
hasPermission(this.user?.permissions, permissions.createOrder) &&
|
||||
!this.user?.settings?.isRestrictedView
|
||||
},
|
||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
||||
|
@ -242,9 +242,11 @@
|
||||
<h4 i18n>Multi-Language</h4>
|
||||
<p class="m-0">
|
||||
Use Ghostfolio in multiple languages: English,
|
||||
<!-- Chinese, -->Dutch, French, German, Italian,
|
||||
<!-- Polish, -->Portuguese, Spanish and Turkish are currently
|
||||
supported.
|
||||
<!--Català, -->
|
||||
<!-- Chinese, -->
|
||||
Dutch, French, German, Italian,
|
||||
<!-- Polish, -->
|
||||
Portuguese, Spanish and Turkish are currently supported.
|
||||
</p>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
@ -16,7 +16,6 @@ import { PageEvent } from '@angular/material/paginator';
|
||||
import { Sort, SortDirection } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Order as OrderModel } from '@prisma/client';
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import { DeviceDetectorService } from 'ngx-device-detector';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
@ -33,7 +32,6 @@ import { ImportActivitiesDialogParams } from './import-activities-dialog/interfa
|
||||
templateUrl: './activities-page.html'
|
||||
})
|
||||
export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
public activities: Activity[];
|
||||
public dataSource: MatTableDataSource<Activity>;
|
||||
public deviceType: string;
|
||||
public hasImpersonationId: boolean;
|
||||
@ -64,20 +62,24 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((params) => {
|
||||
if (params['createDialog']) {
|
||||
this.openCreateActivityDialog();
|
||||
if (params['activityId']) {
|
||||
this.dataService
|
||||
.fetchActivity(params['activityId'])
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((activity) => {
|
||||
this.openCreateActivityDialog(activity);
|
||||
});
|
||||
} else {
|
||||
this.openCreateActivityDialog();
|
||||
}
|
||||
} else if (params['editDialog']) {
|
||||
if (this.activities) {
|
||||
const activity = this.activities.find(({ id }) => {
|
||||
return id === params['activityId'];
|
||||
});
|
||||
|
||||
this.openUpdateActivityDialog(activity);
|
||||
} else if (this.dataSource) {
|
||||
const activity = this.dataSource.data.find(({ id }) => {
|
||||
return id === params['activityId'];
|
||||
});
|
||||
|
||||
this.openUpdateActivityDialog(activity);
|
||||
if (params['activityId']) {
|
||||
this.dataService
|
||||
.fetchActivity(params['activityId'])
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe((activity) => {
|
||||
this.openUpdateActivityDialog(activity);
|
||||
});
|
||||
} else {
|
||||
this.router.navigate(['.'], { relativeTo: this.route });
|
||||
}
|
||||
@ -249,7 +251,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
this.fetchActivities();
|
||||
}
|
||||
|
||||
public onUpdateActivity(aActivity: OrderModel) {
|
||||
public onUpdateActivity(aActivity: Activity) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { activityId: aActivity.id, editDialog: true }
|
||||
});
|
||||
|
@ -51,9 +51,10 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
public filteredTagsObservable: Observable<Tag[]> = of([]);
|
||||
public isLoading = false;
|
||||
public isToday = isToday;
|
||||
public mode: 'create' | 'update';
|
||||
public platforms: { id: string; name: string }[];
|
||||
public separatorKeysCodes: number[] = [ENTER, COMMA];
|
||||
public tags: Tag[] = [];
|
||||
public separatorKeysCodes: number[] = [COMMA, ENTER];
|
||||
public tagsAvailable: Tag[] = [];
|
||||
public total = 0;
|
||||
public typesTranslationMap = new Map<Type, string>();
|
||||
public Validators = Validators;
|
||||
@ -71,6 +72,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
) {}
|
||||
|
||||
public ngOnInit() {
|
||||
this.mode = this.data.activity.id ? 'update' : 'create';
|
||||
this.locale = this.data.user?.settings?.locale;
|
||||
this.dateAdapter.setLocale(this.locale);
|
||||
|
||||
@ -79,7 +81,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
this.currencies = currencies;
|
||||
this.defaultDateFormat = getDateFormatString(this.locale);
|
||||
this.platforms = platforms;
|
||||
this.tags = tags.map(({ id, name }) => {
|
||||
this.tagsAvailable = tags.map(({ id, name }) => {
|
||||
return {
|
||||
id,
|
||||
name: translate(name)
|
||||
@ -92,7 +94,9 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
|
||||
this.activityForm = this.formBuilder.group({
|
||||
accountId: [
|
||||
this.data.accounts.length === 1 && !this.data.activity?.accountId
|
||||
this.data.accounts.length === 1 &&
|
||||
!this.data.activity?.accountId &&
|
||||
this.mode === 'create'
|
||||
? this.data.accounts[0].id
|
||||
: this.data.activity?.accountId,
|
||||
Validators.required
|
||||
@ -283,7 +287,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
].valueChanges.pipe(
|
||||
startWith(this.activityForm.get('tags').value),
|
||||
map((aTags: Tag[] | null) => {
|
||||
return aTags ? this.filterTags(aTags) : this.tags.slice();
|
||||
return aTags ? this.filterTags(aTags) : this.tagsAvailable.slice();
|
||||
})
|
||||
);
|
||||
|
||||
@ -437,10 +441,11 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
public onAddTag(event: MatAutocompleteSelectedEvent) {
|
||||
this.activityForm.get('tags').setValue([
|
||||
...(this.activityForm.get('tags').value ?? []),
|
||||
this.tags.find(({ id }) => {
|
||||
this.tagsAvailable.find(({ id }) => {
|
||||
return id === event.option.value;
|
||||
})
|
||||
]);
|
||||
|
||||
this.tagInput.nativeElement.value = '';
|
||||
}
|
||||
|
||||
@ -479,18 +484,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
};
|
||||
|
||||
try {
|
||||
if (this.data.activity.id) {
|
||||
(activity as UpdateOrderDto).id = this.data.activity.id;
|
||||
|
||||
await validateObjectForForm({
|
||||
classDto: UpdateOrderDto,
|
||||
form: this.activityForm,
|
||||
ignoreFields: ['dataSource', 'date'],
|
||||
object: activity as UpdateOrderDto
|
||||
});
|
||||
|
||||
this.dialogRef.close(activity as UpdateOrderDto);
|
||||
} else {
|
||||
if (this.mode === 'create') {
|
||||
(activity as CreateOrderDto).updateAccountBalance =
|
||||
this.activityForm.get('updateAccountBalance').value;
|
||||
|
||||
@ -502,6 +496,17 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
});
|
||||
|
||||
this.dialogRef.close(activity as CreateOrderDto);
|
||||
} else {
|
||||
(activity as UpdateOrderDto).id = this.data.activity.id;
|
||||
|
||||
await validateObjectForForm({
|
||||
classDto: UpdateOrderDto,
|
||||
form: this.activityForm,
|
||||
ignoreFields: ['dataSource', 'date'],
|
||||
object: activity as UpdateOrderDto
|
||||
});
|
||||
|
||||
this.dialogRef.close(activity as UpdateOrderDto);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@ -514,12 +519,12 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
|
||||
}
|
||||
|
||||
private filterTags(aTags: Tag[]) {
|
||||
const tagIds = aTags.map((tag) => {
|
||||
return tag.id;
|
||||
const tagIds = aTags.map(({ id }) => {
|
||||
return id;
|
||||
});
|
||||
|
||||
return this.tags.filter((tag) => {
|
||||
return !tagIds.includes(tag.id);
|
||||
return this.tagsAvailable.filter(({ id }) => {
|
||||
return !tagIds.includes(id);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
(keyup.enter)="activityForm.valid && onSubmit()"
|
||||
(ngSubmit)="onSubmit()"
|
||||
>
|
||||
@if (data.activity.id) {
|
||||
<h1 i18n mat-dialog-title>Update activity</h1>
|
||||
} @else {
|
||||
@if (mode === 'create') {
|
||||
<h1 i18n mat-dialog-title>Add activity</h1>
|
||||
} @else {
|
||||
<h1 i18n mat-dialog-title>Update activity</h1>
|
||||
}
|
||||
<div class="flex-grow-1 py-3" mat-dialog-content>
|
||||
<div class="mb-3">
|
||||
@ -76,16 +76,17 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div [ngClass]="{ 'mb-3': data.activity.id }">
|
||||
<div [ngClass]="{ 'mb-3': mode === 'update' }">
|
||||
<mat-form-field
|
||||
appearance="outline"
|
||||
class="w-100"
|
||||
[ngClass]="{ 'mb-1 without-hint': !data.activity.id }"
|
||||
[ngClass]="{ 'mb-1 without-hint': mode === 'create' }"
|
||||
>
|
||||
<mat-label i18n>Account</mat-label>
|
||||
<mat-select formControlName="accountId">
|
||||
@if (
|
||||
!activityForm.get('accountId').hasValidator(Validators.required)
|
||||
!activityForm.get('accountId').hasValidator(Validators.required) ||
|
||||
(!activityForm.get('accountId').value && mode === 'update')
|
||||
) {
|
||||
<mat-option [value]="null" />
|
||||
}
|
||||
@ -106,7 +107,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="mb-3" [ngClass]="{ 'd-none': data.activity.id }">
|
||||
<div class="mb-3" [ngClass]="{ 'd-none': mode === 'update' }">
|
||||
<mat-checkbox color="primary" formControlName="updateAccountBalance" i18n
|
||||
>Update Cash Balance</mat-checkbox
|
||||
>
|
||||
@ -377,11 +378,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="mb-3" [ngClass]="{ 'd-none': tags?.length < 1 }">
|
||||
<div class="mb-3" [ngClass]="{ 'd-none': tagsAvailable?.length < 1 }">
|
||||
<mat-form-field appearance="outline" class="w-100">
|
||||
<mat-label i18n>Tags</mat-label>
|
||||
<mat-chip-grid #tagsChipList>
|
||||
@for (tag of activityForm.get('tags')?.value; track tag) {
|
||||
@for (tag of activityForm.get('tags')?.value; track tag.id) {
|
||||
<mat-chip-row
|
||||
matChipRemove
|
||||
[removable]="true"
|
||||
@ -403,7 +404,7 @@
|
||||
#autocompleteTags="matAutocomplete"
|
||||
(optionSelected)="onAddTag($event)"
|
||||
>
|
||||
@for (tag of filteredTagsObservable | async; track tag) {
|
||||
@for (tag of filteredTagsObservable | async; track tag.id) {
|
||||
<mat-option [value]="tag.id">
|
||||
{{ tag.name }}
|
||||
</mat-option>
|
||||
|
@ -38,6 +38,7 @@ import { ImportActivitiesDialogParams } from './interfaces/interfaces';
|
||||
export class ImportActivitiesDialog implements OnDestroy {
|
||||
public accounts: CreateAccountDto[] = [];
|
||||
public activities: Activity[] = [];
|
||||
public assetProfileForm: FormGroup;
|
||||
public dataSource: MatTableDataSource<Activity>;
|
||||
public details: any[] = [];
|
||||
public deviceType: string;
|
||||
@ -53,7 +54,6 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
public sortDirection: SortDirection = 'desc';
|
||||
public stepperOrientation: StepperOrientation;
|
||||
public totalItems: number;
|
||||
public uniqueAssetForm: FormGroup;
|
||||
|
||||
private unsubscribeSubject = new Subject<void>();
|
||||
|
||||
@ -73,8 +73,8 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
this.stepperOrientation =
|
||||
this.deviceType === 'mobile' ? 'vertical' : 'horizontal';
|
||||
|
||||
this.uniqueAssetForm = this.formBuilder.group({
|
||||
uniqueAsset: [undefined, Validators.required]
|
||||
this.assetProfileForm = this.formBuilder.group({
|
||||
assetProfileIdentifier: [undefined, Validators.required]
|
||||
});
|
||||
|
||||
if (
|
||||
@ -85,7 +85,7 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
|
||||
this.dialogTitle = $localize`Import Dividends`;
|
||||
this.mode = 'DIVIDEND';
|
||||
this.uniqueAssetForm.get('uniqueAsset').disable();
|
||||
this.assetProfileForm.get('assetProfileIdentifier').disable();
|
||||
|
||||
this.dataService
|
||||
.fetchPortfolioHoldings({
|
||||
@ -102,7 +102,7 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
this.holdings = sortBy(holdings, ({ name }) => {
|
||||
return name.toLowerCase();
|
||||
});
|
||||
this.uniqueAssetForm.get('uniqueAsset').enable();
|
||||
this.assetProfileForm.get('assetProfileIdentifier').enable();
|
||||
|
||||
this.isLoading = false;
|
||||
|
||||
@ -167,10 +167,11 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
}
|
||||
|
||||
public onLoadDividends(aStepper: MatStepper) {
|
||||
this.uniqueAssetForm.get('uniqueAsset').disable();
|
||||
this.assetProfileForm.get('assetProfileIdentifier').disable();
|
||||
|
||||
const { dataSource, symbol } =
|
||||
this.uniqueAssetForm.get('uniqueAsset').value;
|
||||
const { dataSource, symbol } = this.assetProfileForm.get(
|
||||
'assetProfileIdentifier'
|
||||
).value;
|
||||
|
||||
this.dataService
|
||||
.fetchDividendsImport({
|
||||
@ -193,7 +194,7 @@ export class ImportActivitiesDialog implements OnDestroy {
|
||||
this.details = [];
|
||||
this.errorMessages = [];
|
||||
this.importStep = ImportStep.SELECT_ACTIVITIES;
|
||||
this.uniqueAssetForm.get('uniqueAsset').enable();
|
||||
this.assetProfileForm.get('assetProfileIdentifier').enable();
|
||||
|
||||
aStepper.reset();
|
||||
}
|
||||
|
@ -25,14 +25,14 @@
|
||||
<div class="pt-3">
|
||||
@if (mode === 'DIVIDEND') {
|
||||
<form
|
||||
[formGroup]="uniqueAssetForm"
|
||||
[formGroup]="assetProfileForm"
|
||||
(ngSubmit)="onLoadDividends(stepper)"
|
||||
>
|
||||
<mat-form-field appearance="outline" class="w-100">
|
||||
<mat-label i18n>Holding</mat-label>
|
||||
<mat-select formControlName="uniqueAsset">
|
||||
<mat-select formControlName="assetProfileIdentifier">
|
||||
<mat-select-trigger>{{
|
||||
uniqueAssetForm.get('uniqueAsset')?.value?.name
|
||||
assetProfileForm.get('assetProfileIdentifier')?.value?.name
|
||||
}}</mat-select-trigger>
|
||||
@for (holding of holdings; track holding) {
|
||||
<mat-option
|
||||
@ -63,7 +63,7 @@
|
||||
color="primary"
|
||||
mat-flat-button
|
||||
type="submit"
|
||||
[disabled]="!uniqueAssetForm.valid"
|
||||
[disabled]="!assetProfileForm.valid"
|
||||
>
|
||||
<span i18n>Load Dividends</span>
|
||||
</button>
|
||||
|
@ -6,12 +6,13 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||
import { MAX_TOP_HOLDINGS, UNKNOWN_KEY } from '@ghostfolio/common/config';
|
||||
import { prettifySymbol } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
Holding,
|
||||
PortfolioDetails,
|
||||
PortfolioPosition,
|
||||
UniqueAsset,
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
import { Market, MarketAdvanced } from '@ghostfolio/common/types';
|
||||
import { translate } from '@ghostfolio/ui/i18n';
|
||||
|
||||
@ -161,7 +162,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
public onAccountChartClicked({ symbol }: UniqueAsset) {
|
||||
public onAccountChartClicked({ symbol }: AssetProfileIdentifier) {
|
||||
if (symbol && symbol !== UNKNOWN_KEY) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { accountId: symbol, accountDetailDialog: true }
|
||||
@ -169,7 +170,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
public onSymbolChartClicked({ dataSource, symbol }: UniqueAsset) {
|
||||
public onSymbolChartClicked({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
if (dataSource && symbol) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { dataSource, symbol, holdingDetailDialog: true }
|
||||
@ -584,7 +585,11 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
||||
data: <AccountDetailDialogParams>{
|
||||
accountId: aAccountId,
|
||||
deviceType: this.deviceType,
|
||||
hasImpersonationId: this.hasImpersonationId
|
||||
hasImpersonationId: this.hasImpersonationId,
|
||||
hasPermissionToCreateOrder:
|
||||
!this.hasImpersonationId &&
|
||||
hasPermission(this.user?.permissions, permissions.createOrder) &&
|
||||
!this.user?.settings?.isRestrictedView
|
||||
},
|
||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
import { Product } from '@ghostfolio/common/interfaces';
|
||||
import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools';
|
||||
import { translate } from '@ghostfolio/ui/i18n';
|
||||
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
@ -26,6 +27,7 @@ export class GfProductPageComponent implements OnInit {
|
||||
'/' + $localize`resources`,
|
||||
'personal-finance-tools'
|
||||
];
|
||||
public tags: string[];
|
||||
|
||||
public constructor(
|
||||
private dataService: DataService,
|
||||
@ -56,7 +58,7 @@ export class GfProductPageComponent implements OnInit {
|
||||
],
|
||||
name: 'Ghostfolio',
|
||||
origin: $localize`Switzerland`,
|
||||
region: $localize`Global`,
|
||||
regions: [$localize`Global`],
|
||||
slogan: 'Open Source Wealth Management',
|
||||
useAnonymously: true
|
||||
};
|
||||
@ -64,5 +66,41 @@ export class GfProductPageComponent implements OnInit {
|
||||
this.product2 = personalFinanceTools.find(({ key }) => {
|
||||
return key === this.route.snapshot.data['key'];
|
||||
});
|
||||
|
||||
if (this.product2.origin) {
|
||||
this.product2.origin = translate(this.product2.origin);
|
||||
}
|
||||
|
||||
if (this.product2.regions) {
|
||||
this.product2.regions = this.product2.regions.map((region) => {
|
||||
return translate(region);
|
||||
});
|
||||
}
|
||||
|
||||
this.tags = [
|
||||
this.product1.name,
|
||||
this.product2.name,
|
||||
$localize`Alternative`,
|
||||
$localize`App`,
|
||||
$localize`Budgeting`,
|
||||
$localize`Community`,
|
||||
$localize`Family Office`,
|
||||
`Fintech`,
|
||||
$localize`Investment`,
|
||||
$localize`Investor`,
|
||||
$localize`Open Source`,
|
||||
`OSS`,
|
||||
$localize`Personal Finance`,
|
||||
$localize`Privacy`,
|
||||
$localize`Portfolio`,
|
||||
$localize`Software`,
|
||||
$localize`Tool`,
|
||||
$localize`User Experience`,
|
||||
$localize`Wealth`,
|
||||
$localize`Wealth Management`,
|
||||
`WealthTech`
|
||||
].sort((a, b) => {
|
||||
return a.localeCompare(b, undefined, { sensitivity: 'base' });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,24 @@
|
||||
</tr>
|
||||
<tr class="mat-mdc-row">
|
||||
<td class="mat-mdc-cell px-3 py-2 text-right" i18n>Region</td>
|
||||
<td class="mat-mdc-cell px-1 py-2">{{ product1.region }}</td>
|
||||
<td class="mat-mdc-cell px-1 py-2">{{ product2.region }}</td>
|
||||
<td class="mat-mdc-cell px-1 py-2">
|
||||
@for (
|
||||
region of product1.regions;
|
||||
track region;
|
||||
let isLast = $last
|
||||
) {
|
||||
{{ region }}{{ isLast ? '' : ', ' }}
|
||||
}
|
||||
</td>
|
||||
<td class="mat-mdc-cell px-1 py-2">
|
||||
@for (
|
||||
region of product2.regions;
|
||||
track region;
|
||||
let isLast = $last
|
||||
) {
|
||||
{{ region }}{{ isLast ? '' : ', ' }}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="mat-mdc-row">
|
||||
<td class="mat-mdc-cell px-3 py-2 text-right" i18n>
|
||||
@ -236,69 +252,11 @@
|
||||
</section>
|
||||
<section class="mb-4">
|
||||
<ul class="list-inline">
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Alternative</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">App</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Budgeting</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Community</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Family Office</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Fintech</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">{{ product1.name }}</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Investment</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Investor</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Open Source</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">OSS</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Personal Finance</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Privacy</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Portfolio</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Software</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Tool</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">User Experience</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Wealth</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">WealthTech</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">Wealth Management</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">{{ product2.name }}</span>
|
||||
</li>
|
||||
@for (tag of tags; track tag) {
|
||||
<li class="list-inline-item">
|
||||
<span class="badge badge-light">{{ tag }}</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
<nav aria-label="breadcrumb">
|
||||
|
@ -7,13 +7,13 @@ import { UpdateTagDto } from '@ghostfolio/api/app/tag/update-tag.dto';
|
||||
import { IDataProviderHistoricalResponse } from '@ghostfolio/api/services/interfaces/interfaces';
|
||||
import { DATE_FORMAT } from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
AdminData,
|
||||
AdminJobs,
|
||||
AdminMarketData,
|
||||
AdminMarketDataDetails,
|
||||
EnhancedSymbolProfile,
|
||||
Filter,
|
||||
UniqueAsset
|
||||
Filter
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
@ -35,7 +35,7 @@ export class AdminService {
|
||||
private http: HttpClient
|
||||
) {}
|
||||
|
||||
public addAssetProfile({ dataSource, symbol }: UniqueAsset) {
|
||||
public addAssetProfile({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.http.post<void>(
|
||||
`/api/v1/admin/profile-data/${dataSource}/${symbol}`,
|
||||
null
|
||||
@ -62,7 +62,7 @@ export class AdminService {
|
||||
return this.http.delete<void>(`/api/v1/platform/${aId}`);
|
||||
}
|
||||
|
||||
public deleteProfileData({ dataSource, symbol }: UniqueAsset) {
|
||||
public deleteProfileData({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.http.delete<void>(
|
||||
`/api/v1/admin/profile-data/${dataSource}/${symbol}`
|
||||
);
|
||||
@ -167,7 +167,10 @@ export class AdminService {
|
||||
return this.http.post<void>('/api/v1/admin/gather/profile-data', {});
|
||||
}
|
||||
|
||||
public gatherProfileDataBySymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
public gatherProfileDataBySymbol({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
return this.http.post<void>(
|
||||
`/api/v1/admin/gather/profile-data/${dataSource}/${symbol}`,
|
||||
{}
|
||||
@ -178,7 +181,7 @@ export class AdminService {
|
||||
dataSource,
|
||||
date,
|
||||
symbol
|
||||
}: UniqueAsset & {
|
||||
}: AssetProfileIdentifier & {
|
||||
date?: Date;
|
||||
}) {
|
||||
let url = `/api/v1/admin/gather/${dataSource}/${symbol}`;
|
||||
@ -217,7 +220,7 @@ export class AdminService {
|
||||
symbol,
|
||||
symbolMapping,
|
||||
url
|
||||
}: UniqueAsset & UpdateAssetProfileDto) {
|
||||
}: AssetProfileIdentifier & UpdateAssetProfileDto) {
|
||||
return this.http.patch<EnhancedSymbolProfile>(
|
||||
`/api/v1/admin/profile-data/${dataSource}/${symbol}`,
|
||||
{
|
||||
@ -272,7 +275,7 @@ export class AdminService {
|
||||
dataSource,
|
||||
scraperConfiguration,
|
||||
symbol
|
||||
}: UniqueAsset & UpdateAssetProfileDto['scraperConfiguration']) {
|
||||
}: AssetProfileIdentifier & UpdateAssetProfileDto['scraperConfiguration']) {
|
||||
return this.http.post<any>(
|
||||
`/api/v1/admin/market-data/${dataSource}/${symbol}/test`,
|
||||
{
|
||||
|
@ -4,7 +4,10 @@ import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto
|
||||
import { TransferBalanceDto } from '@ghostfolio/api/app/account/transfer-balance.dto';
|
||||
import { UpdateAccountDto } from '@ghostfolio/api/app/account/update-account.dto';
|
||||
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
|
||||
import { Activities } from '@ghostfolio/api/app/order/interfaces/activities.interface';
|
||||
import {
|
||||
Activities,
|
||||
Activity
|
||||
} from '@ghostfolio/api/app/order/interfaces/activities.interface';
|
||||
import { UpdateOrderDto } from '@ghostfolio/api/app/order/update-order.dto';
|
||||
import { PortfolioHoldingDetail } from '@ghostfolio/api/app/portfolio/interfaces/portfolio-holding-detail.interface';
|
||||
import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';
|
||||
@ -20,6 +23,7 @@ import {
|
||||
AccountBalancesResponse,
|
||||
Accounts,
|
||||
AdminMarketDataDetails,
|
||||
AssetProfileIdentifier,
|
||||
BenchmarkMarketDataDetails,
|
||||
BenchmarkResponse,
|
||||
Export,
|
||||
@ -34,7 +38,6 @@ import {
|
||||
PortfolioPerformanceResponse,
|
||||
PortfolioPublicDetails,
|
||||
PortfolioReport,
|
||||
UniqueAsset,
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { filterGlobalPermissions } from '@ghostfolio/common/permissions';
|
||||
@ -47,7 +50,8 @@ import { SortDirection } from '@angular/material/sort';
|
||||
import {
|
||||
AccountBalance,
|
||||
DataSource,
|
||||
Order as OrderModel
|
||||
Order as OrderModel,
|
||||
Tag
|
||||
} from '@prisma/client';
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import { cloneDeep, groupBy, isNumber } from 'lodash';
|
||||
@ -211,6 +215,17 @@ export class DataService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchActivity(aActivityId: string) {
|
||||
return this.http.get<Activity>(`/api/v1/order/${aActivityId}`).pipe(
|
||||
map((activity) => {
|
||||
activity.createdAt = parseISO(<string>(<unknown>activity.createdAt));
|
||||
activity.date = parseISO(<string>(<unknown>activity.date));
|
||||
|
||||
return activity;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public fetchDividends({
|
||||
filters,
|
||||
groupBy = 'month',
|
||||
@ -229,7 +244,7 @@ export class DataService {
|
||||
});
|
||||
}
|
||||
|
||||
public fetchDividendsImport({ dataSource, symbol }: UniqueAsset) {
|
||||
public fetchDividendsImport({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.http.get<ImportResponse>(
|
||||
`/api/v1/import/dividends/${dataSource}/${symbol}`
|
||||
);
|
||||
@ -269,7 +284,7 @@ export class DataService {
|
||||
return this.http.delete<any>(`/api/v1/order/${aId}`);
|
||||
}
|
||||
|
||||
public deleteBenchmark({ dataSource, symbol }: UniqueAsset) {
|
||||
public deleteBenchmark({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
return this.http.delete<any>(`/api/v1/benchmark/${dataSource}/${symbol}`);
|
||||
}
|
||||
|
||||
@ -288,7 +303,7 @@ export class DataService {
|
||||
public fetchAsset({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset): Observable<AdminMarketDataDetails> {
|
||||
}: AssetProfileIdentifier): Observable<AdminMarketDataDetails> {
|
||||
return this.http.get<any>(`/api/v1/asset/${dataSource}/${symbol}`).pipe(
|
||||
map((data) => {
|
||||
for (const item of data.marketData) {
|
||||
@ -307,7 +322,7 @@ export class DataService {
|
||||
}: {
|
||||
range: DateRange;
|
||||
startDate: Date;
|
||||
} & UniqueAsset): Observable<BenchmarkMarketDataDetails> {
|
||||
} & AssetProfileIdentifier): Observable<BenchmarkMarketDataDetails> {
|
||||
let params = new HttpParams();
|
||||
|
||||
if (range) {
|
||||
@ -629,7 +644,7 @@ export class DataService {
|
||||
);
|
||||
}
|
||||
|
||||
public postBenchmark(benchmark: UniqueAsset) {
|
||||
public postBenchmark(benchmark: AssetProfileIdentifier) {
|
||||
return this.http.post(`/api/v1/benchmark`, benchmark);
|
||||
}
|
||||
|
||||
@ -649,6 +664,17 @@ export class DataService {
|
||||
return this.http.put<void>(`/api/v1/admin/settings/${key}`, aData);
|
||||
}
|
||||
|
||||
public putHoldingTags({
|
||||
dataSource,
|
||||
symbol,
|
||||
tags
|
||||
}: { tags: Tag[] } & AssetProfileIdentifier) {
|
||||
return this.http.put<void>(
|
||||
`/api/v1/portfolio/position/${dataSource}/${symbol}/tags`,
|
||||
{ tags }
|
||||
);
|
||||
}
|
||||
|
||||
public putOrder(aOrder: UpdateOrderDto) {
|
||||
return this.http.put<UserItem>(`/api/v1/order/${aOrder.id}`, aOrder);
|
||||
}
|
||||
|
6958
apps/client/src/locales/messages.ca.xlf
Normal file
6958
apps/client/src/locales/messages.ca.xlf
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -73,40 +73,40 @@ $gf-secondary: (
|
||||
|
||||
$gf-typography: mat.m2-define-typography-config();
|
||||
|
||||
@include mat.core();
|
||||
|
||||
// Create default theme
|
||||
$gf-theme-default: mat.m2-define-light-theme(
|
||||
(
|
||||
color: (
|
||||
primary: mat.m2-define-palette($gf-primary),
|
||||
accent: mat.m2-define-palette($gf-secondary, 500, 900, A100)
|
||||
accent: mat.m2-define-palette($gf-secondary, 500, 900, A100),
|
||||
primary: mat.m2-define-palette($gf-primary)
|
||||
),
|
||||
density: -3,
|
||||
typography: $gf-typography
|
||||
)
|
||||
);
|
||||
|
||||
@include mat.all-component-themes($gf-theme-default);
|
||||
@include mat.button-density(0);
|
||||
@include mat.table-density(-1);
|
||||
|
||||
// Create dark theme
|
||||
$gf-theme-dark: mat.m2-define-dark-theme(
|
||||
(
|
||||
color: (
|
||||
primary: mat.m2-define-palette($gf-primary),
|
||||
accent: mat.m2-define-palette($gf-secondary, 500, 900, A100)
|
||||
accent: mat.m2-define-palette($gf-secondary, 500, 900, A100),
|
||||
primary: mat.m2-define-palette($gf-primary)
|
||||
),
|
||||
density: -3,
|
||||
typography: $gf-typography
|
||||
)
|
||||
);
|
||||
|
||||
.is-dark-theme {
|
||||
@include mat.all-component-colors($gf-theme-dark);
|
||||
@include mat.button-density(0);
|
||||
@include mat.table-density(-1);
|
||||
}
|
||||
|
||||
@include mat.button-density(0);
|
||||
@include mat.core();
|
||||
@include mat.table-density(-1);
|
||||
|
||||
:root {
|
||||
--gf-theme-alpha-hover: 0.04;
|
||||
--gf-theme-primary-500: #36cfcc;
|
||||
|
@ -6,7 +6,6 @@ services:
|
||||
- ../.env
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?connect_timeout=300&sslmode=prefer
|
||||
NODE_ENV: production
|
||||
REDIS_HOST: redis
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
ports:
|
||||
@ -21,8 +20,9 @@ services:
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
postgres:
|
||||
image: postgres:15
|
||||
image: docker.io/library/postgres:15
|
||||
env_file:
|
||||
- ../.env
|
||||
healthcheck:
|
||||
@ -32,8 +32,9 @@ services:
|
||||
retries: 5
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
image: docker.io/library/redis:alpine
|
||||
env_file:
|
||||
- ../.env
|
||||
command: ['redis-server', '--requirepass', $REDIS_PASSWORD]
|
||||
|
@ -1,6 +1,6 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
image: docker.io/library/postgres:15
|
||||
container_name: postgres
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
@ -9,8 +9,9 @@ services:
|
||||
- ${POSTGRES_PORT:-5432}:5432
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
image: docker.io/library/redis:alpine
|
||||
container_name: redis
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
|
@ -1,12 +1,16 @@
|
||||
services:
|
||||
ghostfolio:
|
||||
image: ghostfolio/ghostfolio:latest
|
||||
image: docker.io/ghostfolio/ghostfolio:latest
|
||||
init: true
|
||||
read_only: true
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
env_file:
|
||||
- ../.env
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?connect_timeout=300&sslmode=prefer
|
||||
NODE_ENV: production
|
||||
REDIS_HOST: redis
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
ports:
|
||||
@ -21,8 +25,19 @@ services:
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
postgres:
|
||||
image: postgres:15
|
||||
image: docker.io/library/postgres:15
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- DAC_READ_SEARCH
|
||||
- FOWNER
|
||||
- SETGID
|
||||
- SETUID
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
env_file:
|
||||
- ../.env
|
||||
healthcheck:
|
||||
@ -32,8 +47,14 @@ services:
|
||||
retries: 5
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
image: docker.io/library/redis:alpine
|
||||
user: '999:1000'
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
env_file:
|
||||
- ../.env
|
||||
command: ['redis-server', '--requirepass', $REDIS_PASSWORD]
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Will check if "yarn format" is run before executing.
|
||||
# Will check if "npm run format" is run before executing.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
|
||||
echo "Running yarn format"
|
||||
echo "Running npm run format"
|
||||
|
||||
# Run the command and loop over its output
|
||||
FILES_TO_STAGE=""
|
||||
@ -14,13 +14,13 @@ while IFS= read -r line; do
|
||||
# Process each line here
|
||||
((i++))
|
||||
if [ $i -le 2 ]; then
|
||||
continue
|
||||
continue
|
||||
fi
|
||||
if [[ $line == Done* ]]; then
|
||||
break
|
||||
break
|
||||
fi
|
||||
FILES_TO_STAGE="$FILES_TO_STAGE $line"
|
||||
|
||||
done < <(yarn format )
|
||||
done < <(npm run format)
|
||||
git add $FILES_TO_STAGE
|
||||
echo "Files formatted. Committing..."
|
||||
|
50
libs/common/src/lib/calculation-helper.spec.ts
Normal file
50
libs/common/src/lib/calculation-helper.spec.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { Big } from 'big.js';
|
||||
|
||||
import { getAnnualizedPerformancePercent } from './calculation-helper';
|
||||
|
||||
describe('CalculationHelper', () => {
|
||||
describe('annualized performance percentage', () => {
|
||||
it('Get annualized performance', async () => {
|
||||
expect(
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: NaN, // differenceInDays of date-fns returns NaN for the same day
|
||||
netPerformancePercentage: new Big(0)
|
||||
}).toNumber()
|
||||
).toEqual(0);
|
||||
|
||||
expect(
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: 0,
|
||||
netPerformancePercentage: new Big(0)
|
||||
}).toNumber()
|
||||
).toEqual(0);
|
||||
|
||||
/**
|
||||
* Source: https://www.readyratios.com/reference/analysis/annualized_rate.html
|
||||
*/
|
||||
expect(
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: 65, // < 1 year
|
||||
netPerformancePercentage: new Big(0.1025)
|
||||
}).toNumber()
|
||||
).toBeCloseTo(0.729705);
|
||||
|
||||
expect(
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: 365, // 1 year
|
||||
netPerformancePercentage: new Big(0.05)
|
||||
}).toNumber()
|
||||
).toBeCloseTo(0.05);
|
||||
|
||||
/**
|
||||
* Source: https://www.investopedia.com/terms/a/annualized-total-return.asp#annualized-return-formula-and-calculation
|
||||
*/
|
||||
expect(
|
||||
getAnnualizedPerformancePercent({
|
||||
daysInMarket: 575, // > 1 year
|
||||
netPerformancePercentage: new Big(0.2374)
|
||||
}).toNumber()
|
||||
).toBeCloseTo(0.145);
|
||||
});
|
||||
});
|
||||
});
|
20
libs/common/src/lib/calculation-helper.ts
Normal file
20
libs/common/src/lib/calculation-helper.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Big } from 'big.js';
|
||||
import { isNumber } from 'lodash';
|
||||
|
||||
export function getAnnualizedPerformancePercent({
|
||||
daysInMarket,
|
||||
netPerformancePercentage
|
||||
}: {
|
||||
daysInMarket: number;
|
||||
netPerformancePercentage: Big;
|
||||
}): Big {
|
||||
if (isNumber(daysInMarket) && daysInMarket > 0) {
|
||||
const exponent = new Big(365).div(daysInMarket).toNumber();
|
||||
|
||||
return new Big(
|
||||
Math.pow(netPerformancePercentage.plus(1).toNumber(), exponent)
|
||||
).minus(1);
|
||||
}
|
||||
|
||||
return new Big(0);
|
||||
}
|
@ -132,6 +132,7 @@ export const REPLACE_NAME_PARTS = [
|
||||
];
|
||||
|
||||
export const SUPPORTED_LANGUAGE_CODES = [
|
||||
'ca',
|
||||
'de',
|
||||
'en',
|
||||
'es',
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
parseISO,
|
||||
subDays
|
||||
} from 'date-fns';
|
||||
import { de, es, fr, it, nl, pl, pt, tr, zhCN } from 'date-fns/locale';
|
||||
import { ca, de, es, fr, it, nl, pl, pt, tr, zhCN } from 'date-fns/locale';
|
||||
|
||||
import {
|
||||
DEFAULT_CURRENCY,
|
||||
@ -19,7 +19,7 @@ import {
|
||||
ghostfolioScraperApiSymbolPrefix,
|
||||
locale
|
||||
} from './config';
|
||||
import { Benchmark, UniqueAsset } from './interfaces';
|
||||
import { AssetProfileIdentifier, Benchmark } from './interfaces';
|
||||
import { BenchmarkTrend, ColorScheme } from './types';
|
||||
|
||||
export const DATE_FORMAT = 'yyyy-MM-dd';
|
||||
@ -147,7 +147,10 @@ export function getAllActivityTypes(): ActivityType[] {
|
||||
return Object.values(ActivityType);
|
||||
}
|
||||
|
||||
export function getAssetProfileIdentifier({ dataSource, symbol }: UniqueAsset) {
|
||||
export function getAssetProfileIdentifier({
|
||||
dataSource,
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
return `${dataSource}-${symbol}`;
|
||||
}
|
||||
|
||||
@ -171,7 +174,9 @@ export function getCurrencyFromSymbol(aSymbol = '') {
|
||||
}
|
||||
|
||||
export function getDateFnsLocale(aLanguageCode: string) {
|
||||
if (aLanguageCode === 'de') {
|
||||
if (aLanguageCode === 'ca') {
|
||||
return ca;
|
||||
} else if (aLanguageCode === 'de') {
|
||||
return de;
|
||||
} else if (aLanguageCode === 'es') {
|
||||
return es;
|
||||
@ -375,7 +380,7 @@ export function parseDate(date: string): Date | null {
|
||||
return parseISO(date);
|
||||
}
|
||||
|
||||
export function parseSymbol({ dataSource, symbol }: UniqueAsset) {
|
||||
export function parseSymbol({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
const [ticker, exchange] = symbol.split('.');
|
||||
|
||||
return {
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Role } from '@prisma/client';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { UniqueAsset } from './unique-asset.interface';
|
||||
import { Role } from '@prisma/client';
|
||||
|
||||
export interface AdminData {
|
||||
exchangeRates: ({
|
||||
label1: string;
|
||||
label2: string;
|
||||
value: number;
|
||||
} & UniqueAsset)[];
|
||||
} & AssetProfileIdentifier)[];
|
||||
settings: { [key: string]: boolean | object | string | string[] };
|
||||
transactionCount: number;
|
||||
userCount: number;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { DataSource } from '@prisma/client';
|
||||
|
||||
export interface UniqueAsset {
|
||||
export interface AssetProfileIdentifier {
|
||||
dataSource: DataSource;
|
||||
symbol: string;
|
||||
}
|
@ -7,6 +7,7 @@ import type {
|
||||
AdminMarketData,
|
||||
AdminMarketDataItem
|
||||
} from './admin-market-data.interface';
|
||||
import type { AssetProfileIdentifier } from './asset-profile-identifier.interface';
|
||||
import type { BenchmarkMarketDataDetails } from './benchmark-market-data-details.interface';
|
||||
import type { BenchmarkProperty } from './benchmark-property.interface';
|
||||
import type { Benchmark } from './benchmark.interface';
|
||||
@ -48,7 +49,6 @@ import type { Subscription } from './subscription.interface';
|
||||
import type { SymbolMetrics } from './symbol-metrics.interface';
|
||||
import type { SystemMessage } from './system-message.interface';
|
||||
import type { TabConfiguration } from './tab-configuration.interface';
|
||||
import type { UniqueAsset } from './unique-asset.interface';
|
||||
import type { UserSettings } from './user-settings.interface';
|
||||
import type { User } from './user.interface';
|
||||
|
||||
@ -61,6 +61,7 @@ export {
|
||||
AdminMarketData,
|
||||
AdminMarketDataDetails,
|
||||
AdminMarketDataItem,
|
||||
AssetProfileIdentifier,
|
||||
Benchmark,
|
||||
BenchmarkMarketDataDetails,
|
||||
BenchmarkProperty,
|
||||
@ -101,7 +102,6 @@ export {
|
||||
Subscription,
|
||||
SymbolMetrics,
|
||||
TabConfiguration,
|
||||
UniqueAsset,
|
||||
User,
|
||||
UserSettings
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ export interface Product {
|
||||
note?: string;
|
||||
origin?: string;
|
||||
pricingPerYear?: string;
|
||||
region?: string;
|
||||
regions?: string[];
|
||||
slogan?: string;
|
||||
useAnonymously?: boolean;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { UniqueAsset } from '../unique-asset.interface';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
|
||||
export interface ResponseError {
|
||||
errors?: UniqueAsset[];
|
||||
errors?: AssetProfileIdentifier[];
|
||||
hasErrors: boolean;
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
import { ColorScheme, DateRange, ViewMode } from '@ghostfolio/common/types';
|
||||
import {
|
||||
ColorScheme,
|
||||
DateRange,
|
||||
HoldingsViewMode,
|
||||
ViewMode
|
||||
} from '@ghostfolio/common/types';
|
||||
|
||||
export interface UserSettings {
|
||||
annualInterestRate?: number;
|
||||
@ -9,6 +14,7 @@ export interface UserSettings {
|
||||
emergencyFund?: number;
|
||||
'filters.accounts'?: string[];
|
||||
'filters.tags'?: string[];
|
||||
holdingsViewMode?: HoldingsViewMode;
|
||||
isExperimentalFeatures?: boolean;
|
||||
isRestrictedView?: boolean;
|
||||
language?: string;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { transformToBig } from '@ghostfolio/common/class-transformer';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
import { TimelinePosition } from '@ghostfolio/common/models';
|
||||
|
||||
import { Big } from 'big.js';
|
||||
@ -9,7 +9,7 @@ export class PortfolioSnapshot {
|
||||
@Transform(transformToBig, { toClassOnly: true })
|
||||
@Type(() => Big)
|
||||
currentValueInBaseCurrency: Big;
|
||||
errors?: UniqueAsset[];
|
||||
errors?: AssetProfileIdentifier[];
|
||||
|
||||
@Transform(transformToBig, { toClassOnly: true })
|
||||
@Type(() => Big)
|
||||
|
@ -15,7 +15,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'allvue-systems',
|
||||
name: 'Allvue Systems',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Investment Software Suite'
|
||||
},
|
||||
{
|
||||
@ -30,7 +30,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'altoo',
|
||||
name: 'Altoo Wealth Platform',
|
||||
origin: `Switzerland`,
|
||||
origin: 'Switzerland',
|
||||
slogan: 'Simplicity for Complex Wealth'
|
||||
},
|
||||
{
|
||||
@ -40,7 +40,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'anlage.app',
|
||||
languages: ['English'],
|
||||
name: 'Anlage.App',
|
||||
origin: `Austria`,
|
||||
origin: 'Austria',
|
||||
pricingPerYear: '$120',
|
||||
slogan: 'Analyze and track your portfolio.'
|
||||
},
|
||||
@ -58,16 +58,27 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'beanvest',
|
||||
name: 'Beanvest',
|
||||
origin: `France`,
|
||||
origin: 'France',
|
||||
pricingPerYear: '$100',
|
||||
slogan: 'Stock Portfolio Tracker for Smart Investors'
|
||||
},
|
||||
{
|
||||
founded: 2022,
|
||||
hasFreePlan: true,
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'degiro-portfolio-tracker-by-capitalyse',
|
||||
languages: ['English'],
|
||||
name: 'DEGIRO Portfolio Tracker by Capitalyse',
|
||||
origin: 'Netherlands',
|
||||
pricingPerYear: '€24',
|
||||
slogan: 'Democratizing Data Analytics'
|
||||
},
|
||||
{
|
||||
hasFreePlan: true,
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'capitally',
|
||||
name: 'Capitally',
|
||||
origin: `Poland`,
|
||||
origin: 'Poland',
|
||||
pricingPerYear: '€50',
|
||||
slogan: 'Optimize your investments performance'
|
||||
},
|
||||
@ -75,15 +86,15 @@ export const personalFinanceTools: Product[] = [
|
||||
founded: 2022,
|
||||
key: 'capmon',
|
||||
name: 'CapMon.org',
|
||||
origin: `Germany`,
|
||||
note: 'CapMon.org has discontinued in 2023',
|
||||
origin: 'Germany',
|
||||
note: 'CapMon.org was discontinued in 2023',
|
||||
slogan: 'Next Generation Assets Tracking'
|
||||
},
|
||||
{
|
||||
founded: 2019,
|
||||
key: 'compound-planning',
|
||||
name: 'Compound Planning',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Modern Wealth & Investment Management'
|
||||
},
|
||||
{
|
||||
@ -92,7 +103,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'copilot-money',
|
||||
name: 'Copilot Money',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$70',
|
||||
slogan: 'Do money better with Copilot'
|
||||
},
|
||||
@ -110,7 +121,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'delta',
|
||||
name: 'Delta Investment Tracker',
|
||||
note: 'Acquired by eToro',
|
||||
origin: `Belgium`,
|
||||
origin: 'Belgium',
|
||||
slogan: 'The app to track all your investments. Make smart moves only.'
|
||||
},
|
||||
{
|
||||
@ -120,7 +131,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'divvydiary',
|
||||
languages: ['Deutsch', 'English'],
|
||||
name: 'DivvyDiary',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
pricingPerYear: '€65',
|
||||
slogan: 'Your personal Dividend Calendar'
|
||||
},
|
||||
@ -130,7 +141,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'empower',
|
||||
name: 'Empower',
|
||||
note: 'Originally named as Personal Capital',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Get answers to your money questions'
|
||||
},
|
||||
{
|
||||
@ -138,7 +149,7 @@ export const personalFinanceTools: Product[] = [
|
||||
founded: 2022,
|
||||
key: 'eightfigures',
|
||||
name: '8FIGURES',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Portfolio Tracker Designed by Professional Investors'
|
||||
},
|
||||
{
|
||||
@ -147,7 +158,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'exirio',
|
||||
name: 'Exirio',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$100',
|
||||
slogan: 'All your wealth, in one place.'
|
||||
},
|
||||
@ -158,7 +169,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'fina',
|
||||
languages: ['English'],
|
||||
name: 'Fina',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$115',
|
||||
slogan: 'Flexible Financial Management'
|
||||
},
|
||||
@ -167,7 +178,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'finary',
|
||||
languages: ['Deutsch', 'English', 'Français'],
|
||||
name: 'Finary',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Real-Time Portfolio Tracker & Stock Tracker'
|
||||
},
|
||||
{
|
||||
@ -175,7 +186,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasFreePlan: true,
|
||||
key: 'finwise',
|
||||
name: 'FinWise',
|
||||
origin: `South Africa`,
|
||||
origin: 'South Africa',
|
||||
pricingPerYear: '€69.99',
|
||||
slogan: 'Personal finances, simplified'
|
||||
},
|
||||
@ -185,7 +196,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'folishare',
|
||||
languages: ['Deutsch', 'English'],
|
||||
name: 'folishare',
|
||||
origin: `Austria`,
|
||||
origin: 'Austria',
|
||||
pricingPerYear: '$65',
|
||||
slogan: 'Take control over your investments'
|
||||
},
|
||||
@ -196,7 +207,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'getquin',
|
||||
languages: ['Deutsch', 'English'],
|
||||
name: 'getquin',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
pricingPerYear: '€48',
|
||||
slogan: 'Portfolio Tracker, Analysis & Community'
|
||||
},
|
||||
@ -205,7 +216,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'gospatz',
|
||||
name: 'goSPATZ',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
slogan: 'Volle Kontrolle über deine Investitionen'
|
||||
},
|
||||
{
|
||||
@ -214,7 +225,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'holistic-capital',
|
||||
languages: ['Deutsch'],
|
||||
name: 'Holistic',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
slogan: 'Die All-in-One Lösung für dein Vermögen.',
|
||||
useAnonymously: true
|
||||
},
|
||||
@ -223,8 +234,8 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'intuit-mint',
|
||||
name: 'Intuit Mint',
|
||||
note: 'Intuit Mint has discontinued in 2023',
|
||||
origin: `United States`,
|
||||
note: 'Intuit Mint was discontinued in 2023',
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$60',
|
||||
slogan: 'Managing money, made simple'
|
||||
},
|
||||
@ -234,7 +245,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'justetf',
|
||||
name: 'justETF',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
pricingPerYear: '€119',
|
||||
slogan: 'ETF portfolios made simple'
|
||||
},
|
||||
@ -244,7 +255,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'koyfin',
|
||||
name: 'Koyfin',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$468',
|
||||
slogan: 'Comprehensive financial data analysis'
|
||||
},
|
||||
@ -254,7 +265,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'kubera',
|
||||
name: 'Kubera®',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$150',
|
||||
slogan: 'The Time Machine for your Net Worth'
|
||||
},
|
||||
@ -264,7 +275,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'magnifi',
|
||||
name: 'Magnifi',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$132',
|
||||
slogan: 'AI Investing Assistant'
|
||||
},
|
||||
@ -275,9 +286,9 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'markets.sh',
|
||||
languages: ['English'],
|
||||
name: 'markets.sh',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
pricingPerYear: '€168',
|
||||
region: `Global`,
|
||||
regions: ['Global'],
|
||||
slogan: 'Track your investments'
|
||||
},
|
||||
{
|
||||
@ -286,10 +297,10 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'maybe-finance',
|
||||
languages: ['English'],
|
||||
name: 'Maybe Finance',
|
||||
note: 'Maybe Finance has discontinued in 2023',
|
||||
origin: `United States`,
|
||||
note: 'Maybe Finance was discontinued in 2023',
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$145',
|
||||
region: `United States`,
|
||||
regions: ['United States'],
|
||||
slogan: 'Your financial future, in your control'
|
||||
},
|
||||
{
|
||||
@ -298,9 +309,9 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'merlincrypto',
|
||||
languages: ['English'],
|
||||
name: 'Merlin',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$204',
|
||||
region: 'Canada, United States',
|
||||
regions: ['Canada', 'United States'],
|
||||
slogan: 'The smartest way to track your crypto'
|
||||
},
|
||||
{
|
||||
@ -309,7 +320,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'monarch-money',
|
||||
name: 'Monarch Money',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$99.99',
|
||||
slogan: 'The modern way to manage your money'
|
||||
},
|
||||
@ -327,7 +338,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'navexa',
|
||||
name: 'Navexa',
|
||||
origin: `Australia`,
|
||||
origin: 'Australia',
|
||||
pricingPerYear: '$90',
|
||||
slogan: 'The Intelligent Portfolio Tracker'
|
||||
},
|
||||
@ -338,9 +349,9 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'parqet',
|
||||
name: 'Parqet',
|
||||
note: 'Originally named as Tresor One',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
pricingPerYear: '€88',
|
||||
region: 'Austria, Germany, Switzerland',
|
||||
regions: ['Austria', 'Germany', 'Switzerland'],
|
||||
slogan: 'Dein Vermögen immer im Blick'
|
||||
},
|
||||
{
|
||||
@ -348,7 +359,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'plannix',
|
||||
name: 'Plannix',
|
||||
origin: `Italy`,
|
||||
origin: 'Italy',
|
||||
slogan: 'Your Personal Finance Hub'
|
||||
},
|
||||
{
|
||||
@ -358,9 +369,9 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'pocketsmith',
|
||||
languages: ['English'],
|
||||
name: 'PocketSmith',
|
||||
origin: `New Zealand`,
|
||||
origin: 'New Zealand',
|
||||
pricingPerYear: '$120',
|
||||
region: `Global`,
|
||||
regions: ['Global'],
|
||||
slogan: 'Know where your money is going'
|
||||
},
|
||||
{
|
||||
@ -369,7 +380,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'portfolio-dividend-tracker',
|
||||
languages: ['English', 'Nederlands'],
|
||||
name: 'Portfolio Dividend Tracker',
|
||||
origin: `Netherlands`,
|
||||
origin: 'Netherlands',
|
||||
pricingPerYear: '€60',
|
||||
slogan: 'Manage all your portfolios'
|
||||
},
|
||||
@ -386,7 +397,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasFreePlan: true,
|
||||
key: 'portfoloo',
|
||||
name: 'Portfoloo',
|
||||
note: 'Portfoloo has discontinued',
|
||||
note: 'Portfoloo was discontinued',
|
||||
slogan:
|
||||
'Free Stock Portfolio Tracker with unlimited portfolio and stocks for DIY investors'
|
||||
},
|
||||
@ -397,7 +408,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'portseido',
|
||||
languages: ['Deutsch', 'English', 'Français', 'Nederlands'],
|
||||
name: 'Portseido',
|
||||
origin: `Thailand`,
|
||||
origin: 'Thailand',
|
||||
pricingPerYear: '$96',
|
||||
slogan: 'Portfolio Performance and Dividend Tracker'
|
||||
},
|
||||
@ -407,7 +418,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: true,
|
||||
key: 'projectionlab',
|
||||
name: 'ProjectionLab',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$108',
|
||||
slogan: 'Build Financial Plans You Love.'
|
||||
},
|
||||
@ -416,7 +427,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'rocket-money',
|
||||
name: 'Rocket Money',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Track your net worth'
|
||||
},
|
||||
{
|
||||
@ -425,7 +436,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'seeking-alpha',
|
||||
name: 'Seeking Alpha',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$239',
|
||||
slogan: 'Stock Market Analysis & Tools for Investors'
|
||||
},
|
||||
@ -433,7 +444,7 @@ export const personalFinanceTools: Product[] = [
|
||||
founded: 2022,
|
||||
key: 'segmio',
|
||||
name: 'Segmio',
|
||||
origin: `Romania`,
|
||||
origin: 'Romania',
|
||||
slogan: 'Wealth Management and Net Worth Tracking'
|
||||
},
|
||||
{
|
||||
@ -442,16 +453,16 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'sharesight',
|
||||
name: 'Sharesight',
|
||||
origin: `New Zealand`,
|
||||
origin: 'New Zealand',
|
||||
pricingPerYear: '$135',
|
||||
region: `Global`,
|
||||
regions: ['Global'],
|
||||
slogan: 'Stock Portfolio Tracker'
|
||||
},
|
||||
{
|
||||
hasFreePlan: true,
|
||||
key: 'sharesmaster',
|
||||
name: 'SharesMaster',
|
||||
note: 'SharesMaster has discontinued',
|
||||
note: 'SharesMaster was discontinued',
|
||||
slogan: 'Free Stock Portfolio Tracker'
|
||||
},
|
||||
{
|
||||
@ -459,7 +470,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'simple-portfolio',
|
||||
name: 'Simple Portfolio',
|
||||
origin: `Czech Republic`,
|
||||
origin: 'Czech Republic',
|
||||
pricingPerYear: '€80',
|
||||
slogan: 'Stock Portfolio Tracker'
|
||||
},
|
||||
@ -469,7 +480,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'snowball-analytics',
|
||||
name: 'Snowball Analytics',
|
||||
origin: `France`,
|
||||
origin: 'France',
|
||||
pricingPerYear: '$80',
|
||||
slogan: 'Simple and powerful portfolio tracker'
|
||||
},
|
||||
@ -478,21 +489,21 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'stock-events',
|
||||
name: 'Stock Events',
|
||||
origin: `Germany`,
|
||||
origin: 'Germany',
|
||||
slogan: 'Track all your Investments'
|
||||
},
|
||||
{
|
||||
key: 'stockle',
|
||||
name: 'Stockle',
|
||||
origin: `Finland`,
|
||||
origin: 'Finland',
|
||||
slogan: 'Supercharge your investments tracking experience'
|
||||
},
|
||||
{
|
||||
founded: 2008,
|
||||
key: 'stockmarketeye',
|
||||
name: 'StockMarketEye',
|
||||
origin: `France`,
|
||||
note: 'StockMarketEye has discontinued in 2023',
|
||||
origin: 'France',
|
||||
note: 'StockMarketEye was discontinued in 2023',
|
||||
slogan: 'A Powerful Portfolio & Investment Tracking App'
|
||||
},
|
||||
{
|
||||
@ -501,7 +512,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'stonksfolio',
|
||||
languages: ['English'],
|
||||
name: 'Stonksfolio',
|
||||
origin: `Bulgaria`,
|
||||
origin: 'Bulgaria',
|
||||
pricingPerYear: '€49.90',
|
||||
slogan: 'Visualize all of your portfolios'
|
||||
},
|
||||
@ -510,7 +521,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'sumio',
|
||||
name: 'Sumio',
|
||||
origin: `Czech Republic`,
|
||||
origin: 'Czech Republic',
|
||||
pricingPerYear: '$20',
|
||||
slogan: 'Sum up and build your wealth.'
|
||||
},
|
||||
@ -519,7 +530,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasFreePlan: false,
|
||||
key: 'tiller',
|
||||
name: 'Tiller',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$79',
|
||||
slogan:
|
||||
'Your financial life in a spreadsheet, automatically updated each day'
|
||||
@ -530,7 +541,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'utluna',
|
||||
languages: ['Deutsch', 'English', 'Français'],
|
||||
name: 'Utluna',
|
||||
origin: `Switzerland`,
|
||||
origin: 'Switzerland',
|
||||
pricingPerYear: '$300',
|
||||
slogan: 'Your Portfolio. Revealed.',
|
||||
useAnonymously: true
|
||||
@ -540,7 +551,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasFreePlan: true,
|
||||
key: 'vyzer',
|
||||
name: 'Vyzer',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$348',
|
||||
slogan: 'Virtual Family Office for Smart Wealth Management'
|
||||
},
|
||||
@ -549,7 +560,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'wallmine',
|
||||
languages: ['English'],
|
||||
name: 'wallmine',
|
||||
origin: `Czech Republic`,
|
||||
origin: 'Czech Republic',
|
||||
pricingPerYear: '$600',
|
||||
slogan: 'Make Smarter Investments'
|
||||
},
|
||||
@ -567,7 +578,7 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'wealthica',
|
||||
languages: ['English', 'Français'],
|
||||
name: 'Wealthica',
|
||||
origin: `Canada`,
|
||||
origin: 'Canada',
|
||||
pricingPerYear: '$50',
|
||||
slogan: 'See all your investments in one place'
|
||||
},
|
||||
@ -577,13 +588,13 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'wealthy-tracker',
|
||||
languages: ['English'],
|
||||
name: 'Wealthy Tracker',
|
||||
origin: `India`,
|
||||
origin: 'India',
|
||||
slogan: 'One app to manage all your investments'
|
||||
},
|
||||
{
|
||||
key: 'whal',
|
||||
name: 'Whal',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
slogan: 'Manage your investments in one place'
|
||||
},
|
||||
{
|
||||
@ -593,8 +604,9 @@ export const personalFinanceTools: Product[] = [
|
||||
key: 'yeekatee',
|
||||
languages: ['Deutsch', 'English', 'Español', 'Français', 'Italiano'],
|
||||
name: 'yeekatee',
|
||||
origin: `Switzerland`,
|
||||
region: `Global`,
|
||||
note: 'yeekatee was discontinued in 2024',
|
||||
origin: 'Switzerland',
|
||||
regions: ['Global'],
|
||||
slogan: 'Connect. Share. Invest.'
|
||||
},
|
||||
{
|
||||
@ -603,7 +615,7 @@ export const personalFinanceTools: Product[] = [
|
||||
hasSelfHostingAbility: false,
|
||||
key: 'ynab',
|
||||
name: 'YNAB (You Need a Budget)',
|
||||
origin: `United States`,
|
||||
origin: 'United States',
|
||||
pricingPerYear: '$99',
|
||||
slogan: 'Change Your Relationship With Money'
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
export type HoldingViewMode = 'CHART' | 'TABLE';
|
1
libs/common/src/lib/types/holdings-view-mode.type.ts
Normal file
1
libs/common/src/lib/types/holdings-view-mode.type.ts
Normal file
@ -0,0 +1 @@
|
||||
export type HoldingsViewMode = 'CHART' | 'TABLE';
|
@ -8,7 +8,7 @@ import type { DateRange } from './date-range.type';
|
||||
import type { Granularity } from './granularity.type';
|
||||
import type { GroupBy } from './group-by.type';
|
||||
import type { HoldingType } from './holding-type.type';
|
||||
import type { HoldingViewMode } from './holding-view-mode.type';
|
||||
import type { HoldingsViewMode } from './holdings-view-mode.type';
|
||||
import type { MarketAdvanced } from './market-advanced.type';
|
||||
import type { MarketDataPreset } from './market-data-preset.type';
|
||||
import type { MarketState } from './market-state.type';
|
||||
@ -31,7 +31,7 @@ export type {
|
||||
Granularity,
|
||||
GroupBy,
|
||||
HoldingType,
|
||||
HoldingViewMode,
|
||||
HoldingsViewMode,
|
||||
Market,
|
||||
MarketAdvanced,
|
||||
MarketDataPreset,
|
||||
|
@ -3,7 +3,7 @@ import { GfAssetProfileIconComponent } from '@ghostfolio/client/components/asset
|
||||
import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module';
|
||||
import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config';
|
||||
import { getDateFormatString, getLocale } from '@ghostfolio/common/helper';
|
||||
import { UniqueAsset } from '@ghostfolio/common/interfaces';
|
||||
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
|
||||
import { OrderWithAccount } from '@ghostfolio/common/types';
|
||||
import { GfActivityTypeComponent } from '@ghostfolio/ui/activity-type';
|
||||
import { GfNoTransactionsInfoComponent } from '@ghostfolio/ui/no-transactions-info';
|
||||
@ -99,7 +99,7 @@ export class GfActivitiesTableComponent
|
||||
@Output() export = new EventEmitter<void>();
|
||||
@Output() exportDrafts = new EventEmitter<string[]>();
|
||||
@Output() import = new EventEmitter<void>();
|
||||
@Output() importDividends = new EventEmitter<UniqueAsset>();
|
||||
@Output() importDividends = new EventEmitter<AssetProfileIdentifier>();
|
||||
@Output() pageChanged = new EventEmitter<PageEvent>();
|
||||
@Output() selectedActivities = new EventEmitter<Activity[]>();
|
||||
@Output() sortChanged = new EventEmitter<Sort>();
|
||||
@ -263,7 +263,7 @@ export class GfActivitiesTableComponent
|
||||
alert(aComment);
|
||||
}
|
||||
|
||||
public onOpenPositionDialog({ dataSource, symbol }: UniqueAsset) {
|
||||
public onOpenPositionDialog({ dataSource, symbol }: AssetProfileIdentifier) {
|
||||
this.router.navigate([], {
|
||||
queryParams: { dataSource, symbol, holdingDetailDialog: true }
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user