Class: ThePlaidApi::AssetReportInvestmentHolding
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::AssetReportInvestmentHolding
- Defined in:
- lib/the_plaid_api/models/asset_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.
-
#ticker_symbol ⇒ String
The holding’s trading symbol for publicly traded holdings, and otherwise a short identifier if available.
-
#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:, ticker_symbol:, institution_price:, institution_value:, cost_basis:, quantity:, iso_currency_code:, unofficial_currency_code:, institution_price_as_of: SKIP, additional_properties: nil) ⇒ AssetReportInvestmentHolding
constructor
A new instance of AssetReportInvestmentHolding.
-
#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:, ticker_symbol:, institution_price:, institution_value:, cost_basis:, quantity:, iso_currency_code:, unofficial_currency_code:, institution_price_as_of: SKIP, additional_properties: nil) ⇒ AssetReportInvestmentHolding
Returns a new instance of AssetReportInvestmentHolding.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 105 def initialize(account_id:, security_id:, ticker_symbol:, 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 @ticker_symbol = ticker_symbol @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/asset_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.
47 48 49 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 47 def cost_basis @cost_basis end |
#institution_price ⇒ Float
The last price given by the institution for this security.
34 35 36 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 34 def institution_price @institution_price end |
#institution_price_as_of ⇒ Date
The date at which ‘institution_price` was current.
38 39 40 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 38 def institution_price_as_of @institution_price_as_of end |
#institution_value ⇒ Float
The value of the holding, as reported by the institution.
42 43 44 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 42 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`.
59 60 61 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 59 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.
54 55 56 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 54 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/asset_report_investment_holding.rb', line 25 def security_id @security_id end |
#ticker_symbol ⇒ String
The holding’s trading symbol for publicly traded holdings, and otherwise a short identifier if available.
30 31 32 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 30 def ticker_symbol @ticker_symbol 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.
69 70 71 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 69 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 126 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 ticker_symbol = hash.key?('ticker_symbol') ? hash['ticker_symbol'] : 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. AssetReportInvestmentHolding.new(account_id: account_id, security_id: security_id, ticker_symbol: ticker_symbol, 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.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 72 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'account_id' @_hash['security_id'] = 'security_id' @_hash['ticker_symbol'] = 'ticker_symbol' @_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
95 96 97 98 99 100 101 102 103 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 95 def self.nullables %w[ ticker_symbol institution_price_as_of cost_basis iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
88 89 90 91 92 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 88 def self.optionals %w[ institution_price_as_of ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
179 180 181 182 183 184 185 186 187 188 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 179 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id.inspect}, security_id: #{@security_id.inspect},"\ " ticker_symbol: #{@ticker_symbol.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.
168 169 170 171 172 173 174 175 176 |
# File 'lib/the_plaid_api/models/asset_report_investment_holding.rb', line 168 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id}, security_id: #{@security_id}, ticker_symbol:"\ " #{@ticker_symbol}, 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 |