Class: Plaid::Security
- Defined in:
- lib/plaid/models/security.rb
Overview
Contains details about a security
Instance Attribute Summary collapse
-
#close_price ⇒ Float
Price of the security at the close of the previous trading session.
-
#close_price_as_of ⇒ Date
Date for which ‘close_price` is accurate.
-
#cusip ⇒ String
9-character CUSIP, an identifier assigned to North American securities.
-
#institution_id ⇒ String
If ‘institution_security_id` is present, this field indicates the Plaid `institution_id` of the institution to whom the identifier belongs.
-
#institution_security_id ⇒ String
An identifier given to the security by the institution.
-
#is_cash_equivalent ⇒ TrueClass | FalseClass
Indicates that a security is a highly liquid asset and can be treated like cash.
-
#isin ⇒ String
12-character ISIN, a globally unique securities identifier.
-
#iso_currency_code ⇒ String
The ISO-4217 currency code of the price given.
-
#name ⇒ String
A descriptive name for the security, suitable for display.
-
#proxy_security_id ⇒ String
In certain cases, Plaid will provide the ID of another security whose performance resembles this security, typically when the original security has low volume, or when a private security can be modeled with a publicly traded security.
-
#security_id ⇒ String
A unique, Plaid-specific identifier for the security, used to associate securities with holdings.
-
#sedol ⇒ String
7-character SEDOL, an identifier assigned to securities in the UK.
-
#ticker_symbol ⇒ String
The security’s trading symbol for publicly traded securities, and otherwise a short identifier if available.
-
#type ⇒ String
The security type of the holding.
-
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the security.
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(security_id:, isin:, cusip:, sedol:, institution_security_id:, institution_id:, proxy_security_id:, name:, ticker_symbol:, is_cash_equivalent:, type:, close_price:, close_price_as_of:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ Security
constructor
A new instance of Security.
-
#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(security_id:, isin:, cusip:, sedol:, institution_security_id:, institution_id:, proxy_security_id:, name:, ticker_symbol:, is_cash_equivalent:, type:, close_price:, close_price_as_of:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) ⇒ Security
Returns a new instance of Security.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/plaid/models/security.rb', line 145 def initialize(security_id:, isin:, cusip:, sedol:, institution_security_id:, institution_id:, proxy_security_id:, name:, ticker_symbol:, is_cash_equivalent:, type:, close_price:, close_price_as_of:, iso_currency_code:, unofficial_currency_code:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @security_id = security_id @isin = isin @cusip = cusip @sedol = sedol @institution_security_id = institution_security_id @institution_id = institution_id @proxy_security_id = proxy_security_id @name = name @ticker_symbol = ticker_symbol @is_cash_equivalent = is_cash_equivalent @type = type @close_price = close_price @close_price_as_of = close_price_as_of @iso_currency_code = iso_currency_code @unofficial_currency_code = unofficial_currency_code @additional_properties = additional_properties end |
Instance Attribute Details
#close_price ⇒ Float
Price of the security at the close of the previous trading session. ‘null` for non-public securities. If the security is a foreign currency or a cryptocurrency this field will be updated daily and will be priced in USD.
77 78 79 |
# File 'lib/plaid/models/security.rb', line 77 def close_price @close_price end |
#close_price_as_of ⇒ Date
Date for which ‘close_price` is accurate. Always `null` if `close_price` is `null`.
82 83 84 |
# File 'lib/plaid/models/security.rb', line 82 def close_price_as_of @close_price_as_of end |
#cusip ⇒ String
9-character CUSIP, an identifier assigned to North American securities.
24 25 26 |
# File 'lib/plaid/models/security.rb', line 24 def cusip @cusip end |
#institution_id ⇒ String
If ‘institution_security_id` is present, this field indicates the Plaid `institution_id` of the institution to whom the identifier belongs.
37 38 39 |
# File 'lib/plaid/models/security.rb', line 37 def institution_id @institution_id end |
#institution_security_id ⇒ String
An identifier given to the security by the institution
32 33 34 |
# File 'lib/plaid/models/security.rb', line 32 def institution_security_id @institution_security_id end |
#is_cash_equivalent ⇒ TrueClass | FalseClass
Indicates that a security is a highly liquid asset and can be treated like cash.
58 59 60 |
# File 'lib/plaid/models/security.rb', line 58 def is_cash_equivalent @is_cash_equivalent end |
#isin ⇒ String
12-character ISIN, a globally unique securities identifier.
20 21 22 |
# File 'lib/plaid/models/security.rb', line 20 def isin @isin end |
#iso_currency_code ⇒ String
The ISO-4217 currency code of the price given. Always ‘null` if `unofficial_currency_code` is non-`null`.
87 88 89 |
# File 'lib/plaid/models/security.rb', line 87 def iso_currency_code @iso_currency_code end |
#name ⇒ String
A descriptive name for the security, suitable for display.
48 49 50 |
# File 'lib/plaid/models/security.rb', line 48 def name @name end |
#proxy_security_id ⇒ String
In certain cases, Plaid will provide the ID of another security whose performance resembles this security, typically when the original security has low volume, or when a private security can be modeled with a publicly traded security.
44 45 46 |
# File 'lib/plaid/models/security.rb', line 44 def proxy_security_id @proxy_security_id end |
#security_id ⇒ String
A unique, Plaid-specific identifier for the security, used to associate securities with holdings. Like all Plaid identifiers, the ‘security_id` is case sensitive.
16 17 18 |
# File 'lib/plaid/models/security.rb', line 16 def security_id @security_id end |
#sedol ⇒ String
7-character SEDOL, an identifier assigned to securities in the UK.
28 29 30 |
# File 'lib/plaid/models/security.rb', line 28 def sedol @sedol end |
#ticker_symbol ⇒ String
The security’s trading symbol for publicly traded securities, and otherwise a short identifier if available.
53 54 55 |
# File 'lib/plaid/models/security.rb', line 53 def ticker_symbol @ticker_symbol end |
#type ⇒ String
The security type of the holding. Valid security types are: ‘cash`: Cash, currency, and money market funds `derivative`: Options, warrants, and other derivative instruments `equity`: Domestic and foreign equities `etf`: Multi-asset exchange-traded investment funds `fixed income`: Bonds and certificates of deposit (CDs) `loan`: Loans and loan receivables. `mutual fund`: Open- and closed-end vehicles pooling funds of multiple investors. `other`: Unknown or other investment types
71 72 73 |
# File 'lib/plaid/models/security.rb', line 71 def type @type end |
#unofficial_currency_code ⇒ String
The unofficial currency code associated with the security. 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.
97 98 99 |
# File 'lib/plaid/models/security.rb', line 97 def unofficial_currency_code @unofficial_currency_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/plaid/models/security.rb', line 173 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. security_id = hash.key?('security_id') ? hash['security_id'] : nil isin = hash.key?('isin') ? hash['isin'] : nil cusip = hash.key?('cusip') ? hash['cusip'] : nil sedol = hash.key?('sedol') ? hash['sedol'] : nil institution_security_id = hash.key?('institution_security_id') ? hash['institution_security_id'] : nil institution_id = hash.key?('institution_id') ? hash['institution_id'] : nil proxy_security_id = hash.key?('proxy_security_id') ? hash['proxy_security_id'] : nil name = hash.key?('name') ? hash['name'] : nil ticker_symbol = hash.key?('ticker_symbol') ? hash['ticker_symbol'] : nil is_cash_equivalent = hash.key?('is_cash_equivalent') ? hash['is_cash_equivalent'] : nil type = hash.key?('type') ? hash['type'] : nil close_price = hash.key?('close_price') ? hash['close_price'] : nil close_price_as_of = hash.key?('close_price_as_of') ? hash['close_price_as_of'] : 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. Security.new(security_id: security_id, isin: isin, cusip: cusip, sedol: sedol, institution_security_id: institution_security_id, institution_id: institution_id, proxy_security_id: proxy_security_id, name: name, ticker_symbol: ticker_symbol, is_cash_equivalent: is_cash_equivalent, type: type, close_price: close_price, close_price_as_of: close_price_as_of, 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.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/plaid/models/security.rb', line 100 def self.names @_hash = {} if @_hash.nil? @_hash['security_id'] = 'security_id' @_hash['isin'] = 'isin' @_hash['cusip'] = 'cusip' @_hash['sedol'] = 'sedol' @_hash['institution_security_id'] = 'institution_security_id' @_hash['institution_id'] = 'institution_id' @_hash['proxy_security_id'] = 'proxy_security_id' @_hash['name'] = 'name' @_hash['ticker_symbol'] = 'ticker_symbol' @_hash['is_cash_equivalent'] = 'is_cash_equivalent' @_hash['type'] = 'type' @_hash['close_price'] = 'close_price' @_hash['close_price_as_of'] = 'close_price_as_of' @_hash['iso_currency_code'] = 'iso_currency_code' @_hash['unofficial_currency_code'] = 'unofficial_currency_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/plaid/models/security.rb', line 126 def self.nullables %w[ isin cusip sedol institution_security_id institution_id proxy_security_id name ticker_symbol is_cash_equivalent type close_price close_price_as_of iso_currency_code unofficial_currency_code ] end |
.optionals ⇒ Object
An array for optional fields
121 122 123 |
# File 'lib/plaid/models/security.rb', line 121 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/plaid/models/security.rb', line 239 def inspect class_name = self.class.name.split('::').last "<#{class_name} security_id: #{@security_id.inspect}, isin: #{@isin.inspect}, cusip:"\ " #{@cusip.inspect}, sedol: #{@sedol.inspect}, institution_security_id:"\ " #{@institution_security_id.inspect}, institution_id: #{@institution_id.inspect},"\ " proxy_security_id: #{@proxy_security_id.inspect}, name: #{@name.inspect}, ticker_symbol:"\ " #{@ticker_symbol.inspect}, is_cash_equivalent: #{@is_cash_equivalent.inspect}, type:"\ " #{@type.inspect}, close_price: #{@close_price.inspect}, close_price_as_of:"\ " #{@close_price_as_of.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.
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/plaid/models/security.rb', line 227 def to_s class_name = self.class.name.split('::').last "<#{class_name} security_id: #{@security_id}, isin: #{@isin}, cusip: #{@cusip}, sedol:"\ " #{@sedol}, institution_security_id: #{@institution_security_id}, institution_id:"\ " #{@institution_id}, proxy_security_id: #{@proxy_security_id}, name: #{@name},"\ " ticker_symbol: #{@ticker_symbol}, is_cash_equivalent: #{@is_cash_equivalent}, type:"\ " #{@type}, close_price: #{@close_price}, close_price_as_of: #{@close_price_as_of},"\ " iso_currency_code: #{@iso_currency_code}, unofficial_currency_code:"\ " #{@unofficial_currency_code}, additional_properties: #{@additional_properties}>" end |