Class: SchwabRb::DataObjects::EquityQuote

Inherits:
Object
  • Object
show all
Defined in:
lib/schwab_rb/data_objects/quote.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ EquityQuote

Returns a new instance of EquityQuote.



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
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
# File 'lib/schwab_rb/data_objects/quote.rb', line 145

def initialize(data)
  @symbol = data[:symbol]
  @asset_main_type = data[:assetMainType]
  @asset_sub_type = data[:assetSubType]
  @quote_type = data[:quoteType]
  @realtime = data[:realtime]
  @ssid = data[:ssid]
  @extended_ask_price = data.dig(:extended, :askPrice)
  @extended_ask_size = data.dig(:extended, :askSize)
  @extended_bid_price = data.dig(:extended, :bidPrice)
  @extended_bid_size = data.dig(:extended, :bidSize)
  @extended_last_price = data.dig(:extended, :lastPrice)
  @extended_last_size = data.dig(:extended, :lastSize)
  @extended_mark = data.dig(:extended, :mark)
  @extended_quote_time = data.dig(:extended, :quoteTime)
  @extended_total_volume = data.dig(:extended, :totalVolume)
  @extended_trade_time = data.dig(:extended, :tradeTime)
  @avg_10_days_volume = data.dig(:fundamental, :avg10DaysVolume)
  @avg_1_year_volume = data.dig(:fundamental, :avg1YearVolume)
  @declaration_date = data.dig(:fundamental, :declarationDate)
  @div_amount = data.dig(:fundamental, :divAmount)
  @div_ex_date = data.dig(:fundamental, :divExDate)
  @div_freq = data.dig(:fundamental, :divFreq)
  @div_pay_amount = data.dig(:fundamental, :divPayAmount)
  @div_pay_date = data.dig(:fundamental, :divPayDate)
  @div_yield = data.dig(:fundamental, :divYield)
  @eps = data.dig(:fundamental, :eps)
  @fund_leverage_factor = data.dig(:fundamental, :fundLeverageFactor)
  @last_earnings_date = data.dig(:fundamental, :lastEarningsDate)
  @next_div_ex_date = data.dig(:fundamental, :nextDivExDate)
  @next_div_pay_date = data.dig(:fundamental, :nextDivPayDate)
  @pe_ratio = data.dig(:fundamental, :peRatio)
  @quote_52_week_high = data.dig(:quote, :"52WeekHigh")
  @quote_52_week_low = data.dig(:quote, :"52WeekLow")
  @ask_mic_id = data.dig(:quote, :askMICId)
  @ask_price = data.dig(:quote, :askPrice)
  @ask_size = data.dig(:quote, :askSize)
  @ask_time = data.dig(:quote, :askTime)
  @bid_mic_id = data.dig(:quote, :bidMICId)
  @bid_price = data.dig(:quote, :bidPrice)
  @bid_size = data.dig(:quote, :bidSize)
  @bid_time = data.dig(:quote, :bidTime)
  @close_price = data.dig(:quote, :closePrice)
  @high_price = data.dig(:quote, :highPrice)
  @last_mic_id = data.dig(:quote, :lastMICId)
  @last_price = data.dig(:quote, :lastPrice)
  @last_size = data.dig(:quote, :lastSize)
  @low_price = data.dig(:quote, :lowPrice)
  @mark = data.dig(:quote, :mark)
  @mark_change = data.dig(:quote, :markChange)
  @mark_percent_change = data.dig(:quote, :markPercentChange)
  @net_change = data.dig(:quote, :netChange)
  @net_percent_change = data.dig(:quote, :netPercentChange)
  @open_price = data.dig(:quote, :openPrice)
  @post_market_change = data.dig(:quote, :postMarketChange)
  @post_market_percent_change = data.dig(:quote, :postMarketPercentChange)
  @quote_time = data.dig(:quote, :quoteTime)
  @security_status = data.dig(:quote, :securityStatus)
  @total_volume = data.dig(:quote, :totalVolume)
  @trade_time = data.dig(:quote, :tradeTime)
  @cusip = data.dig(:reference, :cusip)
  @description = data.dig(:reference, :description)
  @exchange = data.dig(:reference, :exchange)
  @exchange_name = data.dig(:reference, :exchangeName)
  @is_hard_to_borrow = data.dig(:reference, :isHardToBorrow)
  @is_shortable = data.dig(:reference, :isShortable)
  @htb_rate = data.dig(:reference, :htbRate)
  @market_last_price = data.dig(:regular, :regularMarketLastPrice)
  @market_last_size = data.dig(:regular, :regularMarketLastSize)
  @market_net_change = data.dig(:regular, :regularMarketNetChange)
  @market_percent_change = data.dig(:regular, :regularMarketPercentChange)
  @market_trade_time = data.dig(:regular, :regularMarketTradeTime)
