Class: MtGox::Client
- Inherits:
-
Object
- Object
- MtGox::Client
- Includes:
- Connection, Request
- Defined in:
- lib/mtgox/client.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#depth([currency = :usd,]{}) ⇒ Depth
Fetch depth.
-
#ticker(currency = :usd) ⇒ MtGox::Ticker
Fetch the latest ticker data.
-
#trades(*args) ⇒ Array<MtGox::Trade>
Fetch recent trades.
Methods included from Request
Instance Method Details
#depth([currency = :usd,]{}) ⇒ Depth
Fetch depth
31 32 33 34 35 36 37 38 |
# File 'lib/mtgox/client.rb', line 31 def depth(*args) (currency,), o = args. currency ||= :usd currency = currency_name(currency) depth = o[:full] ? "fulldepth" : "depth" data = get("/api/1/#{currency}/public/#{depth}?raw") Depth.new data end |
#ticker(currency = :usd) ⇒ MtGox::Ticker
Fetch the latest ticker data
12 13 14 15 16 |
# File 'lib/mtgox/client.rb', line 12 def ticker(currency=:usd) currency = currency_name(currency) data = get("/api/1/#{currency}/public/ticker?raw") Ticker.new(data) end |
#trades(*args) ⇒ Array<MtGox::Trade>
Fetch recent trades
49 50 51 52 53 54 55 56 |
# File 'lib/mtgox/client.rb', line 49 def trades(*args) (currency,), query = args. currency ||= :usd currency = currency_name(currency) get("/api/1/#{currency}/public/trades?raw", query).map { |data| Trade.new(data) } end |