Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby interface to Interactive Brokers' TWS API
branch: master

This branch is 562 commits behind ib-ruby:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
misc
spec
tasks
.gitignore
.rspec
.rvmrc
Gemfile
Gemfile.lock
HISTORY
LICENSE
README.rdoc
Rakefile
VERSION
ib-ruby.gemspec

README.rdoc

ib-ruby

by

Arvicco

url

github.com/arvicco/ib-ruby

This is a fork of github.com/wdevauld/ib-ruby by Wes Devauld, that is in turn forked from github.com/pjlegato/ib-ruby by Paul Legato.

DESCRIPTION:

Ruby Implementation of the Interactive Broker' Trader Work Station (TWS) API v.965.

FEATURES/PROBLEMS:

  • This is a BETA release, and should not be used for live trading. Any features contained within are AS-IS and may not work in all conditions

  • This code is not sanctioned or supported by Interactive Brokers

REQUIREMENTS:

Interactive Broker's TWS or Gateway installed and configured to allow API connections on localhost.

INSTALL:

From Gem

$ sudo gem install ib-ruby

From Source

$ git clone http://github.com/arvicco/ib-ruby
$ cd ib-ruby; rake gem:install

SYNOPSIS:

First, start up Interactive Broker's Trader Work Station or Gateway. Make sure it is configured to allow API connections on localhost.

>> require 'ib-ruby'
>> ib = IB::Connection.new
>> ib.subscribe(:Alert, :AccountValue) { |msg| puts msg.to_human }
>> ib.send_message :RequestAccountData, :subscribe => true

Essentially, all interaction of your code and TWS can be described as exchange of messages. You subscribe to message type(s) you're interested in using IB::Connection#subscribe and request data from TWS using IB::Connection#send_message. The code blocks (or procs) given to #subscribe will be executed when a message of requested type is received, with the received message as its argument.

Use sample scripts in /bin folder as an example of how common tasks can be achieved using ib-ruby.

See /lib/ib-ruby/messages for a full list of TWS incoming/outgoing messages and their attributes. Original TWS docs and code samples can be found in /misc folder.

LICENSE:

Copyright © 2011 Arvicco. See LICENSE for details.

Something went wrong with that request. Please try again.