Class: Intrinio::Security

Inherits:
Object
  • Object
show all
Defined in:
lib/intrinio-sdk/models/security.rb

Overview

A financial instrument representing shares of ownership in a publicly-traded company

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Security

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/intrinio-sdk/models/security.rb', line 173

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'company_id')
    self.company_id = attributes[:'company_id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'code')
    self.code = attributes[:'code']
  end

  if attributes.has_key?(:'share_class')
    self.share_class = attributes[:'share_class']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'round_lot_size')
    self.round_lot_size = attributes[:'round_lot_size']
  end

  if attributes.has_key?(:'ticker')
    self.ticker = attributes[:'ticker']
  end

  if attributes.has_key?(:'exchange_ticker')
    self.exchange_ticker = attributes[:'exchange_ticker']
  end

  if attributes.has_key?(:'composite_ticker')
    self.composite_ticker = attributes[:'composite_ticker']
  end

  if attributes.has_key?(:'alternate_tickers')
    if (value = attributes[:'alternate_tickers']).is_a?(Array)
      self.alternate_tickers = value
    end
  end

  if attributes.has_key?(:'figi')
    self.figi = attributes[:'figi']
  end

  if attributes.has_key?(:'cik')
    self.cik = attributes[:'cik']
  end

  if attributes.has_key?(:'composite_figi')
    self.composite_figi = attributes[:'composite_figi']
  end

  if attributes.has_key?(:'share_class_figi')
    self.share_class_figi = attributes[:'share_class_figi']
  end

  if attributes.has_key?(:'figi_uniqueid')
    self.figi_uniqueid = attributes[:'figi_uniqueid']
  end

  if attributes.has_key?(:'active')
    self.active = attributes[:'active']
  end

  if attributes.has_key?(:'etf')
    self.etf = attributes[:'etf']
  end

  if attributes.has_key?(:'delisted')
    self.delisted = attributes[:'delisted']
  end

  if attributes.has_key?(:'primary_listing')
    self.primary_listing = attributes[:'primary_listing']
  end

  if attributes.has_key?(:'primary_security')
    self.primary_security = attributes[:'primary_security']
  end

  if attributes.has_key?(:'first_stock_price')
    self.first_stock_price = attributes[:'first_stock_price']
  end

  if attributes.has_key?(:'last_stock_price')
    self.last_stock_price = attributes[:'last_stock_price']
  end

  if attributes.has_key?(:'last_stock_price_adjustment')
    self.last_stock_price_adjustment = attributes[:'last_stock_price_adjustment']
  end

  if attributes.has_key?(:'last_corporate_action')
    self.last_corporate_action = attributes[:'last_corporate_action']
  end

  if attributes.has_key?(:'previous_tickers')
    if (value = attributes[:'previous_tickers']).is_a?(Array)
      self.previous_tickers = value
    end
  end

  if attributes.has_key?(:'listing_exchange_mic')
    self.listing_exchange_mic = attributes[:'listing_exchange_mic']
  end

end

Instance Attribute Details

#activeObject

If true, the Security is active and has been recently traded



70
71
72
# File 'lib/intrinio-sdk/models/security.rb', line 70

def active
  @active
end

#alternate_tickersObject

Alternate formats of the common ticker



52
53
54
# File 'lib/intrinio-sdk/models/security.rb', line 52

def alternate_tickers
  @alternate_tickers
end

#cikObject

Central Index Key issued by the SEC, which is the unique identifier for all owner filings



58
59
60
# File 'lib/intrinio-sdk/models/security.rb', line 58

def cik
  @cik
end

#codeObject

A 2-3 digit code classifying the Security (<a href="docs.intrinio.com/documentation/security_codes" target="_blank">reference</a>)



31
32
33
# File 'lib/intrinio-sdk/models/security.rb', line 31

def code
  @code
end

#company_idObject

The Intrinio ID for the company for which the Security is issued



22
23
24
# File 'lib/intrinio-sdk/models/security.rb', line 22

def company_id
  @company_id
end

#composite_figiObject

The country-composite OpenFIGI identifier



61
62
63
# File 'lib/intrinio-sdk/models/security.rb', line 61

def composite_figi
  @composite_figi
end

#composite_tickerObject

The country-composite ticker



49
50
51
# File 'lib/intrinio-sdk/models/security.rb', line 49

def composite_ticker
  @composite_ticker
end

#currencyObject

The currency in which the Security is traded on the exchange



