class Bitex::Match

@visibility private Both Buy and Sell are a kind of Match, they deserialize the same and have very similar fields, although their documentation may differ.

Attributes

amount[RW]
created_at[RW]
fee[RW]
id[RW]
order_book[RW]
price[RW]
quantity[RW]

Public Class Methods

from_json(json) click to toggle source

@visibility private rubocop:disable Metrics/AbcSize

# File lib/bitex/match.rb, line 10
def self.from_json(json)
  Api.from_json(new, json) do |thing|
    thing.order_book = order_books[json[3]]
    thing.quantity = json[4].to_s.to_d
    thing.amount = json[5].to_s.to_d
    thing.fee = json[6].to_s.to_d
    thing.price = json[7].to_s.to_d
  end
end

Private Class Methods

order_books() click to toggle source

rubocop:enable Metrics/AbcSize

# File lib/bitex/match.rb, line 21
def self.order_books
  ORDER_BOOKS.invert
end

Public Instance Methods

base_currency() click to toggle source
# File lib/bitex/match.rb, line 27
def base_currency
  base_quote[0]
end
quote_currency() click to toggle source
# File lib/bitex/match.rb, line 31
def quote_currency
  base_quote[1]
end

Private Instance Methods

base_quote() click to toggle source
# File lib/bitex/match.rb, line 37
def base_quote
  order_book.upcase.to_s.split('_')
end