Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Commit

Permalink
Sample scripts updated
Browse files Browse the repository at this point in the history
  • Loading branch information
arvicco committed Sep 6, 2011
1 parent 3897449 commit 0ea560b
Show file tree
Hide file tree
Showing 22 changed files with 1,866 additions and 827 deletions.
7 changes: 7 additions & 0 deletions .rakeTasks
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Alias to doc:rdoc" fullCmd="doc" taksId="doc" /><RakeGroup description="" fullCmd="" taksId="doc"><RakeTask description="Remove rdoc products" fullCmd="doc:clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Build the rdoc HTML Files" fullCmd="doc:rdoc" taksId="rdoc" /><RakeTask description="Force a rebuild of the RDOC files" fullCmd="doc:rerdoc" taksId="rerdoc" /><RakeTask description="" fullCmd="doc:clobber" taksId="clobber" /></RakeGroup><RakeTask description="Alias to gem:build" fullCmd="gem" taksId="gem" /><RakeGroup description="" fullCmd="" taksId="gem"><RakeTask description="(Re-)Build gem" fullCmd="gem:build" taksId="build" /><RakeTask description="Cleanup already installed gem(s)" fullCmd="gem:cleanup" taksId="cleanup" /><RakeTask description="Build and install gem" fullCmd="gem:install" taksId="install" /><RakeTask description="Build and push gem to Gemcutter" fullCmd="gem:release" taksId="release" /></RakeGroup><RakeTask description="Alias to git:commit" fullCmd="git" taksId="git" /><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Stage and commit your work [with message]" fullCmd="git:commit[message]" taksId="commit[message]" /><RakeTask description="Push local changes to Github" fullCmd="git:push" taksId="push" /><RakeTask description="Create (release) tag on Github" fullCmd="git:tag" taksId="tag" /><RakeTask description="" fullCmd="git:commit" taksId="commit" /></RakeGroup><RakeTask description="Alias to gem:install" fullCmd="install" taksId="install" /><RakeTask description="Alias to gem:release" fullCmd="release" taksId="release" /><RakeTask description="Alias to spec:spec" fullCmd="spec" taksId="spec" /><RakeGroup description="" fullCmd="" taksId="spec"><RakeTask description="Run specs with RCov" fullCmd="spec:rcov" taksId="rcov" /><RakeTask description="Run all specs" fullCmd="spec:spec" taksId="spec" /></RakeGroup><RakeTask description="Set version: [x.y.z] - explicitly, [1/10/100] - bump major/minor/patch, [.build] - build" fullCmd="version[command,desc]" taksId="version[command,desc]" /><RakeTask description="" fullCmd="notes" taksId="notes" /><RakeTask description="" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="" fullCmd="rdoc/index.html" taksId="rdoc/index.html" /><RakeTask description="" fullCmd="version" taksId="version" /></RakeGroup></Settings>
4 changes: 4 additions & 0 deletions Gemfile
Expand Up @@ -2,3 +2,7 @@ source :gemcutter

gem 'bundler', ">= 1.0.13"
gem 'rspec', '>=2.5.0', :require => ['rspec', 'rspec/autorun']

# Gems used in bin scripts
gem 'getopt'
gem 'duration'
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -2,6 +2,8 @@ GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
duration (0.1.0)
getopt (1.4.1)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
Expand All @@ -16,4 +18,6 @@ PLATFORMS

DEPENDENCIES
bundler (>= 1.0.13)
duration
getopt
rspec (>= 2.5.0)
4 changes: 4 additions & 0 deletions HISTORY
Expand Up @@ -25,3 +25,7 @@
== 0.4.4 / 2011-09-05

* IB references and Java examples added

== 0.4.5 / 2011-09-06

* Sample scripts updated
4 changes: 2 additions & 2 deletions README.rdoc
Expand Up @@ -39,8 +39,8 @@ connections on localhost.
First, start up Interactive Broker's Trader Work Station.
Ensure it is configured to allow API connections on localhost.

>> require 'ib-ruby'
>> ib_connection = IB::IB.new()
>> require 'ib-ruby'
>> ib_connection = IB::IB.new()

== LICENSE:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.4.4
0.4.5
67 changes: 0 additions & 67 deletions bin/AccountInfo

This file was deleted.

111 changes: 0 additions & 111 deletions bin/HistoricToCSV

This file was deleted.

78 changes: 0 additions & 78 deletions bin/RequestMarketData

This file was deleted.

48 changes: 48 additions & 0 deletions bin/account_info
@@ -0,0 +1,48 @@
#!/usr/bin/env ruby
#
# This script connects to IB API, subscribes to account info and prints out
# messages received from IB (update every 3 minute or so)

require 'pathname'
require 'rubygems'
require 'bundler/setup'

LIB_DIR = (Pathname.new(__FILE__).dirname + '../lib/').realpath.to_s
$LOAD_PATH.unshift LIB_DIR unless $LOAD_PATH.include?(LIB_DIR)

require 'ib-ruby'

# First, connect to IB TWS.
ib = IB::IB.new

# Uncomment this for verbose debug messages:
# IB::IBLogger.level = Logger::Severity::DEBUG

## Subscribe to the messages that TWS sends in response to a request
## for account data.

ib.subscribe(IB::IncomingMessages::AccountValue, lambda { |msg|
puts msg.to_human
})

ib.subscribe(IB::IncomingMessages::PortfolioValue, lambda { |msg|
puts msg.to_human
})

ib.subscribe(IB::IncomingMessages::AccountUpdateTime, lambda { |msg|
puts msg.to_human
})

ib.dispatch(IB::OutgoingMessages::RequestAccountData.new(:subscribe => true,
:account_code => ''))


puts "\nSubscribing to IB account data"
puts "\n******** Press <Enter> to cancel... *********\n\n"
gets
puts "Cancelling account data subscription.."

ib.dispatch(IB::OutgoingMessages::RequestAccountData.new(:subscribe => false,
:account_code => ''))
puts "Done."

0 comments on commit 0ea560b

Please sign in to comment.