Class: ThePlaidApi::HoldingsOverride
- Defined in:
- lib/the_plaid_api/models/holdings_override.rb
Overview
Specify the holdings on the account.
Instance Attribute Summary collapse
-
#cost_basis ⇒ Float
The total cost basis of the holding (e.g., the total amount spent to acquire all assets currently in the holding).
-
#currency ⇒ String
Either a valid ‘iso_currency_code` or `unofficial_currency_code`.
-
#institution_price ⇒ Float
The last price given by the institution for this security.
-
#institution_price_as_of ⇒ Date
The date at which ‘institution_price` was current.
-
#quantity ⇒ Float
The total quantity of the asset held, as reported by the financial institution.
-
#security ⇒ SecurityOverride
Specify the security associated with the holding or investment transaction.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(institution_price:, quantity:, currency:, security:, institution_price_as_of: SKIP, cost_basis: SKIP, additional_properties: nil) ⇒ HoldingsOverride
constructor
A new instance of HoldingsOverride.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(institution_price:, quantity:, currency:, security:, institution_price_as_of: SKIP, cost_basis: SKIP, additional_properties: nil) ⇒ HoldingsOverride
Returns a new instance of HoldingsOverride.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 69 def initialize(institution_price:, quantity:, currency:, security:, institution_price_as_of: SKIP, cost_basis: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @institution_price = institution_price @institution_price_as_of = institution_price_as_of unless institution_price_as_of == SKIP @cost_basis = cost_basis unless cost_basis == SKIP @quantity = quantity @currency = currency @security = security @additional_properties = additional_properties end |
Instance Attribute Details
#cost_basis ⇒ Float
The total cost basis of the holding (e.g., the total amount spent to acquire all assets currently in the holding).
24 25 26 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 24 def cost_basis @cost_basis end |
#currency ⇒ String
Either a valid ‘iso_currency_code` or `unofficial_currency_code`
33 34 35 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 33 def currency @currency end |
#institution_price ⇒ Float
The last price given by the institution for this security
14 15 16 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 14 def institution_price @institution_price end |
#institution_price_as_of ⇒ Date
The date at which ‘institution_price` was current. Must be formatted as an [ISO 8601](wikipedia.org/wiki/ISO_8601) date.
19 20 21 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 19 def institution_price_as_of @institution_price_as_of end |
#quantity ⇒ Float
The total quantity of the asset held, as reported by the financial institution.
29 30 31 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 29 def quantity @quantity end |
#security ⇒ SecurityOverride
Specify the security associated with the holding or investment transaction. When inputting custom security data to the Sandbox, Plaid will perform post-data-retrieval normalization and enrichment. These processes may cause the data returned by the Sandbox to be slightly different from the data you input. An ISO-4217 currency code and a security identifier (‘ticker_symbol`, `cusip`, or `isin`) are required.
42 43 44 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 42 def security @security end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. institution_price = hash.key?('institution_price') ? hash['institution_price'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil currency = hash.key?('currency') ? hash['currency'] : nil security = SecurityOverride.from_hash(hash['security']) if hash['security'] institution_price_as_of = hash.key?('institution_price_as_of') ? hash['institution_price_as_of'] : SKIP cost_basis = hash.key?('cost_basis') ? hash['cost_basis'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. HoldingsOverride.new(institution_price: institution_price, quantity: quantity, currency: currency, security: security, institution_price_as_of: institution_price_as_of, cost_basis: cost_basis, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['institution_price'] = 'institution_price' @_hash['institution_price_as_of'] = 'institution_price_as_of' @_hash['cost_basis'] = 'cost_basis' @_hash['quantity'] = 'quantity' @_hash['currency'] = 'currency' @_hash['security'] = 'security' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 65 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
57 58 59 60 61 62 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 57 def self.optionals %w[ institution_price_as_of cost_basis ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
124 125 126 127 128 129 130 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 124 def inspect class_name = self.class.name.split('::').last "<#{class_name} institution_price: #{@institution_price.inspect}, institution_price_as_of:"\ " #{@institution_price_as_of.inspect}, cost_basis: #{@cost_basis.inspect}, quantity:"\ " #{@quantity.inspect}, currency: #{@currency.inspect}, security: #{@security.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
116 117 118 119 120 121 |
# File 'lib/the_plaid_api/models/holdings_override.rb', line 116 def to_s class_name = self.class.name.split('::').last "<#{class_name} institution_price: #{@institution_price}, institution_price_as_of:"\ " #{@institution_price_as_of}, cost_basis: #{@cost_basis}, quantity: #{@quantity}, currency:"\ " #{@currency}, security: #{@security}, additional_properties: #{@additional_properties}>" end |