#!/usr/bin/env ruby # # Your script description here... require 'pathname' LIB_DIR = (Pathname.new(__FILE__).dirname + '../lib/').realpath.to_s $LOAD_PATH.unshift LIB_DIR unless $LOAD_PATH.include?(LIB_DIR) require 'rubygems' require 'bundler/setup' require 'ib-ruby' # Connect to IB TWS. ib = IB::Connection.new # Subscribe to TWS alerts/errors ib.subscribe(:Alert) { |msg| puts msg.to_human } # Put your code here # ...