lib/roi/rentability.rb in roi_calculator-2.0.0 vs lib/roi/rentability.rb in roi_calculator-2.1.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require 'memoist'
-require 'roi/financial_result'
+require 'roi/gross_profit'
require 'roi/rentability_periods'
require 'math_util'
require 'active_support'
require 'active_support/core_ext'
@@ -32,12 +32,12 @@
@end_date = dates[-1]
end
self
end
- def financial
- FinancialResult.new(rentabilities, start_date, end_date)
+ def gross_profit
+ GrossProfit.new(rentabilities, start_date, end_date)
end
def dates_with_position
rentabilities.select { |_, rentability| rentability.have_position }.keys
end
@@ -45,10 +45,10 @@
def rentabilities_array(start_date = nil, end_date = nil)
start_date ||= @start_date
end_date ||= @end_date
filtered = @rentabilities.values.select do |val|
- val.date.between?(start_date, end_date)
+ val.reference_date.between?(start_date, end_date)
end
filtered.map(&:rentability).compact
end
def volatility(months_ago = nil)