|
<# |
|
.SYNOPSIS |
|
Quickly calculate your compounding profits for LVT. |
|
.DESCRIPTION |
|
This function will show you an esitmate profit amount based on the values you provide. |
|
This function currently does not get a live reading of the current LVT price, you will need to manually provide the current price yourself. |
|
.PARAMETER LVT |
|
Provide the amount of LVT in your portfolio that is generating interest. |
|
.PARAMETER Days |
|
Provide the number of days you are investing in LVT. |
|
|
|
This will caluclate the amount of LVT you will have after the number of days you have provided. |
|
.PARAMETER CurrentPrice |
|
Provide the current price of LVT, or at least the price you want to see data for. |
|
.PARAMETER IncludeChart |
|
If you want to see a chart of the results, provide this parameter. This will display each day's profit in a chart. |
|
.PARAMETER Rate |
|
Provide the interest rate you would like to see data for. |
|
|
|
This defaults to LVT's current default rate of 7% daily. |
|
.EXAMPLE |
|
Get-LVTCompoundInterest -LVT 10000 -Days 30 -CurrentPrice .025 -IncludeChart |
|
|
|
Description |
|
----------- |
|
This will show you an estimate of how much LVT you will have in your portfolio after 30 days. |
|
Since -IncludeChart is provided, this will also show you a chart of the results. |
|
.EXAMPLE |
|
Get-LVTCompoundInterest -LVT 10000 -Days 30 -CurrentPrice .025 -Rate .1 |
|
|
|
Description |
|
----------- |
|
This will show you an estimate of how much LVT you will have in your portfolio after 30 days. |
|
Since -IncludeChart is not provided, this will not show you a chart of the results. but will only show you stats for the final day. |
|
.NOTES |
|
Author: Matthew DeGarmo |
|
GitHub: https://github.com/matthewjdegarmo |
|
Sponsor: https://github.com/sponsors/matthewjdegarmo |
|
#> |
|
|
|
Function Get-LVTCompoundInterest() { |
|
[CmdletBinding()] |
|
Param( |
|
[Parameter( |
|
Mandatory, |
|
ValueFromPipelineByPropertyName |
|
)] |
|
$LVT, |
|
|
|
[Parameter()] |
|
$Days = 1, |
|
|
|
[Switch]$IncludeChart, |
|
|
|
[Parameter( |
|
Mandatory, |
|
ValueFromPipelineByPropertyName |
|
)] |
|
$CurrentPrice, |
|
|
|
$CurrentBonusPercent, |
|
|
|
[ValidateRange(0, 6)] |
|
$CompoundsPerDay = 6 |
|
) |
|
|
|
Begin { |
|
#Region Get-APICurrentPrice |
|
Function Get-APICurrentPrice() { |
|
[CmdletBinding()] |
|
Param() |
|
|
|
#Placeholder function for realtime api price call |
|
} |
|
#EndRegion Get-APICurrentPrice |
|
|
|
#Region Get-BonusPercentIncrease |
|
Function Get-BonusPercentIncrease() { |
|
[CmdletBinding()] |
|
Param( |
|
$Rate |
|
) |
|
|
|
[decimal]$CurrentBonus = [math]::Round(($Rate - 0.07), 6) |
|
|
|
Switch ($CurrentBonus) { |
|
# its the % bonus of 7 + 7 e.g. 40% of 7 is 2.8 + 7% = 9.8% on omega tier. |
|
#1-5% increases by 1% |
|
{ $_ -ge 0 -AND $_ -le 0.0035 } { [decimal]$BonusIncrease = .001 } |
|
|
|
#5-10% increases by 0.5% |
|
{ $_ -gt 0.0035 -AND $_ -le 0.007 } { [decimal]$BonusIncrease = .0005 } |
|
|
|
#10-20% increases by 0.1% |
|
{ $_ -gt 0.007 -AND $_ -le 0.014 } { [decimal]$BonusIncrease = .0001 } |
|
|
|
#20-30% increases by 0.05% |
|
{ $_ -gt 0.014 -AND $_ -le 0.021 } { [decimal]$BonusIncrease = .00005 } |
|
|
|
#30-40% increases by 0.01% |
|
{ $_ -gt 0.021 -AND $_ -lt 0.028 } { [decimal]$BonusIncrease = .00001 } |
|
|
|
#If someone reaches limit, OR some value is weird, 0% will be added. |
|
DEFAULT { [decimal]$BonusIncrease = 0 } |
|
|
|
} |
|
Write-Verbose "Bonus Increase: $BonusIncrease | Current Bonus: $CurrentBonus | Rate: $Rate | New Rate: $([decimal]$Rate + [decimal]$BonusIncrease)" |
|
[decimal]$Rate + [decimal]$BonusIncrease |
|
} |
|
#EndRegion Get-BonusPercentIncrease |
|
|
|
#Region Variable Setup |
|
$BaseRate = 0.07 |
|
$Rate = 0.07 |
|
If ($CurrentBonusPercent) { |
|
If ($CurrentBonusPercent -ge 1) { |
|
Write-Host "$CurrentBonusPercent greater than 1" |
|
$Rate = $Rate + ($CurrentBonusPercent / 1000) |
|
Write-Host "New Rate: $Rate" |
|
} Else { |
|
$Rate = $Rate + $CurrentBonusPercent |
|
} |
|
} |
|
#EndRegion Variable Setup |
|
} |
|
|
|
Process { |
|
If ($IncludeChart.IsPresent) { |
|
# Loop through days |
|
For ($i = 1; $i -le $Days; $i++) { |
|
For ($r = 1; $r -le $CompoundsPerDay; $r++) { |
|
$Rate = (Get-BonusPercentIncrease -Rate $Rate) |
|
$CompoundStart++ |
|
} |
|
$Increase = ($LVT * $Rate) |
|
$IncreaseUSD = "{0:c}" -f ($Increase * $CurrentPrice) |
|
If ($CompoundsPerDay -ne 0) { |
|
$LVT = $Increase + $LVT |
|
} |
|
$USD = "{0:c}" -f ($LVT * $CurrentPrice) |
|
$Day = $i |
|
$30DayProfit = "{0:c}" -f (($LVT * $BaseRate * $CurrentPrice) * 30) |
|
$FormattedRate = [math]::Round(($Rate * 100), 4) |
|
$FormattedIncrease = [math]::Round($Increase, 0) |
|
[PSCustomObject]@{ |
|
LVT = [math]::round($LVT, 0) |
|
CurrentPrice = [math]::round($CurrentPrice, 5) |
|
TotalUSD = $USD |
|
DailyUSD = "{0:c}" -f $IncreaseUSD |
|
DailyLVT = $FormattedIncrease |
|
'30DayProfit' = $30DayProfit |
|
Day = $Day |
|
Rate = "$FormattedRate`%" |
|
} |
|
} |
|
} |
|
Else { |
|
For ($i = 1; $i -le $Days; $i++) { |
|
For ($r = 1; $r -le $CompoundsPerDay; $r++) { |
|
$Rate = (Get-BonusPercentIncrease -Rate $Rate) |
|
$CompoundStart++ |
|
} |
|
$Increase = ($LVT * $Rate) |
|
$IncreaseUSD = "{0:c}" -f ($Increase * $CurrentPrice) |
|
If ($CompoundsPerDay -ne 0) { |
|
$LVT = $Increase + $LVT |
|
} |
|
} |
|
$USD = "{0:c}" -f ($LVT * $CurrentPrice) |
|
$Day = $i |
|
$30DayProfit = "{0:c}" -f (($LVT * $BaseRate * $CurrentPrice) * 30) |
|
$FormattedRate = [math]::Round(($Rate * 100), 4) |
|
$FormattedIncrease = [math]::Round($Increase, 0) |
|
[PSCustomObject]@{ |
|
LVT = [math]::round($LVT, 0) |
|
CurrentPrice = [math]::round($CurrentPrice, 5) |
|
TotalUSD = $USD |
|
DailyUSD = "{0:c}" -f $IncreaseUSD |
|
DailyLVT = $FormattedIncrease |
|
'30DayProfit' = $30DayProfit |
|
Day = $Day |
|
Rate = "$FormattedRate`%" |
|
} |
|
} |
|
} |
|
|
|
End {} |
|
} |