class ProtonApi::GoalDecumulationRecommendationRequest

Attributes

a_horizon[RW]
adjust_for_compounding[RW]
client_id[RW]
compounding_rate[RW]
conf_tgt[RW]
create_log[RW]
curr_inv[RW]
d_horizon[RW]
deposit_config[RW]
goal_id[RW]
horizon_frequency[RW]
n[RW]
p_ret[RW]
p_risk[RW]
recommend_type[RW]
recommendation_config[RW]
remove_outliers[RW]
thresh[RW]
thresh_type[RW]
trading_days_per_year[RW]
withdrawal_config[RW]
withdrawal_tax[RW]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 84
def self.attribute_map
  {
    :'recommendation_config' => :'recommendation_config',
    :'compounding_rate' => :'compounding_rate',
    :'recommend_type' => :'recommend_type',
    :'create_log' => :'create_log',
    :'n' => :'n',
    :'a_horizon' => :'a_horizon',
    :'p_risk' => :'p_risk',
    :'remove_outliers' => :'remove_outliers',
    :'adjust_for_compounding' => :'adjust_for_compounding',
    :'goal_id' => :'goal_id',
    :'conf_tgt' => :'conf_tgt',
    :'trading_days_per_year' => :'trading_days_per_year',
    :'thresh' => :'thresh',
    :'withdrawal_tax' => :'withdrawal_tax',
    :'d_horizon' => :'d_horizon',
    :'client_id' => :'client_id',
    :'thresh_type' => :'thresh_type',
    :'horizon_frequency' => :'horizon_frequency',
    :'withdrawal_config' => :'withdrawal_config',
    :'curr_inv' => :'curr_inv',
    :'deposit_config' => :'deposit_config',
    :'p_ret' => :'p_ret'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 141
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'recommendation_config')
    self.recommendation_config = attributes[:'recommendation_config']
  end

  if attributes.has_key?(:'compounding_rate')
    self.compounding_rate = attributes[:'compounding_rate']
  else
    self.compounding_rate = 0.0
  end

  if attributes.has_key?(:'recommend_type')
    self.recommend_type = attributes[:'recommend_type']
  else
    self.recommend_type = 'horizon'
  end

  if attributes.has_key?(:'create_log')
    self.create_log = attributes[:'create_log']
  else
    self.create_log = false
  end

  if attributes.has_key?(:'n')
    self.n = attributes[:'n']
  else
    self.n = 1000
  end

  if attributes.has_key?(:'a_horizon')
    self.a_horizon = attributes[:'a_horizon']
  end

  if attributes.has_key?(:'p_risk')
    if (value = attributes[:'p_risk']).is_a?(Array)
      self.p_risk = value
    end
  end

  if attributes.has_key?(:'remove_outliers')
    self.remove_outliers = attributes[:'remove_outliers']
  else
    self.remove_outliers = true
  end

  if attributes.has_key?(:'adjust_for_compounding')
    self.adjust_for_compounding = attributes[:'adjust_for_compounding']
  else
    self.adjust_for_compounding = false
  end

  if attributes.has_key?(:'goal_id')
    self.goal_id = attributes[:'goal_id']
  end

  if attributes.has_key?(:'conf_tgt')
    self.conf_tgt = attributes[:'conf_tgt']
  else
    self.conf_tgt = 0.9
  end

  if attributes.has_key?(:'trading_days_per_year')
    self.trading_days_per_year = attributes[:'trading_days_per_year']
  else
    self.trading_days_per_year = 252
  end

  if attributes.has_key?(:'thresh')
    self.thresh = attributes[:'thresh']
  end

  if attributes.has_key?(:'withdrawal_tax')
    self.withdrawal_tax = attributes[:'withdrawal_tax']
  else
    self.withdrawal_tax = 0.0
  end

  if attributes.has_key?(:'d_horizon')
    self.d_horizon = attributes[:'d_horizon']
  end

  if attributes.has_key?(:'client_id')
    self.client_id = attributes[:'client_id']
  end

  if attributes.has_key?(:'thresh_type')
    self.thresh_type = attributes[:'thresh_type']
  else
    self.thresh_type = 'perc'
  end

  if attributes.has_key?(:'horizon_frequency')
    self.horizon_frequency = attributes[:'horizon_frequency']
  else
    self.horizon_frequency = 'year'
  end

  if attributes.has_key?(:'withdrawal_config')
    if (value = attributes[:'withdrawal_config']).is_a?(Array)
      self.withdrawal_config = value
    end
  end

  if attributes.has_key?(:'curr_inv')
    self.curr_inv = attributes[:'curr_inv']
  end

  if attributes.has_key?(:'deposit_config')
    if (value = attributes[:'deposit_config']).is_a?(Array)
      self.deposit_config = value
    end
  end

  if attributes.has_key?(:'p_ret')
    if (value = attributes[:'p_ret']).is_a?(Array)
      self.p_ret = value
    end
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 112
def self.swagger_types
  {
    :'recommendation_config' => :'RecommendationConfig1',
    :'compounding_rate' => :'Float',
    :'recommend_type' => :'String',
    :'create_log' => :'BOOLEAN',
    :'n' => :'Integer',
    :'a_horizon' => :'Integer',
    :'p_risk' => :'Array<Float>',
    :'remove_outliers' => :'BOOLEAN',
    :'adjust_for_compounding' => :'BOOLEAN',
    :'goal_id' => :'String',
    :'conf_tgt' => :'Float',
    :'trading_days_per_year' => :'Integer',
    :'thresh' => :'Float',
    :'withdrawal_tax' => :'Float',
    :'d_horizon' => :'Integer',
    :'client_id' => :'String',
    :'thresh_type' => :'String',
    :'horizon_frequency' => :'String',
    :'withdrawal_config' => :'Array<GoalWithdrawalConfig>',
    :'curr_inv' => :'Float',
    :'deposit_config' => :'Array<DecumulationGoalDepositConfig>',
    :'p_ret' => :'Array<Float>'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 516
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      recommendation_config == o.recommendation_config &&
      compounding_rate == o.compounding_rate &&
      recommend_type == o.recommend_type &&
      create_log == o.create_log &&
      n == o.n &&
      a_horizon == o.a_horizon &&
      p_risk == o.p_risk &&
      remove_outliers == o.remove_outliers &&
      adjust_for_compounding == o.adjust_for_compounding &&
      goal_id == o.goal_id &&
      conf_tgt == o.conf_tgt &&
      trading_days_per_year == o.trading_days_per_year &&
      thresh == o.thresh &&
      withdrawal_tax == o.withdrawal_tax &&
      d_horizon == o.d_horizon &&
      client_id == o.client_id &&
      thresh_type == o.thresh_type &&
      horizon_frequency == o.horizon_frequency &&
      withdrawal_config == o.withdrawal_config &&
      curr_inv == o.curr_inv &&
      deposit_config == o.deposit_config &&
      p_ret == o.p_ret
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 578
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    value
  when :Date
    value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ProtonApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 642
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
a_horizon=(a_horizon) click to toggle source

Custom attribute writer method with validation @param [Object] a_horizon Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 406
def a_horizon=(a_horizon)
  if !a_horizon.nil? && a_horizon > 350
    fail ArgumentError, 'invalid value for "a_horizon", must be smaller than or equal to 350.'
  end

  if !a_horizon.nil? && a_horizon < 0
    fail ArgumentError, 'invalid value for "a_horizon", must be greater than or equal to 0.'
  end

  @a_horizon = a_horizon
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 558
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
compounding_rate=(compounding_rate) click to toggle source

Custom attribute writer method with validation @param [Object] compounding_rate Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 372
def compounding_rate=(compounding_rate)
  if !compounding_rate.nil? && compounding_rate < -1
    fail ArgumentError, 'invalid value for "compounding_rate", must be greater than or equal to -1.'
  end

  @compounding_rate = compounding_rate
end
conf_tgt=(conf_tgt) click to toggle source

Custom attribute writer method with validation @param [Object] conf_tgt Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 420
def conf_tgt=(conf_tgt)
  if !conf_tgt.nil? && conf_tgt > 1
    fail ArgumentError, 'invalid value for "conf_tgt", must be smaller than or equal to 1.'
  end

  if !conf_tgt.nil? && conf_tgt < 0
    fail ArgumentError, 'invalid value for "conf_tgt", must be greater than or equal to 0.'
  end

  @conf_tgt = conf_tgt
end
curr_inv=(curr_inv) click to toggle source

Custom attribute writer method with validation @param [Object] curr_inv Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 506
def curr_inv=(curr_inv)
  if !curr_inv.nil? && curr_inv < 0
    fail ArgumentError, 'invalid value for "curr_inv", must be greater than or equal to 0.'
  end

  @curr_inv = curr_inv
end
d_horizon=(d_horizon) click to toggle source

Custom attribute writer method with validation @param [Object] d_horizon Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 472
def d_horizon=(d_horizon)
  if !d_horizon.nil? && d_horizon > 350
    fail ArgumentError, 'invalid value for "d_horizon", must be smaller than or equal to 350.'
  end

  if !d_horizon.nil? && d_horizon < 0
    fail ArgumentError, 'invalid value for "d_horizon", must be greater than or equal to 0.'
  end

  @d_horizon = d_horizon
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 545
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 551
def hash
  [recommendation_config, compounding_rate, recommend_type, create_log, n, a_horizon, p_risk, remove_outliers, adjust_for_compounding, goal_id, conf_tgt, trading_days_per_year, thresh, withdrawal_tax, d_horizon, client_id, thresh_type, horizon_frequency, withdrawal_config, curr_inv, deposit_config, p_ret].hash
end
horizon_frequency=(horizon_frequency) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] horizon_frequency Object to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 496
def horizon_frequency=(horizon_frequency)
  validator = EnumAttributeValidator.new('String', ['year', 'six_months', 'quarter', 'month', 'two_weeks', 'week', 'day'])
  unless validator.valid?(horizon_frequency)
    fail ArgumentError, 'invalid value for "horizon_frequency", must be one of #{validator.allowable_values}.'
  end
  @horizon_frequency = horizon_frequency
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 268
def list_invalid_properties
  invalid_properties = Array.new
  if !@compounding_rate.nil? && @compounding_rate < -1
    invalid_properties.push('invalid value for "compounding_rate", must be greater than or equal to -1.')
  end

  if !@n.nil? && @n > 10000
    invalid_properties.push('invalid value for "n", must be smaller than or equal to 10000.')
  end

  if !@n.nil? && @n < 1
    invalid_properties.push('invalid value for "n", must be greater than or equal to 1.')
  end

  if !@a_horizon.nil? && @a_horizon > 350
    invalid_properties.push('invalid value for "a_horizon", must be smaller than or equal to 350.')
  end

  if !@a_horizon.nil? && @a_horizon < 0
    invalid_properties.push('invalid value for "a_horizon", must be greater than or equal to 0.')
  end

  if @p_risk.nil?
    invalid_properties.push('invalid value for "p_risk", p_risk cannot be nil.')
  end

  if !@conf_tgt.nil? && @conf_tgt > 1
    invalid_properties.push('invalid value for "conf_tgt", must be smaller than or equal to 1.')
  end

  if !@conf_tgt.nil? && @conf_tgt < 0
    invalid_properties.push('invalid value for "conf_tgt", must be greater than or equal to 0.')
  end

  if !@trading_days_per_year.nil? && @trading_days_per_year > 365
    invalid_properties.push('invalid value for "trading_days_per_year", must be smaller than or equal to 365.')
  end

  if !@trading_days_per_year.nil? && @trading_days_per_year < 1
    invalid_properties.push('invalid value for "trading_days_per_year", must be greater than or equal to 1.')
  end

  if !@thresh.nil? && @thresh < 0
    invalid_properties.push('invalid value for "thresh", must be greater than or equal to 0.')
  end

  if !@withdrawal_tax.nil? && @withdrawal_tax > 1
    invalid_properties.push('invalid value for "withdrawal_tax", must be smaller than or equal to 1.')
  end

  if !@withdrawal_tax.nil? && @withdrawal_tax < 0
    invalid_properties.push('invalid value for "withdrawal_tax", must be greater than or equal to 0.')
  end

  if !@d_horizon.nil? && @d_horizon > 350
    invalid_properties.push('invalid value for "d_horizon", must be smaller than or equal to 350.')
  end

  if !@d_horizon.nil? && @d_horizon < 0
    invalid_properties.push('invalid value for "d_horizon", must be greater than or equal to 0.')
  end

  if !@curr_inv.nil? && @curr_inv < 0
    invalid_properties.push('invalid value for "curr_inv", must be greater than or equal to 0.')
  end

  if @p_ret.nil?
    invalid_properties.push('invalid value for "p_ret", p_ret cannot be nil.')
  end

  invalid_properties
