Class: StockMarkit::Quote
- Inherits:
-
Object
- Object
- StockMarkit::Quote
- Includes:
- HTTParty
- Defined in:
- lib/stock-markit/quote.rb
Overview
Stock Quote
- Copyright
-
Copyright © 2016 Michael Heijmans
- License
-
MIT
Instance Attribute Summary collapse
-
#change ⇒ Float
readonly
The change in price of the company’s stock since the previous trading day’s close.
-
#change_percent ⇒ Float
readonly
The change percent in price of the company’s stock since the previous trading day’s close.
-
#change_percent_ytd ⇒ Float
readonly
The change percent in price of the company’s stock since the start of the year.
-
#change_ytd ⇒ Float
readonly
The change in price of the company’s stock since the start of the year.
-
#high ⇒ Float
readonly
The high price of the company’s stock in the trading session.
-
#last_price ⇒ Float
readonly
The last price of the company’s stock.
-
#low ⇒ Float
readonly
The low price of the company’s stock in the trading session.
-
#market_cap ⇒ Integer
readonly
The company’s market cap.
-
#ms_date ⇒ Float
readonly
The last time the company’s stock was traded in exchange-local timezone.
-
#name ⇒ String
readonly
The company name.
-
#open ⇒ Float
readonly
The opening price of the company’s stock at the start of the trading session.
-
#status ⇒ String
readonly
The status from the api call.
-
#symbol ⇒ String, Symbol
readonly
The ticker symbol of the company.
-
#timestamp ⇒ Time
readonly
The last time the company’s stock was traded.
-
#volume ⇒ Integer
readonly
The trade volume of the company’s stock.
Instance Method Summary collapse
- #fetch ⇒ self, False
-
#initialize(symbol) ⇒ Quote
constructor
A new instance of Quote.
- #update ⇒ self, False
Constructor Details
#initialize(symbol) ⇒ Quote
Returns a new instance of Quote.
41 42 43 44 |
# File 'lib/stock-markit/quote.rb', line 41 def initialize(symbol) @symbol = symbol.to_sym.upcase @options = { query: {symbol: @symbol} } end |
Instance Attribute Details
#change ⇒ Float (readonly)
The change in price of the company’s stock since the previous trading day’s close
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def change @change end |
#change_percent ⇒ Float (readonly)
The change percent in price of the company’s stock since the previous trading day’s close
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def change_percent @change_percent end |
#change_percent_ytd ⇒ Float (readonly)
The change percent in price of the company’s stock since the start of the year
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def change_percent_ytd @change_percent_ytd end |
#change_ytd ⇒ Float (readonly)
The change in price of the company’s stock since the start of the year
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def change_ytd @change_ytd end |
#high ⇒ Float (readonly)
The high price of the company’s stock in the trading session
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def high @high end |
#last_price ⇒ Float (readonly)
The last price of the company’s stock
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def last_price @last_price end |
#low ⇒ Float (readonly)
The low price of the company’s stock in the trading session
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def low @low end |
#market_cap ⇒ Integer (readonly)
The company’s market cap
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def market_cap @market_cap end |
#ms_date ⇒ Float (readonly)
The last time the company’s stock was traded in exchange-local timezone. Represented as an OLE Automation date.
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def ms_date @ms_date end |
#name ⇒ String (readonly)
The company name
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def name @name end |
#open ⇒ Float (readonly)
The opening price of the company’s stock at the start of the trading session
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def open @open end |
#status ⇒ String (readonly)
The status from the api call
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def status @status end |
#symbol ⇒ String, Symbol (readonly)
The ticker symbol of the company
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def symbol @symbol end |
#timestamp ⇒ Time (readonly)
The last time the company’s stock was traded
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def @timestamp end |
#volume ⇒ Integer (readonly)
The trade volume of the company’s stock
30 31 32 |
# File 'lib/stock-markit/quote.rb', line 30 def volume @volume end |
Instance Method Details
#fetch ⇒ self, False
49 50 51 |
# File 'lib/stock-markit/quote.rb', line 49 def fetch update end |
#update ⇒ self, False
56 57 58 |
# File 'lib/stock-markit/quote.rb', line 56 def update lookup_with_api end |