end

Instance Attribute Details

#ask_mic_idObject (readonly)

Returns the value of attribute ask_mic_id.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def ask_mic_id
  @ask_mic_id
end

#ask_priceObject (readonly)

Returns the value of attribute ask_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def ask_price
  @ask_price
end

#ask_sizeObject (readonly)

Returns the value of attribute ask_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def ask_size
  @ask_size
end

#ask_timeObject (readonly)

Returns the value of attribute ask_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def ask_time
  @ask_time
end

#asset_main_typeObject (readonly)

Returns the value of attribute asset_main_type.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def asset_main_type
  @asset_main_type
end

#asset_sub_typeObject (readonly)

Returns the value of attribute asset_sub_type.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def asset_sub_type
  @asset_sub_type
end

#avg_10_days_volumeObject (readonly)

Returns the value of attribute avg_10_days_volume.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def avg_10_days_volume
  @avg_10_days_volume
end

#avg_1_year_volumeObject (readonly)

Returns the value of attribute avg_1_year_volume.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def avg_1_year_volume
  @avg_1_year_volume
end

#bid_mic_idObject (readonly)

Returns the value of attribute bid_mic_id.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def bid_mic_id
  @bid_mic_id
end

#bid_priceObject (readonly)

Returns the value of attribute bid_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def bid_price
  @bid_price
end

#bid_sizeObject (readonly)

Returns the value of attribute bid_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def bid_size
  @bid_size
end

#bid_timeObject (readonly)

Returns the value of attribute bid_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def bid_time
  @bid_time
end

#close_priceObject (readonly)

Returns the value of attribute close_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def close_price
  @close_price
end

#cusipObject (readonly)

Returns the value of attribute cusip.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def cusip
  @cusip
end

#declaration_dateObject (readonly)

Returns the value of attribute declaration_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def declaration_date
  @declaration_date
end

#descriptionObject (readonly)

Returns the value of attribute description.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def description
  @description
end

#div_amountObject (readonly)

Returns the value of attribute div_amount.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_amount
  @div_amount
end

#div_ex_dateObject (readonly)

Returns the value of attribute div_ex_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_ex_date
  @div_ex_date
end

#div_freqObject (readonly)

Returns the value of attribute div_freq.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_freq
  @div_freq
end

#div_pay_amountObject (readonly)

Returns the value of attribute div_pay_amount.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_pay_amount
  @div_pay_amount
end

#div_pay_dateObject (readonly)

Returns the value of attribute div_pay_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_pay_date
  @div_pay_date
end

#div_yieldObject (readonly)

Returns the value of attribute div_yield.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def div_yield
  @div_yield
end

#epsObject (readonly)

Returns the value of attribute eps.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def eps
  @eps
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def exchange
  @exchange
end

#exchange_nameObject (readonly)

Returns the value of attribute exchange_name.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def exchange_name
  @exchange_name
end

#extended_ask_priceObject (readonly)

Returns the value of attribute extended_ask_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_ask_price
  @extended_ask_price
end

#extended_ask_sizeObject (readonly)

