Class: ThePlaidApi::BaseReportInvestmentHolding
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::BaseReportInvestmentHolding
- Defined in:
- lib/the_plaid_api/models/base_report_investment_holding.rb
Overview
A securities holding at an institution.
Instance Attribute Summary collapse
-
#account_id ⇒ String
The Plaid ‘account_id` associated with the holding.
-
#cost_basis ⇒ Float
The original total value of the holding.
-
#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.
-
#institution_value ⇒ Float
The value of the holding, as reported by the institution.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the holding.
-
#quantity ⇒ Float
The total quantity of the asset held, as reported by the financial institution.
-
#security_id ⇒ String
The Plaid ‘security_id` associated with the holding.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the holding.
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(account_id:, security_id:, institution_price:, institution_value:, cost_basis:, quantity:, iso_currency_code:, unofficial_currency_code:, institution_price_as_of: SKIP, additional_properties: nil) ⇒ BaseReportInvestmentHolding
constructor
A new instance of BaseReportInvestmentHolding.
-
#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(account_id:, security_id:, institution_price:, institution_value:, cost_basis:, quantity:, iso_currency_code:, unofficial_currency_code:, institution_price_as_of: SKIP, additional_properties: nil) ⇒ BaseReportInvestmentHolding
Returns a new instance of BaseReportInvestmentHolding.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 98 def initialize(account_id:, security_id:, institution_price:, institution_value:, cost_basis:, quantity:, iso_currency_code:, unofficial_currency_code:, institution_price_as_of: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_id = account_id @security_id = security_id @institution_price = institution_price @institution_price_as_of = institution_price_as_of unless institution_price_as_of == SKIP @institution_value = institution_value @cost_basis = cost_basis @quantity = quantity @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
The Plaid ‘account_id` associated with the holding.
14 15 16 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 14 def account_id @account_id end |
#cost_basis ⇒ Float
The original total value of the holding. This field is calculated by Plaid as the sum of the purchase price of all of the shares in the holding.
42 43 44 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 42 def cost_basis @cost_basis end |
#institution_price ⇒ Float
The last price given by the institution for this security.
29 30 31 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 29 def institution_price @institution_price end |
#institution_price_as_of ⇒ Date
The date at which ‘institution_price` was current.
33 34 35 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 33 def institution_price_as_of @institution_price_as_of end |
#institution_value ⇒ Float
The value of the holding, as reported by the institution.
37 38 39 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 37 def institution_value @institution_value end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the holding. Always ‘null` if `unofficial_currency_code` is non-`null`.
54 55 56 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 54 def iso_currency_code @iso_currency_code end |
#quantity ⇒ Float
The total quantity of the asset held, as reported by the financial institution. If the security is an option, ‘quantity` will reflect the total number of options (typically the number of contracts multiplied by 100), not the number of contracts.
49 50 51 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 49 def quantity @quantity end |
#security_id ⇒ String
The Plaid ‘security_id` associated with the holding. Security data is not specific to a user’s account; any user who held the same security at the same financial institution at the same time would have identical security data. The ‘security_id` for the same security will typically be the same across different institutions, but this is not guaranteed. The `security_id` does not typically change, but may change if inherent details of the security change due to a corporate action, for example, in the event of a ticker symbol change or CUSIP change.
25 26 27 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 25 def security_id @security_id end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the holding. Always ‘null` if `iso_currency_code` is non-`null`. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries. See the [currency code schema](plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `iso_currency_code`s.
64 65 66 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 64 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 118 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_id = hash.key?('account_id') ? hash['account_id'] : nil security_id = hash.key?('security_id') ? hash['security_id'] : nil institution_price = hash.key?('institution_price') ? hash['institution_price'] : nil institution_value = hash.key?('institution_value') ? hash['institution_value'] : nil cost_basis = hash.key?('cost_basis') ? hash['cost_basis'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil iso_currency_code = hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil unofficial_currency_code = hash.key?('unofficial_currency_code') ? hash['unofficial_currency_code'] : nil institution_price_as_of = hash.key?('institution_price_as_of') ? hash['institution_price_as_of'] : 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. BaseReportInvestmentHolding.new(account_id: account_id, security_id: security_id, institution_price: institution_price, institution_value: institution_value, cost_basis: cost_basis, quantity: quantity, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, institution_price_as_of: institution_price_as_of, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 67 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'account_id' @_hash['security_id'] = 'security_id' @_hash['institution_price'] = 'institution_price' @_hash['institution_price_as_of'] = 'institution_price_as_of' @_hash['institution_value'] = 'institution_value' @_hash['cost_basis'] = 'cost_basis' @_hash['quantity'] = 'quantity' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
89 90 91 92 93 94 95 96 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 89 def self.nullables %w[ institution_price_as_of cost_basis iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
82 83 84 85 86 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 82 def self.optionals %w[ institution_price_as_of ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
169 170 171 172 173 174 175 176 177 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 169 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id.inspect}, security_id: #{@security_id.inspect},"\ " institution_price: #{@institution_price.inspect}, institution_price_as_of:"\ " #{@institution_price_as_of.inspect}, institution_value: #{@institution_value.inspect},"\ " cost_basis: #{@cost_basis.inspect}, quantity: #{@quantity.inspect}, iso_currency_code:"\ " #{@iso_currency_code.inspect}, unofficial_currency_code:"\ " #{@unofficial_currency_code.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
158 159 160 161 162 163 164 165 166 |
# File 'lib/the_plaid_api/models/base_report_investment_holding.rb', line 158 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id}, security_id: #{@security_id},"\ " institution_price: #{@institution_price}, institution_price_as_of:"\ " #{@institution_price_as_of}, institution_value: #{@institution_value}, cost_basis:"\ " #{@cost_basis}, quantity: #{@quantity}, iso_currency_code: #{@iso_currency_code},"\ " unofficial_currency_code: #{@unofficial_currency_code}, additional_properties:"\ " #{@additional_properties}>" end |