Skip to content

Instantly share code, notes, and snippets.

@philiplambok
Last active September 7, 2022 02:16
Show Gist options
  • Save philiplambok/be43cfa303884d120d455d84bcc621ca to your computer and use it in GitHub Desktop.
Save philiplambok/be43cfa303884d120d455d84bcc621ca to your computer and use it in GitHub Desktop.
compound-interest Neo Bank VS SSF
# only runnable inside Rails web application
include ActionView::Helpers::NumberHelper
def to_idr(amount)
number_to_currency(amount, unit: 'Rp.', precision: 3)
end
def noebank
net_worth = 0
emergency_fund = 30_000_000
monthly_deposit = 12_000_000
net_worth += emergency_fund
deposit_date = 28
interest_rate = 0.06
tax_percentage = 0.2
start_date = Date.new(2020, 1, 1)
end_date = Date.new(2020, 12, 31)
(start_date).upto(end_date).each do |date|
net_worth += monthly_deposit if date.day == deposit_date
daily_fee = net_worth * interest_rate * 1.0 / 365
tax = daily_fee * tax_percentage
income = daily_fee - tax
net_worth += income
end
puts '===Neo Bank==='
puts "Monthly Deposit\t: #{to_idr(monthly_deposit)}"
puts "Fee p.a\t\t: 6%"
puts "Tax\t\t: 20% per disburse"
puts "Emergency Fund\t: #{to_idr(emergency_fund)}"
puts "Total net worth\t: #{to_idr(net_worth)}"
end
def ssf_in_one_year
monthly_deposit = 12_000_000
emergency_fund = 30_000_000
investment_worth = 148_498_364 # taken from bibit: https://app.bibit.id/reksadana/RD3561
puts '===Sukorinvest Stable Fund (SSF)==='
puts "Monthly Deposit\t: #{to_idr(monthly_deposit)}"
puts "Fee p.a\t\t: 6,89%"
puts "Tax\t\t: None"
puts "Emergency Fund\t: #{to_idr(emergency_fund)}"
puts "Total net worth\t: #{to_idr(emergency_fund + investment_worth)}"
end
noebank
puts "\n"
ssf_in_one_year
# Example Result:
#
# ===Neo Bank===
# Monthly Deposit : Rp.12,000,000.000
# Fee p.a : 6%
# Tax : 20% per fee disburse
# Emergency Fund : Rp.30,000,000.000
# Total net worth : Rp.178,780,869.597
# ===Sukorinvest Stable Fund (SSF)===
# Monthly Deposit : Rp.12,000,000.000
# Fee p.a : 6,89%
# Tax : None
# Emergency Fund : Rp.30,000,000.000
# Total net worth : Rp.178,498,364.000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment