Class: ThePlaidApi::AssetReportInvestmentTransaction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::AssetReportInvestmentTransaction
- Defined in:
- lib/the_plaid_api/models/asset_report_investment_transaction.rb
Overview
A transaction within an investment account.
Instance Attribute Summary collapse
-
#account_id ⇒ String
The ‘account_id` of the account against which this transaction posted.
-
#amount ⇒ Float
The complete value of the transaction.
-
#date ⇒ Date
The [ISO 8601](wikipedia.org/wiki/ISO_8601) posting date for the transaction.
-
#fees ⇒ Float
The combined value of all fees applied to this transaction.
-
#investment_transaction_id ⇒ String
The ID of the Investment transaction, unique across all Plaid transactions.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the transaction.
-
#name ⇒ String
The institution’s description of the transaction.
-
#price ⇒ Float
The price of the security at which this transaction occurred.
-
#quantity ⇒ Float
The number of units of the security involved in this transaction.
-
#security_id ⇒ String
The ‘security_id` to which this transaction is related.
-
#subtype ⇒ InvestmentTransactionSubtype
For descriptions of possible transaction types and subtypes, see the [Investment transaction types schema](plaid.com/docs/api/accounts/#investment-transaction-types- schema).
-
#type ⇒ InvestmentTransactionType
Value is one of the following: ‘buy`: Buying an investment `sell`: Selling an investment `cancel`: A cancellation of a pending transaction `cash`: Activity that modifies a cash position `fee`: A fee on the account `transfer`: Activity which modifies a position, but not through buy/sell activity e.g.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the holding.
-
#vested_quantity ⇒ Float
The total quantity of vested assets held, as reported by the financial institution.
-
#vested_value ⇒ Float
The value of the vested holdings as reported by the institution.
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(investment_transaction_id:, account_id:, security_id:, date:, name:, quantity:, vested_quantity:, vested_value:, amount:, price:, fees:, type:, subtype:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ AssetReportInvestmentTransaction
constructor
A new instance of AssetReportInvestmentTransaction.
-
#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(investment_transaction_id:, account_id:, security_id:, date:, name:, quantity:, vested_quantity:, vested_value:, amount:, price:, fees:, type:, subtype:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ AssetReportInvestmentTransaction
Returns a new instance of AssetReportInvestmentTransaction.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 139 def initialize(investment_transaction_id:, account_id:, security_id:, date:, name:, quantity:, vested_quantity:, vested_value:, amount:, price:, fees:, type:, subtype:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @investment_transaction_id = investment_transaction_id @account_id = account_id @security_id = security_id @date = date @name = name @quantity = quantity @vested_quantity = vested_quantity @vested_value = vested_value @amount = amount @price = price @fees = fees @type = type @subtype = subtype @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
The ‘account_id` of the account against which this transaction posted.
20 21 22 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 20 def account_id @account_id end |
#amount ⇒ Float
The complete value of the transaction. Positive values when cash is debited, e.g. purchases of stock; negative values when cash is credited, e.g. sales of stock. Treatment remains the same for cash-only movements unassociated with securities.
56 57 58 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 56 def amount @amount end |
#date ⇒ Date
The [ISO 8601](wikipedia.org/wiki/ISO_8601) posting date for the transaction.
29 30 31 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 29 def date @date end |
#fees ⇒ Float
The combined value of all fees applied to this transaction
64 65 66 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 64 def fees @fees end |
#investment_transaction_id ⇒ String
The ID of the Investment transaction, unique across all Plaid transactions. Like all Plaid identifiers, the ‘investment_transaction_id` is case sensitive.
16 17 18 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 16 def investment_transaction_id @investment_transaction_id end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the transaction. Always ‘null` if `unofficial_currency_code` is non-`null`.
91 92 93 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 91 def iso_currency_code @iso_currency_code end |
#name ⇒ String
The institution’s description of the transaction.
33 34 35 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 33 def name @name end |
#price ⇒ Float
The price of the security at which this transaction occurred.
60 61 62 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 60 def price @price end |
#quantity ⇒ Float
The number of units of the security involved in this transaction. Positive for buy transactions; negative for sell transactions.
38 39 40 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 38 def quantity @quantity end |
#security_id ⇒ String
The ‘security_id` to which this transaction is related.
24 25 26 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 24 def security_id @security_id end |
#subtype ⇒ InvestmentTransactionSubtype
For descriptions of possible transaction types and subtypes, see the [Investment transaction types schema](plaid.com/docs/api/accounts/#investment-transaction-types- schema).
86 87 88 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 86 def subtype @subtype end |
#type ⇒ InvestmentTransactionType
Value is one of the following: ‘buy`: Buying an investment `sell`: Selling an investment `cancel`: A cancellation of a pending transaction `cash`: Activity that modifies a cash position `fee`: A fee on the account `transfer`: Activity which modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer For descriptions of possible transaction types and subtypes, see the [Investment transaction types schema](plaid.com/docs/api/accounts/#investment-transaction-types- schema).
79 80 81 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 79 def type @type 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.
101 102 103 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 101 def unofficial_currency_code @unofficial_currency_code end |
#vested_quantity ⇒ Float
The total quantity of vested assets held, as reported by the financial institution. Vested assets are only associated with [equities](plaid.com/docs/api/products/investments/#investments-ho ldings-get-response-securities-type).
45 46 47 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 45 def vested_quantity @vested_quantity end |
#vested_value ⇒ Float
The value of the vested holdings as reported by the institution.
49 50 51 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 49 def vested_value @vested_value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 165 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. investment_transaction_id = hash.key?('investment_transaction_id') ? hash['investment_transaction_id'] : nil account_id = hash.key?('account_id') ? hash['account_id'] : nil security_id = hash.key?('security_id') ? hash['security_id'] : nil date = hash.key?('date') ? hash['date'] : nil name = hash.key?('name') ? hash['name'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil vested_quantity = hash.key?('vested_quantity') ? hash['vested_quantity'] : nil vested_value = hash.key?('vested_value') ? hash['vested_value'] : nil amount = hash.key?('amount') ? hash['amount'] : nil price = hash.key?('price') ? hash['price'] : nil fees = hash.key?('fees') ? hash['fees'] : nil type = hash.key?('type') ? hash['type'] : nil subtype = hash.key?('subtype') ? hash['subtype'] : 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 # 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. AssetReportInvestmentTransaction.new(investment_transaction_id: investment_transaction_id, account_id: account_id, security_id: security_id, date: date, name: name, quantity: quantity, vested_quantity: vested_quantity, vested_value: vested_value, amount: amount, price: price, fees: fees, type: type, subtype: subtype, iso_currency_code: iso_currency_code, unofficial_currency_code: unofficial_currency_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 104 def self.names @_hash = {} if @_hash.nil? @_hash['investment_transaction_id'] = 'investment_transaction_id' @_hash['account_id'] = 'account_id' @_hash['security_id'] = 'security_id' @_hash['date'] = 'date' @_hash['name'] = 'name' @_hash['quantity'] = 'quantity' @_hash['vested_quantity'] = 'vested_quantity' @_hash['vested_value'] = 'vested_value' @_hash['amount'] = 'amount' @_hash['price'] = 'price' @_hash['fees'] = 'fees' @_hash['type'] = 'type' @_hash['subtype'] = 'subtype' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
130 131 132 133 134 135 136 137 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 130 def self.nullables %w[ security_id fees iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
125 126 127 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 125 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 227 def inspect class_name = self.class.name.split('::').last "<#{class_name} investment_transaction_id: #{@investment_transaction_id.inspect},"\ " account_id: #{@account_id.inspect}, security_id: #{@security_id.inspect}, date:"\ " #{@date.inspect}, name: #{@name.inspect}, quantity: #{@quantity.inspect}, vested_quantity:"\ " #{@vested_quantity.inspect}, vested_value: #{@vested_value.inspect}, amount:"\ " #{@amount.inspect}, price: #{@price.inspect}, fees: #{@fees.inspect}, type:"\ " #{@type.inspect}, subtype: #{@subtype.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.
216 217 218 219 220 221 222 223 224 |
# File 'lib/the_plaid_api/models/asset_report_investment_transaction.rb', line 216 def to_s class_name = self.class.name.split('::').last "<#{class_name} investment_transaction_id: #{@investment_transaction_id}, account_id:"\ " #{@account_id}, security_id: #{@security_id}, date: #{@date}, name: #{@name}, quantity:"\ " #{@quantity}, vested_quantity: #{@vested_quantity}, vested_value: #{@vested_value},"\ " amount: #{@amount}, price: #{@price}, fees: #{@fees}, type: #{@type}, subtype:"\ " #{@subtype}, iso_currency_code: #{@iso_currency_code}, unofficial_currency_code:"\ " #{@unofficial_currency_code}, additional_properties: #{@additional_properties}>" end |