Class: Kaesen::Monetago
Overview
Kaesen Wrapper Class www.monetago.com/#/api/ API制限. More than 500 requests per 10 minutes will result in IP ban. . For real-time data please refer to the MonetaGo WebSocket API.
Constant Summary collapse
- @@nonce =
0
Instance Attribute Summary
Attributes inherited from Market
#api_key, #api_secret, #name, #url_private, #url_public
Instance Method Summary collapse
-
#depth ⇒ hash
abstract
Get order book.
-
#initialize(options = {}) {|_self| ... } ⇒ Monetago
constructor
A new instance of Monetago.
-
#ticker ⇒ hash
Get ticker information.
Methods inherited from Market
#balance, #buy, #cancel, #cancel_all, #market_buy, #market_sell, #opens, #sell, unBigDecimal
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Monetago
Returns a new instance of Monetago.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kaesen/monetago.rb', line 18 def initialize( = {}) super() @name = "Monetago" @api_key = ENV["MONETAGO_KEY"] @api_secret = ENV["MONETAGO_SECRET"] @url_public = "https://api.monetago.com:8400/ajax/v1" @url_private = @url_public .each do |key, value| instance_variable_set("@#{key}", value) end yield(self) if block_given? end |
Instance Method Details
#depth ⇒ hash
This method is abstract.
Get order book.
69 70 71 72 73 74 75 76 |
# File 'lib/kaesen/monetago.rb', line 69 def depth h = post_ssl(@url_public + "/GetOrderBook") { "asks" => h["asks"].map{|x| [BigDecimal.new(x["px"].to_s), BigDecimal.new(x["qty"].to_s)]}, "bids" => h["bids"].map{|x| [BigDecimal.new(x["px"].to_s), BigDecimal.new(x["qty"].to_s)]}, "ltimestamp" => Time.now.to_i, } end |
#ticker ⇒ hash
Get ticker information.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/kaesen/monetago.rb', line 46 def ticker h = post_ssl(@url_public + "/GetTicker", {product_pair: 'BTCJPY'}) { "ask" => BigDecimal.new(h["ask"].to_s), "bid" => BigDecimal.new(h["bid"].to_s), "last" => BigDecimal.new(h["last"].to_s), "high" => BigDecimal.new(h["high"].to_s), "low" => BigDecimal.new(h["low"].to_s), "volume" => BigDecimal.new(h["volume"].to_s), "ltimestamp" => Time.now.to_i, } end |