class Flashboy::Poloniex

Public Class Methods

parse_cursor(params) click to toggle source
# File lib/flashboy/poloniex.rb, line 14
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/poloniex.rb, line 20
def formatted_pair(pair)
  currency, base = super(pair)
  "#{base}_#{currency}".upcase
end
parse_order_book(order, pair) click to toggle source
# File lib/flashboy/poloniex.rb, line 48
def parse_order_book(order, pair)
  order
end
parse_quote(quote, pair) click to toggle source
# File lib/flashboy/poloniex.rb, line 37
def parse_quote(quote, pair)
  data = quote[pair.to_sym]
  {
    bid: data[:highestBid],
    last: data[:last],
    ask: data[:lowestAsk],
    volume: data[:baseVolume],
    timestamp: nil
  }
end
parse_trades(trades, exchange, _pair) click to toggle source
# File lib/flashboy/poloniex.rb, line 25
def parse_trades(trades, exchange, _pair)
  [*trades].map do |trade|
    {
      global_id: "#{exchange.key}-#{trade[:globalTradeID]}",
      type: trade[:type],
      price: trade[:rate],
      amount: trade[:amount],
      executed_at: trade[:date]
    }
  end
end