Class: Vertpig::Quote

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#askObject (readonly)

Returns the value of attribute ask.



3
4
5
# File 'lib/vertpig/quote.rb', line 3

def ask
  @ask
end

#bidObject (readonly)

Returns the value of attribute bid.



3
4
5
# File 'lib/vertpig/quote.rb', line 3

def bid
  @bid
end

#lastObject (readonly)

Returns the value of attribute last.



3
4
5
# File 'lib/vertpig/quote.rb', line 3

def last
  @last
end

#marketObject (readonly)

Returns the value of attribute market.



3
4
5
# File 'lib/vertpig/quote.rb', line 3

def market
  @market
end

#rawObject (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