Class: Vertpig::Quote
- Inherits:
-
Object
- Object
- Vertpig::Quote
- Defined in:
- lib/vertpig/quote.rb
Instance Attribute Summary collapse
-
#ask ⇒ Object
readonly
Returns the value of attribute ask.
-
#bid ⇒ Object
readonly
Returns the value of attribute bid.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#market ⇒ Object
readonly
Returns the value of attribute market.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
-
.current(market) ⇒ Object
Example: Vertpig::Quote.current(‘BTC-HPY’).
Instance Method Summary collapse
-
#initialize(market, attrs = {}) ⇒ Quote
constructor
A new instance of Quote.
Constructor Details
#initialize(market, attrs = {}) ⇒ Quote
Returns a new instance of Quote.
5 6 7 8 9 10 11 12 |
# File 'lib/vertpig/quote.rb', line 5 def initialize(market, attrs = {}) @market = market return if attrs.nil? @bid = attrs['Bid'] @ask = attrs['Ask'] @last = attrs['Last'] @raw = attrs end |
Instance Attribute Details
#ask ⇒ Object (readonly)
Returns the value of attribute ask.
3 4 5 |
# File 'lib/vertpig/quote.rb', line 3 def ask @ask end |
#bid ⇒ Object (readonly)
Returns the value of attribute bid.
3 4 5 |
# File 'lib/vertpig/quote.rb', line 3 def bid @bid end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
3 4 5 |
# File 'lib/vertpig/quote.rb', line 3 def last @last end |
#market ⇒ Object (readonly)
Returns the value of attribute market.
3 4 5 |
# File 'lib/vertpig/quote.rb', line 3 def market @market end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/vertpig/quote.rb', line 3 def raw @raw end |
Class Method Details
.current(market) ⇒ Object
Example: Vertpig::Quote.current(‘BTC-HPY’)
16 17 18 |
# File 'lib/vertpig/quote.rb', line 16 def self.current(market) new(market, client.get('public/getticker', market: market)) end |