class Livermore::Order

Constants

ASK
BID
LIMIT_ORDER

Attributes

amount[R]
amount_filled[R]
created_at[R]
id[R]
market[R]
operation[R]
price[R]
status[R]
type[R]

Public Class Methods

new(market:, id: nil, price:, amount: 0, type:, operation: nil) click to toggle source
# File lib/livermore/order.rb, line 9
def initialize(market:, id: nil, price:, amount: 0, type:, operation: nil)
  @market = market
  @id = id
  @price = price
  @amount = amount
  @type = type
  @operation = operation
end

Public Instance Methods

colorize() click to toggle source
# File lib/livermore/order.rb, line 26
def colorize
  case type
  when ASK then to_s.red
  when BID then to_s.green
  end
end
to_s() click to toggle source
# File lib/livermore/order.rb, line 22
def to_s
  format '{ price: %.7f, amount: %.7f }', price, amount
end