Skip to content
forked from ib-ruby/ib-ruby

Ruby interface to Interactive Brokers' TWS API

License

Notifications You must be signed in to change notification settings

pjlegato/ib-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Ruby interface to Interactive Brokers' TWS API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 62.3%
  • Ruby 26.0%
  • C 8.3%
  • C++ 3.4%