Sha256: 8f65e6a4bb7d1e06f573edd0526f0f7c5ed1cc7fc3580e49fc5805dc7679691f

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

require 'mtgox/connection'
require 'mtgox/request'

module MtGox
  class Client
    include MtGox::Connection
    include MtGox::Request

    # Fetch the latest ticker data
    #
    # @return [Hashie::Rash]
    # @example
    #   MtGox.ticker
    def ticker
      get('/code/data/ticker.php')['ticker']
    end

    # Fetch open asks
    #
    # @return [Array<Numeric>]
    # @example
    #   MtGox.asks
    def asks
      get('/code/data/getDepth.php')['asks']
    end

    # Fetch open bids
    #
    # @return [Array<Numeric>]
    # @example
    #   MtGox.bids
    def bids
      get('/code/data/getDepth.php')['bids']
    end

    # Fetch recent trades
    #
    # @return [Array<Hashie::Rash>]
    # @example
    #   MtGox.trades
    def trades
      get('/code/data/getTrades.php').each{|t| t['date'] = Time.at(t['date'])}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mtgox-0.0.1 lib/mtgox/client.rb