class Flashboy::Gemini

Public Class Methods

parse_cursor(params) click to toggle source
# File lib/flashboy/gemini.rb, line 10
def self.parse_cursor(params)
  { start: params[:start] }
end

Private Instance Methods

formatted_pair(pair) click to toggle source
Calls superclass method Flashboy::Exchange#formatted_pair
# File lib/flashboy/gemini.rb, line 16
def formatted_pair(pair)
  currency, base = super(pair)
  "#{currency}#{base}".downcase
end
parse_order_book(order, pair) click to toggle source
# File lib/flashboy/gemini.rb, line 43
def parse_order_book(order, pair)
  order
end
parse_quote(quote, pair) click to toggle source
# File lib/flashboy/gemini.rb, line 33
def parse_quote(quote, pair)
  {
    bid: quote[:bid],
    last: quote[:last],
    ask: quote[:ask],
    volume: (quote[:volume].first || [])[1],
    timestamp: quote[:timestamp]
  }
end
parse_trades(trades, exchange, pair) click to toggle source
# File lib/flashboy/gemini.rb, line 21
def parse_trades(trades, exchange, pair)
  [*trades].map do |trade|
    {
      global_id: "#{exchange.key}-#{trade[:tid]}",
      type: trade[:type],
      price: trade[:price],
      amount: trade[:amount],
      executed_at: trade[:timestamp].to_i
    }
  end
end