xirr_newton_calculator 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xirr_newton_calculator.rb +1 -1
- metadata +1 -1
@@ -37,7 +37,7 @@ class XirrNewtonCalculator
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def dfdx(x)
|
40
|
-
@flows.inject(0) do |result, flow|
|
40
|
+
@flows[1..-1].inject(0) do |result, flow|
|
41
41
|
diff_date = (Date.parse(flow.date.to_s) - Date.parse(@flows[0].date.to_s))/365
|
42
42
|
result += flow.amount* diff_date * x.to_f ** (diff_date -1)
|
43
43
|
end
|