class Kaesen::Client
Attributes
balance[R]
depth[R]
markets[R]
ticker[R]
Public Class Methods
new()
click to toggle source
# File lib/kaesen/client.rb, line 8 def initialize @markets = [] # [Array]: # [Market] instance of markets @tickers = {} # [Hash] # [String]: market name # [Hash]: hash of ticker @depths = {} # [Hash]: # [String]: market name # [Hash]: hash of depth @balances = {} # [Hash]: # [String]: market name # [Hash]: hash of depth end
Public Instance Methods
get(market_name)
click to toggle source
get the instance of market with key @parms [String] market name @return [Market] or nil
# File lib/kaesen/client.rb, line 31 def get(market_name) @markets.each{|m| return m if m.name == market_name } return nil end
push(market)
click to toggle source
register the instance of market @parm [Market]
# File lib/kaesen/client.rb, line 24 def push(market) @markets.push(market) end
update_balances()
click to toggle source
Update asset information. @return [hash] hash of balance
# File lib/kaesen/client.rb, line 58 def update_balances() @markets.each{|m| @balances[m.name] = m.balance } @balances end
update_depths()
click to toggle source
Update market information. @return [hash] hash of depth
# File lib/kaesen/client.rb, line 49 def update_depths() @markets.each{|m| @depths[m.name] = m.depth } @depths end
update_tickers()
click to toggle source
Update market information. @return [hash] hash of ticker
# File lib/kaesen/client.rb, line 40 def update_tickers() @markets.each{|m| @tickers[m.name] = m.ticker } @tickers end