class WavesRubyClient::DataFeed

query data feed

Public Class Methods

current_price() click to toggle source
# File lib/waves_ruby_client/data_feed.rb, line 4
def self.current_price
  trade_history(1).first.price
end
trade_history(count = 10) click to toggle source

get history from data feed

# 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