Sha256: fafb2d05cb9dfcfdb637c8d3cd54ae62357e08afeb96b413417594a99ebc3fc0

Contents?: true

Size: 1.32 KB

Versions: 10

Compression:

Stored size: 1.32 KB

Contents

require 'integration_helper'

describe 'Request Fundamental Data',
         :connected => true, :integration => true, :reuters => true do

  before(:all) do
    verify_account
    @ib = IB::Connection.new OPTS[:connection].merge(:logger => mock_logger)

    @contract = IB::Contract.new :symbol => 'IBM',
                                 :exchange => 'NYSE',
                                 :currency => 'USD',
                                 :sec_type => 'STK'

    @ib.send_message :RequestFundamentalData,
                     :id => 456,
                     :contract => @contract,
                     :report_type => 'snapshot' # 'estimates', 'finstat'

    @ib.wait_for :FundamentalData, 10 # sec
  end

  after(:all) do
    close_connection
  end

  subject { @ib.received[:FundamentalData].first }

  it { @ib.received[:FundamentalData].should have_at_least(1).data_message }

  it { should be_an IB::Messages::Incoming::FundamentalData }
  its(:request_id) { should == 456 }
  its(:data) { should be_a String }

  it 'responds with XML with relevant data' do
    require 'xmlsimple'
    data_xml = XmlSimple.xml_in(subject.data, 'ForceArray' => false) #, 'ContentKey' => 'content')
    name = data_xml["CoIDs"]["CoID"].find {|tag| tag['Type'] == 'CompanyName'}['content']
    name.should =~ /International Business Machines/
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ib-ruby-0.8.5 spec/integration/fundamental_data_spec.rb
ib-ruby-0.8.4 spec/integration/fundamental_data_spec.rb
ib-ruby-0.8.3 spec/integration/fundamental_data_spec.rb
ib-ruby-0.8.1 spec/integration/fundamental_data_spec.rb
ib-ruby-0.8.0 spec/integration/fundamental_data_spec.rb
ib-ruby-0.7.12 spec/integration/fundamental_data_spec.rb
ib-ruby-0.7.11 spec/integration/fundamental_data_spec.rb
ib-ruby-0.7.10 spec/integration/fundamental_data_spec.rb
ib-ruby-0.7.9 spec/integration/fundamental_data_spec.rb
ib-ruby-0.7.8 spec/integration/fundamental_data_spec.rb