Sha256: f6b88ddeb0920e404af8311e924c2fa884b0a4d8eccc2f3b18225cd1a5473e59

Contents?: true

Size: 933 Bytes

Versions: 13

Compression:

Stored size: 933 Bytes

Contents

require 'spec_helper'

describe IEX::Resources::LargestTrades do
  include_context 'client'

  context 'retrieves the largest trade for a specific stock', vcr: { cassette_name: 'largest-trades/aapl' } do
    subject do
      client.largest_trades('aapl')
    end
    it 'retrieve largest trades' do
      expect(subject.first.size).to eq 18_400
      expect(subject.first.price).to eq 195.82
      expect(subject.first.time).to eq 1_554_403_101_504
      expect(subject.first.time_label).to eq '14:38:21'
      expect(subject.first.venue).to eq('None')
      expect(subject.first.venue_name).to eq('Off Exchange')
    end
  end

  context 'invalid symbol', vcr: { cassette_name: 'largest-trades/invalid' } do
    subject do
      client.largest_trades('INVALID')
    end
    it 'fails with SymbolNotFoundError' do
      expect { subject }.to raise_error IEX::Errors::SymbolNotFoundError, 'Symbol INVALID Not Found'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iex-ruby-client-2.1.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-2.0.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.6.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.5.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.4.1 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.4.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.3.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.2.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.1.2 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.1.1 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.1.0 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.0.1 spec/iex/endpoints/largest_trades_spec.rb
iex-ruby-client-1.0.0 spec/iex/endpoints/largest_trades_spec.rb