Browse Source
Feature/add safe withdrawal rate to user settings (#5629)
* Add safe withdrawal rate to user settings
* Update changelog
pull/5630/head
Thomas Kaul
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with
34 additions and
3 deletions
-
CHANGELOG.md
-
apps/api/src/app/user/update-user-setting.dto.ts
-
apps/api/src/app/user/user.service.ts
-
apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
-
apps/client/src/app/pages/portfolio/fire/fire-page.html
-
libs/common/src/lib/interfaces/user-settings.interface.ts
|
|
@ -5,6 +5,16 @@ 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). |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
- Added the safe withdrawal rate to the user settings (experimental) |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Improved the wording of the 4% rule in the _FIRE_ section |
|
|
|
|
|
|
|
## 2.203.0 - 2025-09-27 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -104,6 +104,10 @@ export class UpdateUserSettingDto { |
|
|
|
@IsOptional() |
|
|
|
retirementDate?: string; |
|
|
|
|
|
|
|
@IsNumber() |
|
|
|
@IsOptional() |
|
|
|
safeWithdrawalRate?: number; |
|
|
|
|
|
|
|
@IsNumber() |
|
|
|
@IsOptional() |
|
|
|
savingsRate?: number; |
|
|
|
|
|
@ -265,6 +265,11 @@ export class UserService { |
|
|
|
PerformanceCalculationType.ROAI; |
|
|
|
} |
|
|
|
|
|
|
|
// Set default value for safe withdrawal rate
|
|
|
|
if (!(user.settings.settings as UserSettings)?.safeWithdrawalRate) { |
|
|
|
(user.settings.settings as UserSettings).safeWithdrawalRate = 0.04; |
|
|
|
} |
|
|
|
|
|
|
|
// Set default value for view mode
|
|
|
|
if (!(user.settings.settings as UserSettings).viewMode) { |
|
|
|
(user.settings.settings as UserSettings).viewMode = 'DEFAULT'; |
|
|
|
|
|
@ -63,7 +63,10 @@ export class GfFirePageComponent implements OnDestroy, OnInit { |
|
|
|
this.fireWealth = new Big(10000); |
|
|
|
} |
|
|
|
|
|
|
|
this.withdrawalRatePerYear = this.fireWealth.mul(4).div(100); |
|
|
|
this.withdrawalRatePerYear = this.fireWealth.mul( |
|
|
|
this.user.settings.safeWithdrawalRate |
|
|
|
); |
|
|
|
|
|
|
|
this.withdrawalRatePerMonth = this.withdrawalRatePerYear.div(12); |
|
|
|
|
|
|
|
this.isLoading = false; |
|
|
|
|
|
@ -37,7 +37,7 @@ |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<h4 class="align-items-center d-flex"> |
|
|
|
<span i18n>4% Rule</span> |
|
|
|
<span i18n>Sustainable retirement income</span> |
|
|
|
@if (user?.subscription?.type === 'Basic') { |
|
|
|
<gf-premium-indicator class="ml-1" /> |
|
|
|
} |
|
|
@ -96,7 +96,15 @@ |
|
|
|
[value]="fireWealth?.toNumber()" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
and a withdrawal rate of 4%. |
|
|
|
and a safe withdrawal rate (SWR) of |
|
|
|
<span class="font-weight-bold" |
|
|
|
><gf-value |
|
|
|
class="d-inline-block" |
|
|
|
[isPercent]="true" |
|
|
|
[locale]="user?.settings?.locale" |
|
|
|
[precision]="1" |
|
|
|
[value]="user?.settings?.safeWithdrawalRate" /></span |
|
|
|
>. |
|
|
|
</div> |
|
|
|
} |
|
|
|
</div> |
|
|
|
|
|
@ -29,6 +29,7 @@ export interface UserSettings { |
|
|
|
performanceCalculationType?: PerformanceCalculationType; |
|
|
|
projectedTotalAmount?: number; |
|
|
|
retirementDate?: string; |
|
|
|
safeWithdrawalRate?: number; |
|
|
|
savingsRate?: number; |
|
|
|
viewMode?: ViewMode; |
|
|
|
xRayRules?: XRayRulesSettings; |
|
|
|