37
38
39
# File 'lib/intrinio-sdk/models/security.rb', line 37

def currency
  @currency
end

#delistedObject

If true, the Security is no longer traded on the exchange



76
77
78
# File 'lib/intrinio-sdk/models/security.rb', line 76

def delisted
  @delisted
end

#etfObject

If true, this Security is an ETF



73
74
75
# File 'lib/intrinio-sdk/models/security.rb', line 73

def etf
  @etf
end

#exchange_tickerObject

The exchange-level ticker



46
47
48
# File 'lib/intrinio-sdk/models/security.rb', line 46

def exchange_ticker
  @exchange_ticker
end

#figiObject

The exchange-level OpenFIGI identifier



55
56
57
# File 'lib/intrinio-sdk/models/security.rb', line 55

def figi
  @figi
end

#figi_uniqueidObject

The OpenFIGI unique ID



67
68
69
# File 'lib/intrinio-sdk/models/security.rb', line 67

def figi_uniqueid
  @figi_uniqueid
end

#first_stock_priceObject

The date of the first recorded stock price



85
86
87
# File 'lib/intrinio-sdk/models/security.rb', line 85

def first_stock_price
  @first_stock_price
end

#idObject

The Intrinio ID for the Security



19
20
21
# File 'lib/intrinio-sdk/models/security.rb', line 19

def id
  @id
end

#last_corporate_actionObject

The date of the last corporate action



94
95
96
# File 'lib/intrinio-sdk/models/security.rb', line 94

def last_corporate_action
  @last_corporate_action
end

#last_stock_priceObject

The date of the last recorded stock price (or the most recent trading day)



88
89
90
# File 'lib/intrinio-sdk/models/security.rb', line 88

def last_stock_price
  @last_stock_price
end

#last_stock_price_adjustmentObject

The date of the last stock price adjustment (dividend, split, etc)



91
92
93
# File 'lib/intrinio-sdk/models/security.rb', line 91

def last_stock_price_adjustment
  @last_stock_price_adjustment
end

#listing_exchange_micObject

The MIC code of the exchange on which this security primarily trades



100
101
102
# File 'lib/intrinio-sdk/models/security.rb', line 100

def listing_exchange_mic
  @listing_exchange_mic
end

#nameObject

The name of the Security



25
26
27
# File 'lib/intrinio-sdk/models/security.rb', line 25

def name
  @name
end

#previous_tickersObject

Previous tickers used by this security



97
98
99
# File 'lib/intrinio-sdk/models/security.rb', line 97

def previous_tickers
  @previous_tickers
end

#primary_listingObject

If true, the Security is the primary issue for the company, otherwise it is a secondary issue on a secondary stock exchange



79
80
81
# File 'lib/intrinio-sdk/models/security.rb', line 79

def primary_listing
  @primary_listing
end

#primary_securityObject

If true, the Security is considered by Intrinio to be the primary Security for its company



82
83
84
# File 'lib/intrinio-sdk/models/security.rb', line 82

def primary_security
  @primary_security
end

#round_lot_sizeObject

The normal unit of trading



40
41
42
# File 'lib/intrinio-sdk/models/security.rb', line 40

def round_lot_size
  @round_lot_size
end

#share_classObject

The Security’s share class (if applicable)



34
35
36
# File 'lib/intrinio-sdk/models/security.rb', line 34

def share_class
  @share_class
end

#share_class_figiObject

The global-composite OpenFIGI identifier



64
65
66
# File 'lib/intrinio-sdk/models/security.rb', line 64

def share_class_figi
  @share_class_figi
end

#tickerObject

The common ticker



43
44
45
# File 'lib/intrinio-sdk/models/security.rb', line 43

def ticker
  @ticker
end

#typeObject

The Security’s type



28
29
30
# File 'lib/intrinio-sdk/models/security.rb', line 28

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/intrinio-sdk/models/security.rb', line 104

