Class: Intrinio::ApiResponseSecurityQuote

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

Overview

A realtime price quote of a security.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ApiResponseSecurityQuote

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 168

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?(:'security')
    self.security = attributes[:'security']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#adj_close_180_days_agoObject

The adjusted close price 180 days ago.



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

def adj_close_180_days_ago
  @adj_close_180_days_ago
end

#adj_close_1825_days_agoObject

The adjusted close price 1825 days ago.



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

def adj_close_1825_days_ago
  @adj_close_1825_days_ago
end

#adj_close_30_days_agoObject

The adjusted close price 30 days ago.



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

def adj_close_30_days_ago
  @adj_close_30_days_ago
end

#adj_close_365_days_agoObject

The adjusted close price 365 days ago.



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

def adj_close_365_days_ago
  @adj_close_365_days_ago
end

#adj_close_5_days_agoObject

The adjusted close price 5 days ago.



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

def adj_close_5_days_ago
  @adj_close_5_days_ago
end

#changeObject

The difference in last price from the last close price



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

def change
  @change
end

#change_percentObject

The percent difference in last price from the last close price



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

def change_percent
  @change_percent
end

#change_percent_180_daysObject

The percent change from the adjusted price 180 days ago to now.



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

def change_percent_180_days
  @change_percent_180_days
end

#change_percent_1825_daysObject

The percent change from the adjusted price 1825 days ago to now.



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

def change_percent_1825_days
  @change_percent_1825_days
end

#change_percent_30_daysObject

The percent change from the adjusted price 30 days ago to now.



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

def change_percent_30_days
  @change_percent_30_days
end

#change_percent_365_daysObject

The percent change from the adjusted price 365 days ago to now.



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

def change_percent_365_days
  @change_percent_365_days
end

#change_percent_5_daysObject

The percent change from the adjusted price 5 days ago to now.



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

def change_percent_5_days
  @change_percent_5_days
end

#eod_fifty_two_week_highObject

The 52 week high price.



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

def eod_fifty_two_week_high
  @eod_fifty_two_week_high
end

#eod_fifty_two_week_lowObject

The 52 week low price.



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

def eod_fifty_two_week_low
  @eod_fifty_two_week_low
end

#exchange_volumeObject

The volume of the security from the source.



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

def exchange_volume
  @exchange_volume
end

#highObject

The highest price from the latest day of trading.



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

def high
  @high
end

#lastObject

The price of the latest trade



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

def last
  @last
end

#last_timeObject

The date and time when the last trade occurred.



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

def last_time
  @last_time
end

#lowObject

The lowest price from the latest day of trading.



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

def low
  @low
end

#market_volumeObject

The volume of the security for the entire market.



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

def market_volume
  @market_volume
end

#marketcapObject

The current market cap.



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

def marketcap
  @marketcap
end

#openObject

The open price from the latest day of trading.



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

def open
  @open
end

#previous_closeObject

The previous close price.



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

def previous_close
  @previous_close
end

#previous_close_dateObject

The date of the previous close.



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

def previous_close_date
  @previous_close_date
end

#pricetoearningsObject

The current price to earnings.



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

def pricetoearnings
  @pricetoearnings
end

#securityObject

The Security of the stock quote



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

def security
  @security
end

#sourceObject

The source of the pricing data.



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

def source
  @source
end

Class Method Details

.attribute_mapObject

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



101
102
103
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
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 101

