Merge branch 'main' of gitea.suda.codes:giteauser/ghostfolio-mirror
This commit is contained in:
commit
3984d4363b
@ -1,6 +1,6 @@
|
|||||||
# Run linting and stop the commit process if any errors are found
|
# Run linting and stop the commit process if any errors are found
|
||||||
# --quiet suppresses warnings (temporary until all warnings are fixed)
|
# --quiet suppresses warnings (temporary until all warnings are fixed)
|
||||||
npm run lint --quiet || exit 1
|
npm run affected:lint --base=main --head=HEAD --parallel=2 --quiet || exit 1
|
||||||
|
|
||||||
# Check formatting on modified and uncommitted files, stop the commit if issues are found
|
# Check formatting on modified and uncommitted files, stop the commit if issues are found
|
||||||
npm run format:check --uncommitted || exit 1
|
npm run format:check --uncommitted || exit 1
|
||||||
|
@ -5,10 +5,11 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## 2.118.0 - 2024-10-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Added a new static portfolio analysis rule: Allocation Cluster Risk (Developed Markets)
|
||||||
- Added a new static portfolio analysis rule: Allocation Cluster Risk (Emerging Markets)
|
- Added a new static portfolio analysis rule: Allocation Cluster Risk (Emerging Markets)
|
||||||
- Added support for mutual funds in the _EOD Historical Data_ service
|
- Added support for mutual funds in the _EOD Historical Data_ service
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Improved the font colors of the chart of the holdings tab on the home page (experimental)
|
- Improved the font colors of the chart of the holdings tab on the home page (experimental)
|
||||||
- Optimized the dialog sizes for mobile (full screen)
|
- Optimized the dialog sizes for mobile (full screen)
|
||||||
|
- Optimized the git-hook via `husky` to lint only affected projects before a commit
|
||||||
- Upgraded `angular` from version `18.1.1` to `18.2.8`
|
- Upgraded `angular` from version `18.1.1` to `18.2.8`
|
||||||
- Upgraded `Nx` from version `19.5.6` to `20.0.3`
|
- Upgraded `Nx` from version `19.5.6` to `20.0.3`
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import { UserService } from '@ghostfolio/api/app/user/user.service';
|
|||||||
import { getFactor } from '@ghostfolio/api/helper/portfolio.helper';
|
import { getFactor } from '@ghostfolio/api/helper/portfolio.helper';
|
||||||
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';
|
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';
|
||||||
import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';
|
import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';
|
||||||
|
import { AllocationClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/developed-markets';
|
||||||
import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';
|
import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';
|
||||||
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';
|
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';
|
||||||
import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';
|
import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';
|
||||||
@ -1190,6 +1191,11 @@ export class PortfolioService {
|
|||||||
summary.ordersCount > 0
|
summary.ordersCount > 0
|
||||||
? await this.rulesService.evaluate(
|
? await this.rulesService.evaluate(
|
||||||
[
|
[
|
||||||
|
new AllocationClusterRiskDevelopedMarkets(
|
||||||
|
this.exchangeRateDataService,
|
||||||
|
summary.currentValueInBaseCurrency,
|
||||||
|
markets.developedMarkets.valueInBaseCurrency
|
||||||
|
),
|
||||||
new AllocationClusterRiskEmergingMarkets(
|
new AllocationClusterRiskEmergingMarkets(
|
||||||
this.exchangeRateDataService,
|
this.exchangeRateDataService,
|
||||||
summary.currentValueInBaseCurrency,
|
summary.currentValueInBaseCurrency,
|
||||||
|
@ -4,6 +4,7 @@ import { environment } from '@ghostfolio/api/environments/environment';
|
|||||||
import { PortfolioChangedEvent } from '@ghostfolio/api/events/portfolio-changed.event';
|
import { PortfolioChangedEvent } from '@ghostfolio/api/events/portfolio-changed.event';
|
||||||
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';
|
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';
|
||||||
import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';
|
import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';
|
||||||
|
import { AllocationClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/developed-markets';
|
||||||
import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';
|
import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';
|
||||||
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';
|
import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';
|
||||||
import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';
|
import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';
|
||||||
@ -216,6 +217,12 @@ export class UserService {
|
|||||||
undefined,
|
undefined,
|
||||||
{}
|
{}
|
||||||
).getSettings(user.Settings.settings),
|
).getSettings(user.Settings.settings),
|
||||||
|
AllocationClusterRiskDevelopedMarkets:
|
||||||
|
new AllocationClusterRiskDevelopedMarkets(
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined
|
||||||
|
).getSettings(user.Settings.settings),
|
||||||
AllocationClusterRiskEmergingMarkets:
|
AllocationClusterRiskEmergingMarkets:
|
||||||
new AllocationClusterRiskEmergingMarkets(
|
new AllocationClusterRiskEmergingMarkets(
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
|
||||||
|
import { Rule } from '@ghostfolio/api/models/rule';
|
||||||
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
|
||||||
|
import { UserSettings } from '@ghostfolio/common/interfaces';
|
||||||
|
|
||||||
|
export class AllocationClusterRiskDevelopedMarkets extends Rule<Settings> {
|
||||||
|
private currentValueInBaseCurrency: number;
|
||||||
|
private developedMarketsValueInBaseCurrency: number;
|
||||||
|
|
||||||
|
public constructor(
|
||||||
|
protected exchangeRateDataService: ExchangeRateDataService,
|
||||||
|
currentValueInBaseCurrency: number,
|
||||||
|
developedMarketsValueInBaseCurrency: number
|
||||||
|
) {
|
||||||
|
super(exchangeRateDataService, {
|
||||||
|
key: AllocationClusterRiskDevelopedMarkets.name,
|
||||||
|
name: 'Developed Markets'
|
||||||
|
});
|
||||||
|
|
||||||
|
this.currentValueInBaseCurrency = currentValueInBaseCurrency;
|
||||||
|
this.developedMarketsValueInBaseCurrency =
|
||||||
|
developedMarketsValueInBaseCurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public evaluate(ruleSettings: Settings) {
|
||||||
|
const developedMarketsValueRatio = this.currentValueInBaseCurrency
|
||||||
|
? this.developedMarketsValueInBaseCurrency /
|
||||||
|
this.currentValueInBaseCurrency
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
if (developedMarketsValueRatio > ruleSettings.thresholdMax) {
|
||||||
|
return {
|
||||||
|
evaluation: `The developed markets contribution of your current investment (${(developedMarketsValueRatio * 100).toPrecision(3)}%) exceeds ${(
|
||||||
|
ruleSettings.thresholdMax * 100
|
||||||
|
).toPrecision(3)}%`,
|
||||||
|
value: false
|
||||||
|
};
|
||||||
|
} else if (developedMarketsValueRatio < ruleSettings.thresholdMin) {
|
||||||
|
return {
|
||||||
|
evaluation: `The developed markets contribution of your current investment (${(developedMarketsValueRatio * 100).toPrecision(3)}%) is below ${(
|
||||||
|
ruleSettings.thresholdMin * 100
|
||||||
|
).toPrecision(3)}%`,
|
||||||
|
value: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
evaluation: `The developed markets contribution of your current investment (${(developedMarketsValueRatio * 100).toPrecision(3)}%) is within the range of ${(
|
||||||
|
ruleSettings.thresholdMin * 100
|
||||||
|
).toPrecision(
|
||||||
|
3
|
||||||
|
)}% and ${(ruleSettings.thresholdMax * 100).toPrecision(3)}%`,
|
||||||
|
value: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getConfiguration() {
|
||||||
|
return {
|
||||||
|
threshold: {
|
||||||
|
max: 1,
|
||||||
|
min: 0,
|
||||||
|
step: 0.01,
|
||||||
|
unit: '%'
|
||||||
|
},
|
||||||
|
thresholdMax: true,
|
||||||
|
thresholdMin: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSettings({ baseCurrency, xRayRules }: UserSettings): Settings {
|
||||||
|
return {
|
||||||
|
baseCurrency,
|
||||||
|
isActive: xRayRules?.[this.getKey()]?.isActive ?? true,
|
||||||
|
thresholdMax: xRayRules?.[this.getKey()]?.thresholdMax ?? 0.72,
|
||||||
|
thresholdMin: xRayRules?.[this.getKey()]?.thresholdMin ?? 0.68
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Settings extends RuleSettings {
|
||||||
|
baseCurrency: string;
|
||||||
|
thresholdMin: number;
|
||||||
|
thresholdMax: number;
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
export type XRayRulesSettings = {
|
export type XRayRulesSettings = {
|
||||||
AccountClusterRiskCurrentInvestment?: RuleSettings;
|
AccountClusterRiskCurrentInvestment?: RuleSettings;
|
||||||
AccountClusterRiskSingleAccount?: RuleSettings;
|
AccountClusterRiskSingleAccount?: RuleSettings;
|
||||||
|
AllocationClusterRiskDevelopedMarkets?: RuleSettings;
|
||||||
AllocationClusterRiskEmergingMarkets?: RuleSettings;
|
AllocationClusterRiskEmergingMarkets?: RuleSettings;
|
||||||
CurrencyClusterRiskBaseCurrencyCurrentInvestment?: RuleSettings;
|
CurrencyClusterRiskBaseCurrencyCurrentInvestment?: RuleSettings;
|
||||||
CurrencyClusterRiskCurrentInvestment?: RuleSettings;
|
CurrencyClusterRiskCurrentInvestment?: RuleSettings;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ghostfolio",
|
"name": "ghostfolio",
|
||||||
"version": "2.117.0",
|
"version": "2.118.0",
|
||||||
"homepage": "https://ghostfol.io",
|
"homepage": "https://ghostfol.io",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"repository": "https://github.com/ghostfolio/ghostfolio",
|
"repository": "https://github.com/ghostfolio/ghostfolio",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user