Class: Excoin::Market::Exchange::CandlestickChart::DataPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/exchange/candlestick_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exchange_data) ⇒ DataPoint

Returns a new instance of DataPoint.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/exchange/candlestick_data.rb', line 5

def initialize(exchange_data)
  begin
    @timestamp = Time.parse(exchange_data['timestamp'])
    @open = BigDecimal.new(exchange_data['open'])
    @close = BigDecimal.new(exchange_data['close'])
    @high = BigDecimal.new(exchange_data['high'])
    @low = BigDecimal.new(exchange_data['low'])
    @commodity_volume = BigDecimal.new(exchange_data['commodity_volume'])
    @currency_volume = BigDecimal.new(exchange_data['currency_volume'])
  rescue
    puts "Error in Excoin::Market::Exchange::CandlestickChart::Datapoint"
    puts exchange_data
  end
end

Instance Attribute Details

#closeObject (readonly)

Returns the value of attribute close.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def close
  @close
end

#commodity_volumeObject (readonly)

Returns the value of attribute commodity_volume.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def commodity_volume
  @commodity_volume
end

#currency_volumeObject (readonly)

Returns the value of attribute currency_volume.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def currency_volume
  @currency_volume
end

#highObject (readonly)

Returns the value of attribute high.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def high
  @high
end

#lowObject (readonly)

Returns the value of attribute low.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def low
  @low
end

#openObject (readonly)

Returns the value of attribute open.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def open
  @open
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



2
3
4
# File 'lib/exchange/candlestick_data.rb', line 2

def timestamp
  @timestamp
end