def self.attribute_map
  {
    :'security' => :'security',
    :'last' => :'last',
    :'last_time' => :'last_time',
    :'source' => :'source',
    :'open' => :'open',
    :'high' => :'high',
    :'low' => :'low',
    :'exchange_volume' => :'exchange_volume',
    :'market_volume' => :'market_volume',
    :'eod_fifty_two_week_high' => :'eod_fifty_two_week_high',
    :'eod_fifty_two_week_low' => :'eod_fifty_two_week_low',
    :'marketcap' => :'marketcap',
    :'pricetoearnings' => :'pricetoearnings',
    :'previous_close' => :'previous_close',
    :'previous_close_date' => :'previous_close_date',
    :'change' => :'change',
    :'change_percent' => :'change_percent',
    :'adj_close_5_days_ago' => :'adj_close_5_days_ago',
    :'adj_close_30_days_ago' => :'adj_close_30_days_ago',
    :'adj_close_180_days_ago' => :'adj_close_180_days_ago',
    :'adj_close_365_days_ago' => :'adj_close_365_days_ago',
    :'adj_close_1825_days_ago' => :'adj_close_1825_days_ago',
    :'change_percent_5_days' => :'change_percent_5_days',
    :'change_percent_30_days' => :'change_percent_30_days',
    :'change_percent_180_days' => :'change_percent_180_days',
    :'change_percent_365_days' => :'change_percent_365_days',
    :'change_percent_1825_days' => :'change_percent_1825_days'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 134

def self.swagger_types
  {
    :'security' => :'SecuritySummary',
    :'last' => :'Float',
    :'last_time' => :'DateTime',
    :'source' => :'String',
    :'open' => :'Float',
    :'high' => :'Float',
    :'low' => :'Float',
    :'exchange_volume' => :'Float',
    :'market_volume' => :'Float',
    :'eod_fifty_two_week_high' => :'Float',
    :'eod_fifty_two_week_low' => :'Float',
    :'marketcap' => :'Float',
    :'pricetoearnings' => :'Float',
    :'previous_close' => :'Float',
    :'previous_close_date' => :'Date',
    :'change' => :'Float',
    :'change_percent' => :'Float',
    :'adj_close_5_days_ago' => :'Float',
    :'adj_close_30_days_ago' => :'Float',
    :'adj_close_180_days_ago' => :'Float',
    :'adj_close_365_days_ago' => :'Float',
    :'adj_close_1825_days_ago' => :'Float',
    :'change_percent_5_days' => :'Float',
    :'change_percent_30_days' => :'Float',
    :'change_percent_180_days' => :'Float',
    :'change_percent_365_days' => :'Float',
    :'change_percent_1825_days' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 299

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      security == o.security &&
      last == o.last &&
      last_time == o.last_time &&
      source == o.source &&
      open == o.open &&
      high == o.high &&
      low == o.low &&
      exchange_volume == o.exchange_volume &&
      market_volume == o.market_volume &&
      eod_fifty_two_week_high == o.eod_fifty_two_week_high &&
      eod_fifty_two_week_low == o.eod_fifty_two_week_low &&
      marketcap == o.marketcap &&
      pricetoearnings == o.pricetoearnings &&
      previous_close == o.previous_close &&
      previous_close_date == o.previous_close_date &&
      change == o.change &&
      change_percent == o.change_percent &&
      adj_close_5_days_ago == o.adj_close_5_days_ago &&
      adj_close_30_days_ago == o.adj_close_30_days_ago &&
      adj_close_180_days_ago == o.adj_close_180_days_ago &&
      adj_close_365_days_ago == o.adj_close_365_days_ago &&
      adj_close_1825_days_ago == o.adj_close_1825_days_ago &&
      change_percent_5_days == o.change_percent_5_days &&
      change_percent_30_days == o.change_percent_30_days &&
      change_percent_180_days == o.change_percent_180_days &&
      change_percent_365_days == o.change_percent_365_days &&
      change_percent_1825_days == o.change_percent_1825_days
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



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 367

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



433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 433

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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 346

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


333
334
335
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 333

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



339
340
341
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 339

def hash
  [security, last, last_time, source, open, high, low, exchange_volume, market_volume, eod_fifty_two_week_high, eod_fifty_two_week_low, marketcap, pricetoearnings, previous_close, previous_close_date, change, change_percent, adj_close_5_days_ago, adj_close_30_days_ago, adj_close_180_days_ago, adj_close_365_days_ago, adj_close_1825_days_ago, change_percent_5_days, change_percent_30_days, change_percent_180_days, change_percent_365_days, change_percent_1825_days].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



286
287
288
289
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 286

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



413
414
415
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 413

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



419
420
421
422
423
424
425
426
427
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 419

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



407
408
409
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 407

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



293
294
295
# File 'lib/intrinio-sdk/models/api_response_security_quote.rb', line 293

def valid?
  return true
end