Returns the value of attribute extended_ask_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_ask_size
  @extended_ask_size
end

#extended_bid_priceObject (readonly)

Returns the value of attribute extended_bid_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_bid_price
  @extended_bid_price
end

#extended_bid_sizeObject (readonly)

Returns the value of attribute extended_bid_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_bid_size
  @extended_bid_size
end

#extended_last_priceObject (readonly)

Returns the value of attribute extended_last_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_last_price
  @extended_last_price
end

#extended_last_sizeObject (readonly)

Returns the value of attribute extended_last_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_last_size
  @extended_last_size
end

#extended_markObject (readonly)

Returns the value of attribute extended_mark.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_mark
  @extended_mark
end

#extended_quote_timeObject (readonly)

Returns the value of attribute extended_quote_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_quote_time
  @extended_quote_time
end

#extended_total_volumeObject (readonly)

Returns the value of attribute extended_total_volume.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_total_volume
  @extended_total_volume
end

#extended_trade_timeObject (readonly)

Returns the value of attribute extended_trade_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def extended_trade_time
  @extended_trade_time
end

#fund_leverage_factorObject (readonly)

Returns the value of attribute fund_leverage_factor.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def fund_leverage_factor
  @fund_leverage_factor
end

#high_priceObject (readonly)

Returns the value of attribute high_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def high_price
  @high_price
end

#htb_rateObject (readonly)

Returns the value of attribute htb_rate.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def htb_rate
  @htb_rate
end

#is_hard_to_borrowObject (readonly)

Returns the value of attribute is_hard_to_borrow.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def is_hard_to_borrow
  @is_hard_to_borrow
end

#is_shortableObject (readonly)

Returns the value of attribute is_shortable.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def is_shortable
  @is_shortable
end

#last_earnings_dateObject (readonly)

Returns the value of attribute last_earnings_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def last_earnings_date
  @last_earnings_date
end

#last_mic_idObject (readonly)

Returns the value of attribute last_mic_id.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def last_mic_id
  @last_mic_id
end

#last_priceObject (readonly)

Returns the value of attribute last_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def last_price
  @last_price
end

#last_sizeObject (readonly)

Returns the value of attribute last_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def last_size
  @last_size
end

#low_priceObject (readonly)

Returns the value of attribute low_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def low_price
  @low_price
end

#markObject (readonly)

Returns the value of attribute mark.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def mark
  @mark
end

#mark_changeObject (readonly)

Returns the value of attribute mark_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def mark_change
  @mark_change
end

#mark_percent_changeObject (readonly)

Returns the value of attribute mark_percent_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def mark_percent_change
  @mark_percent_change
end

#market_last_priceObject (readonly)

Returns the value of attribute market_last_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def market_last_price
  @market_last_price
end

#market_last_sizeObject (readonly)

Returns the value of attribute market_last_size.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def market_last_size
  @market_last_size
end

#market_net_changeObject (readonly)

Returns the value of attribute market_net_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def market_net_change
  @market_net_change
end

#market_percent_changeObject (readonly)

Returns the value of attribute market_percent_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def market_percent_change
  @market_percent_change
end

#market_trade_timeObject (readonly)

Returns the value of attribute market_trade_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def market_trade_time
  @market_trade_time
end

#net_changeObject (readonly)

Returns the value of attribute net_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def net_change
  @net_change
end

#net_percent_changeObject (readonly)

Returns the value of attribute net_percent_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def net_percent_change
  @net_percent_change
end

#next_div_ex_dateObject (readonly)

Returns the value of attribute next_div_ex_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def next_div_ex_date
  @next_div_ex_date
end

#next_div_pay_dateObject (readonly)

Returns the value of attribute next_div_pay_date.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def next_div_pay_date
  @next_div_pay_date
end

#open_priceObject (readonly)

Returns the value of attribute open_price.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def open_price
  @open_price
end

#pe_ratioObject (readonly)

