Sha256: 73ed6b01ee76817e2fa2b24ac380c1148a0b975eb43fea350fcaf7df7ce166d9

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 KB

Contents

require 'message_helper'
require 'account_helper'

shared_examples_for 'Received Market Data' do
  context "received :Alert message " do
    subject { @ib.received[:Alert].first }

    it { should be_an IB::Messages::Incoming::Alert }
    it { should be_warning }
    it { should_not be_error }
    its(:code) { should be_an Integer }
    its(:message) { should =~ /Market data farm connection is OK/ }
    its(:to_human) { should =~ /TWS Warning/ }
  end

  context "received :TickPrice message" do
    subject { @ib.received[:TickPrice].first }

    it { should be_an IB::Messages::Incoming::TickPrice }
    its(:tick_type) { should be_an Integer }
    its(:type) { should be_a Symbol }
    its(:price) { should be_a Float }
    its(:size) { should be_an Integer }
    its(:data) { should be_a Hash }
    its(:ticker_id) { should == 456 } # ticker_id
    its(:to_human) { should =~ /TickPrice/ }
  end

  context "received :TickSize message", :if => :us_trading_hours do
    before(:all) do
      @ib.wait_for 3, :TickSize
    end

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

    it { should be_an IB::Messages::Incoming::TickSize }
    its(:type) { should_not be_nil }
    its(:data) { should be_a Hash }
    its(:tick_type) { should be_an Integer }
    its(:type) { should be_a Symbol }
    its(:size) { should be_an Integer }
    its(:ticker_id) { should == 456 }
    its(:to_human) { should =~ /TickSize/ }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ib-ruby-0.8.4 spec/integration_helper.rb
ib-ruby-0.8.3 spec/integration_helper.rb
ib-ruby-0.8.1 spec/integration_helper.rb
ib-ruby-0.8.0 spec/integration_helper.rb
ib-ruby-0.7.12 spec/integration_helper.rb
ib-ruby-0.7.11 spec/integration_helper.rb
ib-ruby-0.7.10 spec/integration_helper.rb
ib-ruby-0.7.9 spec/integration_helper.rb
ib-ruby-0.7.8 spec/integration_helper.rb
ib-ruby-0.7.6 spec/integration_helper.rb
ib-ruby-0.7.4 spec/integration_helper.rb
ib-ruby-0.7.3 spec/integration_helper.rb
ib-ruby-0.7.2 spec/integration_helper.rb
ib-ruby-0.7.0 spec/integration_helper.rb