end
n=(n) click to toggle source

Custom attribute writer method with validation @param [Object] n Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 392
def n=(n)
  if !n.nil? && n > 10000
    fail ArgumentError, 'invalid value for "n", must be smaller than or equal to 10000.'
  end

  if !n.nil? && n < 1
    fail ArgumentError, 'invalid value for "n", must be greater than or equal to 1.'
  end

  @n = n
end
recommend_type=(recommend_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] recommend_type Object to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 382
def recommend_type=(recommend_type)
  validator = EnumAttributeValidator.new('String', ['recurring', 'one-time', 'combo', 'horizon'])
  unless validator.valid?(recommend_type)
    fail ArgumentError, 'invalid value for "recommend_type", must be one of #{validator.allowable_values}.'
  end
  @recommend_type = recommend_type
end
thresh=(thresh) click to toggle source

Custom attribute writer method with validation @param [Object] thresh Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 448
def thresh=(thresh)
  if !thresh.nil? && thresh < 0
    fail ArgumentError, 'invalid value for "thresh", must be greater than or equal to 0.'
  end

  @thresh = thresh
end
thresh_type=(thresh_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] thresh_type Object to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 486
def thresh_type=(thresh_type)
  validator = EnumAttributeValidator.new('String', ['amnt', 'perc'])
  unless validator.valid?(thresh_type)
    fail ArgumentError, 'invalid value for "thresh_type", must be one of #{validator.allowable_values}.'
  end
  @thresh_type = thresh_type
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 623
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 629
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 617
def to_s
  to_hash.to_s
