Skip to content

Instantly share code, notes, and snippets.

@rick7661
rick7661 / InvestmentReturn.swift
Created June 13, 2021 11:49
Calculates total investment return by fixed investment per term, fixed interest per term and number of terms. It is used only to project expected return for a fixed amount, fixed term investment with fixed interest.
import Foundation
// MARK: - Usage: Paste the source code in Xcode Playground and run the examples
// MARK: - Parameters
let fortnightlyInvest: Decimal = 800
let monthlyInvest: Decimal = fortnightlyInvest / 14 * 365 / 12
let yearlyInvest: Decimal = fortnightlyInvest / 14 * 365
let interest: Decimal = 0.08