Method: Kaesen::Lakebtc#depth

Defined in:
lib/kaesen/lakebtc.rb

#depthhash

This method is abstract.

Get order book.

Returns:

  • (hash)

    array of market depth asks: [Array] 売りオーダー

    price : [BigDecimal]
    size : [BigDecimal]
    

    bids: [Array] 買いオーダー

    price : [BigDecimal]
    size : [BigDecimal]
    

    ltimestamp: [int] ローカルタイムスタンプ



67
68
69
70
71
72
73
74
# File 'lib/kaesen/lakebtc.rb', line 67

def depth
  h = get_ssl(@url_public + "/bcorderbook?symbol=btcjpy") # the id of BTCJPY is 5.
  {
    "asks"       => h["asks"].map{|a,b| [BigDecimal.new(a.to_s), BigDecimal.new(b.to_s)]}, # to_s でないと誤差が生じる
    "bids"       => h["bids"].map{|a,b| [BigDecimal.new(a.to_s), BigDecimal.new(b.to_s)]}, # to_s でないと誤差が生じる
    "ltimestamp" => Time.now.to_i,
  }
end