Class: WavesRubyClient::DataFeed
- Inherits:
-
Object
- Object
- WavesRubyClient::DataFeed
- Defined in:
- lib/waves_ruby_client/data_feed.rb
Overview
query data feed
Class Method Summary collapse
- .current_price ⇒ Object
-
.trade_history(count = 10) ⇒ Object
get history from data feed.
Class Method Details
.current_price ⇒ Object
4 5 6 |
# File 'lib/waves_ruby_client/data_feed.rb', line 4 def self.current_price trade_history(1).first.price end |
.trade_history(count = 10) ⇒ Object
get history from data feed
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/waves_ruby_client/data_feed.rb', line 9 def self.trade_history(count = 10) WavesRubyClient::Api.instance.call_data_feed("/transactions/exchange?amountAsset=WAVES&limit=#{count}")['data'].map do |entry| order = entry['data'] WavesRubyClient::Order.new( id: order['id'], price: order['price'].to_f, timestamp: Time.parse(order['timestamp']), amount: order['amount'].to_f ) end end |