Class: Flashboy::OrderBook
- Inherits:
-
Object
- Object
- Flashboy::OrderBook
- Defined in:
- lib/flashboy/order_book.rb
Instance Attribute Summary collapse
-
#asks ⇒ Object
readonly
Returns the value of attribute asks.
-
#bids ⇒ Object
readonly
Returns the value of attribute bids.
-
#exchange ⇒ Object
readonly
Returns the value of attribute exchange.
-
#pair ⇒ Object
readonly
Returns the value of attribute pair.
Instance Method Summary collapse
-
#initialize(data) ⇒ OrderBook
constructor
A new instance of OrderBook.
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
#asks ⇒ Object (readonly)
Returns the value of attribute asks.
3 4 5 |
# File 'lib/flashboy/order_book.rb', line 3 def asks @asks end |
#bids ⇒ Object (readonly)
Returns the value of attribute bids.
3 4 5 |
# File 'lib/flashboy/order_book.rb', line 3 def bids @bids end |
#exchange ⇒ Object (readonly)
Returns the value of attribute exchange.
3 4 5 |
# File 'lib/flashboy/order_book.rb', line 3 def exchange @exchange end |
#pair ⇒ Object (readonly)
Returns the value of attribute pair.
3 4 5 |
# File 'lib/flashboy/order_book.rb', line 3 def pair @pair end |