financial_math 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/financial_math/basics.rb +0 -19
- data/lib/financial_math/compound_interest.rb +10 -0
- data/lib/financial_math/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20641fba71319f1c2aae1437a3de7f688d318d3e7a955476ed7bd4bb06c2b36f
|
|
4
|
+
data.tar.gz: 58df98336b4d773e3338082a3385082f1bea36cb3ddcdac2e0307bd5da14cf14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 263a95425d62390f85ca156ae2c1e1531d4f2eecfc1e7478fa26393f69d23bfca6faa4b8c6ab3739633fc032be11aad14d1bf74d445355e61b5ae1cfad50fa7d
|
|
7
|
+
data.tar.gz: af5ef11638690f2de51c89de3e3c29192ca7afe882743525445f6e49e653277b1cfe4fa6953bf3e6918c2eff16ed8fa2ac679a22bd97bc1bf9083cefa9a0fbbd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -69,7 +69,8 @@ $ gem install financial_math --dev
|
|
|
69
69
|
This command will get the development dependencies installed too.
|
|
70
70
|
|
|
71
71
|
## Release History
|
|
72
|
-
|
|
72
|
+
* 0.5.0
|
|
73
|
+
* ADD: Add `average_growth_rate` and `continous_future_value` public methods to `CompoundInterest` class
|
|
73
74
|
* 0.4.1
|
|
74
75
|
* CHANGE: Update docs (module code remains unchanged)
|
|
75
76
|
* 0.4.0
|
|
@@ -15,22 +15,3 @@ module FinancialMath
|
|
|
15
15
|
growth_rates.map { |i| i + 1 }.inject(:*)**(1.0 / growth_rates.size) - 1
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
|
-
|
|
19
|
-
# module FinancialMath
|
|
20
|
-
# # A class that contains basic functions in finance
|
|
21
|
-
# class Basics
|
|
22
|
-
# def self.geometric_mean(growth_rates)
|
|
23
|
-
# raw_geometric_mean(growth_rates).round(4)
|
|
24
|
-
# end
|
|
25
|
-
#
|
|
26
|
-
# def self.continuous_capitalization(initial_value, rate, time)
|
|
27
|
-
# (initial_value * Math.exp(rate * time)).round(2)
|
|
28
|
-
# end
|
|
29
|
-
#
|
|
30
|
-
# def self.raw_geometric_mean(growth_rates)
|
|
31
|
-
# growth_rates.map { |i| i + 1 }.inject(:*)**(1.0 / growth_rates.size) - 1
|
|
32
|
-
# end
|
|
33
|
-
#
|
|
34
|
-
# private_class_method :raw_geometric_mean
|
|
35
|
-
# end
|
|
36
|
-
# end
|
|
@@ -8,6 +8,16 @@ module FinancialMath
|
|
|
8
8
|
@interest_rate = args.fetch(:interest_rate, 0.0)
|
|
9
9
|
@nominal_rate = args.fetch(:nominal_rate, 0.0)
|
|
10
10
|
@effective_rate = args.fetch(:effective_rate, 0.0)
|
|
11
|
+
@future_value = args.fetch(:future_value, 0.0)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def average_growth_rate
|
|
15
|
+
((@future_value / @present_value)**(1.0 / @periods) - 1).round(4)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def continous_future_value
|
|
19
|
+
@future_value = @present_value * Math.exp(@interest_rate * @periods)
|
|
20
|
+
@future_value.round(2)
|
|
11
21
|
end
|
|
12
22
|
|
|
13
23
|
def effective_rate
|