Share

WSLiveDataConfigNumbat

WSModelObject > WSBaseNetworkObject > WSNumbatNetworkObject > WSLiveDataConfigNumbat

A Live Data Configuration model object using merge version control.

Methods:

get_live_data_values

#get_live_data_values(feed, start, end) ⇒ Array<Array>

EXCHANGE

Retrieves the values from a live data feed. The values are returned as an array of arrays, where the inner array's first index is the date (as a Ruby DateTime), and the second index is the value:

values = [
  ["2024/01/01 00:00", 30.00],
  ["2024/01/01 00:15", 32.00],
  ["2024/01/01 00:30", 28.00]
]

To retrieve the data:

require 'date'

database = WSApplication.open()
ldc = database.model_object_from_type_and_id('Wesnet Live Data', 165)
live_data = ldc.get_live_data_values('composite', DateTime.new(2022,12,16), DateTime.new(2022,12,17))

Display method 1:

live_data.each do |(date, value)|
  puts format("%s - %0.2f", date, value)
end

Display method 2:

live_data.each do |(date, value)|
  puts "#{date} - #{value}"
end

Parameters

Name Type(s) Description
feed String The feed id.
start DateTime The start time range.
end DateTime The end time range.

Was this information helpful?