end
trading_days_per_year=(trading_days_per_year) click to toggle source

Custom attribute writer method with validation @param [Object] trading_days_per_year Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 434
def trading_days_per_year=(trading_days_per_year)
  if !trading_days_per_year.nil? && trading_days_per_year > 365
    fail ArgumentError, 'invalid value for "trading_days_per_year", must be smaller than or equal to 365.'
  end

  if !trading_days_per_year.nil? && trading_days_per_year < 1
    fail ArgumentError, 'invalid value for "trading_days_per_year", must be greater than or equal to 1.'
  end

  @trading_days_per_year = trading_days_per_year
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 343
def valid?
  return false if !@compounding_rate.nil? && @compounding_rate < -1
  recommend_type_validator = EnumAttributeValidator.new('String', ['recurring', 'one-time', 'combo', 'horizon'])
  return false unless recommend_type_validator.valid?(@recommend_type)
  return false if !@n.nil? && @n > 10000
  return false if !@n.nil? && @n < 1
  return false if !@a_horizon.nil? && @a_horizon > 350
  return false if !@a_horizon.nil? && @a_horizon < 0
  return false if @p_risk.nil?
  return false if !@conf_tgt.nil? && @conf_tgt > 1
  return false if !@conf_tgt.nil? && @conf_tgt < 0
  return false if !@trading_days_per_year.nil? && @trading_days_per_year > 365
  return false if !@trading_days_per_year.nil? && @trading_days_per_year < 1
  return false if !@thresh.nil? && @thresh < 0
  return false if !@withdrawal_tax.nil? && @withdrawal_tax > 1
  return false if !@withdrawal_tax.nil? && @withdrawal_tax < 0
  return false if !@d_horizon.nil? && @d_horizon > 350
  return false if !@d_horizon.nil? && @d_horizon < 0
  thresh_type_validator = EnumAttributeValidator.new('String', ['amnt', 'perc'])
  return false unless thresh_type_validator.valid?(@thresh_type)
  horizon_frequency_validator = EnumAttributeValidator.new('String', ['year', 'six_months', 'quarter', 'month', 'two_weeks', 'week', 'day'])
  return false unless horizon_frequency_validator.valid?(@horizon_frequency)
  return false if !@curr_inv.nil? && @curr_inv < 0
  return false if @p_ret.nil?
  true
end
withdrawal_tax=(withdrawal_tax) click to toggle source

Custom attribute writer method with validation @param [Object] withdrawal_tax Value to be assigned

# File lib/proton_api/models/goal_decumulation_recommendation_request.rb, line 458
def withdrawal_tax=(withdrawal_tax)
  if !withdrawal_tax.nil? && withdrawal_tax > 1
    fail ArgumentError, 'invalid value for "withdrawal_tax", must be smaller than or equal to 1.'
  end

  if !withdrawal_tax.nil? && withdrawal_tax < 0
    fail ArgumentError, 'invalid value for "withdrawal_tax", must be greater than or equal to 0.'
  end

  @withdrawal_tax = withdrawal_tax
end