Returns the value of attribute pe_ratio.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def pe_ratio
  @pe_ratio
end

#post_market_changeObject (readonly)

Returns the value of attribute post_market_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def post_market_change
  @post_market_change
end

#post_market_percent_changeObject (readonly)

Returns the value of attribute post_market_percent_change.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def post_market_percent_change
  @post_market_percent_change
end

#quote_52_week_highObject (readonly)

Returns the value of attribute quote_52_week_high.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def quote_52_week_high
  @quote_52_week_high
end

#quote_52_week_lowObject (readonly)

Returns the value of attribute quote_52_week_low.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def quote_52_week_low
  @quote_52_week_low
end

#quote_typeObject (readonly)

Returns the value of attribute quote_type.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def quote_type
  @quote_type
end

#realtimeObject (readonly)

Returns the value of attribute realtime.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def realtime
  @realtime
end

#security_statusObject (readonly)

Returns the value of attribute security_status.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def security_status
  @security_status
end

#ssidObject (readonly)

Returns the value of attribute ssid.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def ssid
  @ssid
end

#symbolObject (readonly)

Returns the value of attribute symbol.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def symbol
  @symbol
end

#timeObject (readonly)

Returns the value of attribute time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def time
  @time
end

#total_volumeObject (readonly)

Returns the value of attribute total_volume.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def total_volume
  @total_volume
end

#trade_timeObject (readonly)

Returns the value of attribute trade_time.



142
143
144
# File 'lib/schwab_rb/data_objects/quote.rb', line 142

def trade_time
  @trade_time
end

Instance Method Details

#to_hObject



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
# File 'lib/schwab_rb/data_objects/quote.rb', line 219

def to_h
  {
    symbol: @symbol,
    asset_main_type: @asset_main_type,
    asset_sub_type: @asset_sub_type,
    quote_type: @quote_type,
    realtime: @realtime,
    ssid: @ssid,
    extended_ask_price: @extended_ask_price,
    extended_ask_size: @extended_ask_size,
    extended_bid_price: @extended_bid_price,
    extended_bid_size: @extended_bid_size,
    extended_last_price: @extended_last_price,
    extended_last_size: @extended_last_size,
    extended_mark: @extended_mark,
    extended_quote_time: @extended_quote_time,
    extended_total_volume: @extended_total_volume,
    extended_trade_time: @extended_trade_time,
    avg_10_days_volume: @avg_10_days_volume,
    avg_1_year_volume: @avg_1_year_volume,
    declaration_date: @declaration_date,
    div_amount: @div_amount,
    div_ex_date: @div_ex_date,
    div_freq: @div_freq,
    div_pay_amount: @div_pay_amount,
    div_pay_date: @div_pay_date,
    div_yield: @div_yield,
    eps: @eps,
    fund_leverage_factor: @fund_leverage_factor,
    last_earnings_date: @last_earnings_date,
    next_div_ex_date: @next_div_ex_date,
    next_div_pay_date: @next_div_pay_date,
    pe_ratio: @pe_ratio,
    quote_52_week_high: @quote_52_week_high,
    quote_52_week_low: @quote_52_week_low,
    ask_mic_id: @ask_mic_id,
    ask_price: @ask_price,
    ask_size: @ask_size,
    ask_time: @ask_time,
    bid_mic_id: @bid_mic_id,
    bid_price: @bid_price,
    bid_size: @bid_size,
    bid_time: @bid_time,
    close_price: @close_price,
    high_price: @high_price,
    last_mic_id: @last_mic_id,
    last_price: @last_price,
    last_size: @last_size,
    low_price: @low_price
  }
end

#to_sObject



271
272
273
# File 'lib/schwab_rb/data_objects/quote.rb', line 271

def to_s
  "<EquityQuote symbol: #{@symbol}, last_price: #{@last_price}, mark: #{@mark}, market_last_price: #{@market_last_price}, extended_bid_price: #{@extended_bid_price}>"
end