Class: Excoin::Market::Exchange::CandlestickChart
- Inherits:
-
Object
- Object
- Excoin::Market::Exchange::CandlestickChart
- Defined in:
- lib/exchange/candlestick_chart.rb
Defined Under Namespace
Classes: DataPoint
Instance Attribute Summary collapse
-
#commodity ⇒ Object
readonly
Returns the value of attribute commodity.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#datapoints ⇒ Object
readonly
Returns the value of attribute datapoints.
Instance Method Summary collapse
- #exchange ⇒ Object
-
#initialize(exchange_name) ⇒ CandlestickChart
constructor
A new instance of CandlestickChart.
- #update ⇒ Object
Constructor Details
#initialize(exchange_name) ⇒ CandlestickChart
Returns a new instance of CandlestickChart.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/exchange/candlestick_chart.rb', line 4 def initialize(exchange_name) @exchange_name = exchange_name exchange = self.exchange @currency = exchange.currency @commodity = exchange.commodity @datapoints = Array.new self.update end |
Instance Attribute Details
#commodity ⇒ Object (readonly)
Returns the value of attribute commodity.
2 3 4 |
# File 'lib/exchange/candlestick_chart.rb', line 2 def commodity @commodity end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
2 3 4 |
# File 'lib/exchange/candlestick_chart.rb', line 2 def currency @currency end |
#datapoints ⇒ Object (readonly)
Returns the value of attribute datapoints.
2 3 4 |
# File 'lib/exchange/candlestick_chart.rb', line 2 def datapoints @datapoints end |
Instance Method Details
#exchange ⇒ Object
24 25 26 |
# File 'lib/exchange/candlestick_chart.rb', line 24 def exchange return Excoin.market.exchange(@exchange_name) end |
#update ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/exchange/candlestick_chart.rb', line 15 def update @datapoints.clear chart_data = self.get chart_data.each do |point| datapoint = DataPoint.new(point) @datapoints << datapoint end end |