class Flashboy::Trade

Attributes

amount[R]
exchange[R]
executed_at[R]
global_id[R]
pair[R]
price[R]
type[R]

Public Class Methods

new(attrs) click to toggle source
# File lib/flashboy/trade.rb, line 5
def initialize(attrs)
  @global_id = attrs[:global_id]
  @type = attrs[:type]
  @exchange = attrs[:exchange]
  @pair = attrs[:pair]
  @price = attrs[:price].to_s.to_f
  @amount = attrs[:amount].to_s.to_f
  @executed_at = attrs[:executed_at]
end

Public Instance Methods

id() click to toggle source
# File lib/flashboy/trade.rb, line 15
def id
  global_id.split('-').last
end
to_json(_opts) click to toggle source
# File lib/flashboy/trade.rb, line 19
def to_json(_opts)
  {
    global_id: global_id,
    type: type,
    exchange: exchange,
    pair: pair,
    price: price,
    amount: amount,
    executed_at: executed_at
  }.to_json
end