class Fcoin::TickerFormatter

Attributes

body[RW]

Public Class Methods

new(body) click to toggle source
# File lib/fcoin/formatter/ticker_formatter.rb, line 8
def initialize(body)
  self.body = body
end

Public Instance Methods

formatted_body() click to toggle source

Format response body for JSON

@return [Hash]

# File lib/fcoin/formatter/ticker_formatter.rb, line 15
def formatted_body
  # https://developer.fcoin.com/en.html
  ticker = body['data']['ticker'].dup
  self.body['data']['ticker'] = {
                       "latest_price" => ticker[0],
                       "most_recent_trade_vol" => ticker[1],
                       "max_buy_price" => ticker[2],
                       "max_buy_amount" => ticker[3],
                       "min_sell_price" => ticker[4],
                       "min_sell_amount" => ticker[5],
                       "trade_price_yesterday" => ticker[6],
                       "highest_price_today" => ticker[7],
                       "lowest_price_today" => ticker[8],
                       "symbol_base_vol_today" => ticker[9],
                       "symbol_base_price_today" => ticker[10]
                   }
  body
end