Class: Coinone::Account::DailyBalance::Balance

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/account/daily_balance/balance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Balance

Returns a new instance of Balance.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/coinone/account/daily_balance/balance.rb', line 11

def initialize(options={})

  @timestamp = nil
  @value = 0
  @btc = 0
  @eth = 0
  @etc = 0
  @krw = 0

  update_balance(options)
end

Instance Attribute Details

#btcObject (readonly)

Returns the value of attribute btc.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def btc
  @btc
end

#etcObject (readonly)

Returns the value of attribute etc.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def etc
  @etc
end

#ethObject (readonly)

Returns the value of attribute eth.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def eth
  @eth
end

#krwObject (readonly)

Returns the value of attribute krw.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def krw
  @krw
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def timestamp
  @timestamp
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/coinone/account/daily_balance/balance.rb', line 9

def value
  @value
end

Instance Method Details

#update_balance(params = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/coinone/account/daily_balance/balance.rb', line 23

def update_balance(params={})

  @timestamp= params[:timestamp].to_i if params.has_key? :timestamp
  @value = params[:value].to_d if params.has_key? :value
  @btc = params[:btc].to_d if params.has_key? :btc
  @eth = params[:eth].to_d if params.has_key? :eth
  @etc = params[:etc].to_d if params.has_key? :etc
  @krw = params[:krw].to_d if params.has_key? :krw

end