Class: DataStream::Api
- Inherits:
-
Object
- Object
- DataStream::Api
- Includes:
- DssUtilities
- Defined in:
- lib/data_stream_api.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#initialize ⇒ Api
constructor
A new instance of Api.
- #isin_stream(isin, date_start, date_end, options = {}) ⇒ Object
- #ric_stream(ric, date_start, date_end, options = {}) ⇒ Object
- #stream(value, date_start, date_end, options = {}) ⇒ Object
Methods included from DssUtilities
Constructor Details
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
79 80 81 |
# File 'lib/data_stream_api.rb', line 79 def session @session end |
Instance Method Details
#isin_stream(isin, date_start, date_end, options = {}) ⇒ Object
114 115 116 |
# File 'lib/data_stream_api.rb', line 114 def isin_stream(isin, date_start, date_end, ={}) stream isin, date_start, date_end, end |
#ric_stream(ric, date_start, date_end, options = {}) ⇒ Object
110 111 112 |
# File 'lib/data_stream_api.rb', line 110 def ric_stream(ric, date_start, date_end, ={}) stream "<#{ric}>", date_start, date_end, end |
#stream(value, date_start, date_end, options = {}) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/data_stream_api.rb', line 85 def stream(value, date_start, date_end, ={}) date = { "End" => date_end, "Frequency" => "", "Kind" => 1, "Start" => date_start } instrument = { "Properties" => [ { "Key" => "IsSymbolSet", "Value" => true } ], "Value" => value } stream = Stream.new @session, instrument, date stream.result["DataResponse"]["Dates"].each_with_index.map do |date, i| { date: parseDate(date, ), value: stream.result["DataResponse"]["DataTypeValues"][0]["SymbolValues"][0]["Value"][i] } end end |