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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fa4602831d3bf20fee3b85417d5b72a755de53a2c8216189d53858679cff872
4
- data.tar.gz: 40949a7b823d6254e3412e3d329dc525f465bfaa1260ad805cf80fa123801c94
3
+ metadata.gz: 20641fba71319f1c2aae1437a3de7f688d318d3e7a955476ed7bd4bb06c2b36f
4
+ data.tar.gz: 58df98336b4d773e3338082a3385082f1bea36cb3ddcdac2e0307bd5da14cf14
5
5
  SHA512:
6
- metadata.gz: e9372da941991e343e13f4b698d69e0905fb20fb7420d137114c9ec3ffc1a8abd8a3713abfdb4d3e69f9add02897aad4659525809aac16bf933afa3ac118109d
7
- data.tar.gz: 654f067d488d83e1fbcddaee46e1cdebe07e891e6ece8335007f9a74c68a4da0ccc9e58323ae19573f51431e5f76b794d7758a697c843cd130bc253b668f3818
6
+ metadata.gz: 263a95425d62390f85ca156ae2c1e1531d4f2eecfc1e7478fa26393f69d23bfca6faa4b8c6ab3739633fc032be11aad14d1bf74d445355e61b5ae1cfad50fa7d
7
+ data.tar.gz: af5ef11638690f2de51c89de3e3c29192ca7afe882743525445f6e49e653277b1cfe4fa6953bf3e6918c2eff16ed8fa2ac679a22bd97bc1bf9083cefa9a0fbbd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- financial_math (0.4.1)
4
+ financial_math (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
@@ -1,3 +1,3 @@
1
1
  module FinancialMath
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: financial_math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Omar Vergara Pérez