Module: IB::Symbols

Included in:
Bonds, Forex, Futures, Options, Stocks
Defined in:
lib/ib/symbols.rb,
lib/ib/symbols/bonds.rb,
lib/ib/symbols/forex.rb,
lib/ib/symbols/stocks.rb,
lib/ib/symbols/futures.rb,
lib/ib/symbols/options.rb

Defined Under Namespace

Modules: Bonds, Forex, Futures, Options, Stocks

Instance Method Summary collapse

Instance Method Details

#[](symbol) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/ib/symbols.rb', line 18

def [] symbol
  if contracts[symbol]
    return contracts[symbol]
  else
    # symbol probably has not been predefined, tell user about it
    file = self.to_s.split(/::/).last.downcase
    msg = "Unknown symbol :#{symbol}, please pre-define it in lib/ib/symbols/#{file}.rb"
    error msg, :symbol
  end
end