Class: Trader::Market

Inherits:
Book
  • Object
show all
Defined in:
lib/trade-o-matic/core/market.rb

Instance Attribute Summary collapse

Attributes inherited from Book

#ask_slope, #bid_slope, #pair

Instance Method Summary collapse

Methods inherited from Book

#add_ask, #add_bid, #add_transaction, #prepare, #volume

Constructor Details

#initialize(_backend, _pair) ⇒ Market



6
7
8
9
# File 'lib/trade-o-matic/core/market.rb', line 6

def initialize(_backend, _pair)
  super _pair
  @backend = _backend
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



4
5
6
# File 'lib/trade-o-matic/core/market.rb', line 4

def backend
  @backend
end

Instance Method Details

#base_currencyObject



15
16
17
# File 'lib/trade-o-matic/core/market.rb', line 15

def base_currency
  pair.base
end

#bookObject



11
12
13
# File 'lib/trade-o-matic/core/market.rb', line 11

def book
  self
end

#quote_currencyObject



19
20
21
# File 'lib/trade-o-matic/core/market.rb', line 19

def quote_currency
  pair.quote
end

#refresh!Object



23
24
25
26
# File 'lib/trade-o-matic/core/market.rb', line 23

def refresh!
  backend.fill_book(book)
  self
end