Class: Flashboy::OrderBook

Inherits:
Object
  • Object
show all
Defined in:
lib/flashboy/order_book.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ OrderBook

Returns a new instance of OrderBook.



5
6
7
8
9
10
# File 'lib/flashboy/order_book.rb', line 5

def initialize(data)
  @pair = data[:pair]
  @exchange = data[:exchange]
  @bids = (data[:bids] || []).map { |bid| Bid.new(bid) }
  @asks = (data[:asks] || []).map { |ask| Ask.new(ask) }
end

Instance Attribute Details

#asksObject (readonly)

Returns the value of attribute asks.



3
4
5
# File 'lib/flashboy/order_book.rb', line 3

def asks
  @asks
end

#bidsObject (readonly)

Returns the value of attribute bids.



3
4
5
# File 'lib/flashboy/order_book.rb', line 3

def bids
  @bids
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



3
4
5
# File 'lib/flashboy/order_book.rb', line 3

def exchange
  @exchange
end

#pairObject (readonly)

Returns the value of attribute pair.



3
4
5
# File 'lib/flashboy/order_book.rb', line 3

def pair
  @pair
end