Sha256: 38988e9719b2fda900aed6db450019489882ea550e08723234f096e449e0e09c

Contents?: true

Size: 683 Bytes

Versions: 14

Compression:

Stored size: 683 Bytes

Contents

require 'omf_oml/table'

schema = [[:id, :int], [:name, :string], [:value, :float]]
table = OMF::OML::OmlTable.new 'financial_returns', schema 
table2 = OMF::OML::OmlTable.new 'financial_returns_all_positive', schema 

[["CDS / Options" , -29.765957771107],
 ["Cash" , 0],
 ["Corporate Bonds" , 32.807804682612],
 ["Equity" , 196.45946739256],
 ["Index Futures" ,0.19434030906893],
 ["Options" , -98.079782601442],
 ["Preferred" , -13.925743130903],
 ["Not Available" , -5.1387322875705]
].each_with_index do |a, i|
  table.add_row [i, a[0], a[1]]
  table2.add_row [i, a[0], a[1].abs]  
end

require 'omf_web'
OMF::Web.register_datasource table
OMF::Web.register_datasource table2

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
omf_web-1.2.9 example/demo/data_sources/returns.rb
omf_web-1.2.8 example/demo/data_sources/returns.rb
omf_web-1.2.7 example/demo/data_sources/returns.rb
omf_web-1.2.6 example/demo/data_sources/returns.rb
omf_web-1.2.5 example/demo/data_sources/returns.rb
omf_web-1.2.4 example/demo/data_sources/returns.rb
omf_web-1.2.3 example/demo/data_sources/returns.rb
omf_web-1.2.2 example/demo/data_sources/returns.rb
omf_web-1.2.1 example/demo/data_sources/returns.rb
omf_web-1.2.0 example/demo/data_sources/returns.rb
omf_web-1.0.0 example/demo/data_sources/returns.rb
omf_web-0.9.9 example/demo/data_sources/returns.rb
omf_web-0.9.8 example/demo/data_sources/returns.rb
omf_web-0.9.7 example/demo/data_sources/returns.rb