Class: Kaesen::Client
- Inherits:
-
Object
- Object
- Kaesen::Client
- Defined in:
- lib/kaesen/client.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#markets ⇒ Object
readonly
Returns the value of attribute markets.
-
#ticker ⇒ Object
readonly
Returns the value of attribute ticker.
Instance Method Summary collapse
-
#get(market_name) ⇒ Market
get the instance of market with key.
-
#initialize ⇒ Client
constructor
A new instance of Client.
-
#push(market) ⇒ Object
register the instance of market.
-
#update_balances ⇒ hash
Update asset information.
-
#update_depths ⇒ hash
Update market information.
-
#update_tickers ⇒ hash
Update market information.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
5 6 7 |
# File 'lib/kaesen/client.rb', line 5 def balance @balance end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
6 7 8 |
# File 'lib/kaesen/client.rb', line 6 def depth @depth end |
#markets ⇒ Object (readonly)
Returns the value of attribute markets.
3 4 5 |
# File 'lib/kaesen/client.rb', line 3 def markets @markets end |
#ticker ⇒ Object (readonly)
Returns the value of attribute ticker.
4 5 6 |
# File 'lib/kaesen/client.rb', line 4 def ticker @ticker end |
Instance Method Details
#get(market_name) ⇒ Market
get the instance of market with key
31 32 33 34 35 36 |
# 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) ⇒ Object
register the instance of market
24 25 26 |
# File 'lib/kaesen/client.rb', line 24 def push(market) @markets.push(market) end |
#update_balances ⇒ hash
Update asset information.
58 59 60 61 62 63 |
# File 'lib/kaesen/client.rb', line 58 def update_balances() @markets.each{|m| @balances[m.name] = m.balance } @balances end |
#update_depths ⇒ hash
Update market information.
49 50 51 52 53 54 |
# File 'lib/kaesen/client.rb', line 49 def update_depths() @markets.each{|m| @depths[m.name] = m.depth } @depths end |
#update_tickers ⇒ hash
Update market information.
40 41 42 43 44 45 |
# File 'lib/kaesen/client.rb', line 40 def update_tickers() @markets.each{|m| @tickers[m.name] = m.ticker } @tickers end |