Class: SchwabRb::DataObjects::IndexQuote

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) ⇒ IndexQuote



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

def initialize(data)
  @symbol = data[:symbol]
  @asset_main_type = data[:assetMainType]
  @realtime = data[:realtime]
  @ssid = data[:ssid]
  @avg_10_days_volume = data.dig(:fundamental, :avg10DaysVolume)
  @avg_1_year_volume = data.dig(:fundamental, :avg1YearVolume)
  @div_amount = data.dig(:fundamental, :divAmount)
  @div_freq = data.dig(:fundamental, :divFreq)
  @div_pay_amount = data.dig(:fundamental, :divPayAmount)
  @div_yield = data.dig(:fundamental, :divYield)
  @eps = data.dig(:fundamental, :eps)
  @fund_leverage_factor = data.dig(:fundamental, :fundLeverageFactor)
  @pe_ratio = data.dig(:fundamental, :peRatio)
  @quote_52_week_high = data.dig(:quote, :"52WeekHigh")
  @quote_52_week_low = data.dig(:quote, :"52WeekLow")
  @close_price = data.dig(:quote, :closePrice)
  @high_price = data.dig(:quote, :highPrice)
  @last_price = data.dig(:quote, :lastPrice)
  @low_price = data.dig(:quote, :lowPrice)
  @net_change = data.dig(:quote, :netChange)
  @net_percent_change = data.dig(:quote, :netPercentChange)
  @open_price = data.dig(:quote, :openPrice)
  @security_status = data.dig(:quote, :securityStatus)
  @total_volume = data.dig(:quote, :totalVolume)
  @trade_time = data.dig(:quote, :tradeTime)
  @description = data.dig(:reference, :description)
  @exchange = data.dig(:reference, :exchange)
  @exchange_name = data.dig(:reference, :exchangeName)
end

Instance Attribute Details

#asset_main_typeObject (readonly)

Returns the value of attribute asset_main_type.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def asset_main_type
  @asset_main_type
end

#avg_10_days_volumeObject (readonly)

Returns the value of attribute avg_10_days_volume.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def avg_10_days_volume
  @avg_10_days_volume
end

#avg_1_year_volumeObject (readonly)

Returns the value of attribute avg_1_year_volume.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def avg_1_year_volume
  @avg_1_year_volume
end

#close_priceObject (readonly)

Returns the value of attribute close_price.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def close_price
  @close_price
end

#descriptionObject (readonly)

Returns the value of attribute description.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def description
  @description
end

#div_amountObject (readonly)

Returns the value of attribute div_amount.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def div_amount
  @div_amount
end

#div_freqObject (readonly)

Returns the value of attribute div_freq.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def div_freq
  @div_freq
end

#div_pay_amountObject (readonly)

Returns the value of attribute div_pay_amount.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def div_pay_amount
  @div_pay_amount
end

#div_yieldObject (readonly)

Returns the value of attribute div_yield.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def div_yield
  @div_yield
end

#epsObject (readonly)

Returns the value of attribute eps.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def eps
  @eps
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def exchange
  @exchange
end

#exchange_nameObject (readonly)

Returns the value of attribute exchange_name.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def exchange_name
  @exchange_name
end

#fund_leverage_factorObject (readonly)

Returns the value of attribute fund_leverage_factor.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def fund_leverage_factor
  @fund_leverage_factor
end

#high_priceObject (readonly)

Returns the value of attribute high_price.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def high_price
  @high_price
end

#last_priceObject (readonly)

Returns the value of attribute last_price.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def last_price
  @last_price
end

#low_priceObject (readonly)

Returns the value of attribute low_price.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def low_price
  @low_price
end

#net_changeObject (readonly)

Returns the value of attribute net_change.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def net_change
  @net_change
end

#net_percent_changeObject (readonly)

Returns the value of attribute net_percent_change.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def net_percent_change
  @net_percent_change
end

#open_priceObject (readonly)

Returns the value of attribute open_price.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def open_price
  @open_price
end

#pe_ratioObject (readonly)

Returns the value of attribute pe_ratio.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def pe_ratio
  @pe_ratio
end

#quote_52_week_highObject (readonly)

Returns the value of attribute quote_52_week_high.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def quote_52_week_high
  @quote_52_week_high
end

#quote_52_week_lowObject (readonly)

Returns the value of attribute quote_52_week_low.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def quote_52_week_low
  @quote_52_week_low
end

#realtimeObject (readonly)

Returns the value of attribute realtime.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def realtime
  @realtime
end

#security_statusObject (readonly)

Returns the value of attribute security_status.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def security_status
  @security_status
end

#ssidObject (readonly)

Returns the value of attribute ssid.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def ssid
  @ssid
end

#symbolObject (readonly)

Returns the value of attribute symbol.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def symbol
  @symbol
end

#total_volumeObject (readonly)

Returns the value of attribute total_volume.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def total_volume
  @total_volume
end

#trade_timeObject (readonly)

Returns the value of attribute trade_time.



102
103
104
# File 'lib/schwab_rb/data_objects/quote.rb', line 102

def trade_time
  @trade_time
end

Instance Method Details

#markObject



136
137
138
# File 'lib/schwab_rb/data_objects/quote.rb', line 136

def mark
  (@high_price + @low_price) / 2.0
end