def self.attribute_map
  {
    :'id' => :'id',
    :'company_id' => :'company_id',
    :'name' => :'name',
    :'type' => :'type',
    :'code' => :'code',
    :'share_class' => :'share_class',
    :'currency' => :'currency',
    :'round_lot_size' => :'round_lot_size',
    :'ticker' => :'ticker',
    :'exchange_ticker' => :'exchange_ticker',
    :'composite_ticker' => :'composite_ticker',
    :'alternate_tickers' => :'alternate_tickers',
    :'figi' => :'figi',
    :'cik' => :'cik',
    :'composite_figi' => :'composite_figi',
    :'share_class_figi' => :'share_class_figi',
    :'figi_uniqueid' => :'figi_uniqueid',
    :'active' => :'active',
    :'etf' => :'etf',
    :'delisted' => :'delisted',
    :'primary_listing' => :'primary_listing',
    :'primary_security' => :'primary_security',
    :'first_stock_price' => :'first_stock_price',
    :'last_stock_price' => :'last_stock_price',
    :'last_stock_price_adjustment' => :'last_stock_price_adjustment',
    :'last_corporate_action' => :'last_corporate_action',
    :'previous_tickers' => :'previous_tickers',
    :'listing_exchange_mic' => :'listing_exchange_mic'
  }
end

.swagger_typesObject

Attribute type mapping.



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
166
167
168
169
# File 'lib/intrinio-sdk/models/security.rb', line 138

def self.swagger_types
  {
    :'id' => :'String',
    :'company_id' => :'String',
    :'name' => :'String',
    :'type' => :'String',
    :'code' => :'String',
    :'share_class' => :'String',
    :'currency' => :'String',
    :'round_lot_size' => :'Float',
    :'ticker' => :'String',
    :'exchange_ticker' => :'String',
    :'composite_ticker' => :'String',
    :'alternate_tickers' => :'Array<String>',
    :'figi' => :'String',
    :'cik' => :'String',
    :'composite_figi' => :'String',
    :'share_class_figi' => :'String',
    :'figi_uniqueid' => :'String',
    :'active' => :'BOOLEAN',
    :'etf' => :'BOOLEAN',
    :'delisted' => :'BOOLEAN',
    :'primary_listing' => :'BOOLEAN',
    :'primary_security' => :'BOOLEAN',
    :'first_stock_price' => :'Date',
    :'last_stock_price' => :'Date',
    :'last_stock_price_adjustment' => :'Date',
    :'last_corporate_action' => :'Date',
    :'previous_tickers' => :'Array<String>',
    :'listing_exchange_mic' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/intrinio-sdk/models/security.rb', line 312

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      company_id == o.company_id &&
      name == o.name &&
      type == o.type &&
      code == o.code &&
      share_class == o.share_class &&
      currency == o.currency &&
      round_lot_size == o.round_lot_size &&
      ticker == o.ticker &&
      exchange_ticker == o.exchange_ticker &&
      composite_ticker == o.composite_ticker &&
      alternate_tickers == o.alternate_tickers &&
      figi == o.figi &&
      cik == o.cik &&
      composite_figi == o.composite_figi &&
      share_class_figi == o.share_class_figi &&
      figi_uniqueid == o.figi_uniqueid &&
      active == o.active &&
      etf == o.etf &&
      delisted == o.delisted &&
      primary_listing == o.primary_listing &&
      primary_security == o.primary_security &&
      first_stock_price == o.first_stock_price &&
      last_stock_price == o.last_stock_price &&
      last_stock_price_adjustment == o.last_stock_price_adjustment &&
      last_corporate_action == o.last_corporate_action &&
      previous_tickers == o.previous_tickers &&
      listing_exchange_mic == o.listing_exchange_mic
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/intrinio-sdk/models/security.rb', line 381

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Intrinio.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/intrinio-sdk/models/security.rb', line 447

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/intrinio-sdk/models/security.rb', line 360

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


347
348
349
# File 'lib/intrinio-sdk/models/security.rb', line 347

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



353
354
355
# File 'lib/intrinio-sdk/models/security.rb', line 353

def hash
  [id, company_id, name, type, code, share_class, currency, round_lot_size, ticker, exchange_ticker, composite_ticker, alternate_tickers, figi, cik, composite_figi, share_class_figi, figi_uniqueid, active, etf, delisted, primary_listing, primary_security, first_stock_price, last_stock_price, last_stock_price_adjustment, last_corporate_action, previous_tickers, listing_exchange_mic].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



299
300
301
302
# File 'lib/intrinio-sdk/models/security.rb', line 299

def list_invalid_properties
  invalid_properties = Array.new
  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



427
428
429
# File 'lib/intrinio-sdk/models/security.rb', line 427

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



433
434
435
436
437
438
439
440
441
# File 'lib/intrinio-sdk/models/security.rb', line 433

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



421
422
423
# File 'lib/intrinio-sdk/models/security.rb', line 421

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



306
307
308
# File 'lib/intrinio-sdk/models/security.rb', line 306

def valid?
  return true
end