Skip to content

Commit

Permalink
Misc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
arvicco committed Oct 24, 2012
1 parent f069117 commit fe43545
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tmtags
*.iml

## PROJECT::GENERAL
config/flex.yml
coverage
data
rdoc
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ rescue LoadError => e
puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
end


# rake db:redo DB=test"
namespace :db do
desc "Remake db from scratch: $ rake db:redo DB=test"
Expand Down
2 changes: 1 addition & 1 deletion bin/scaffold.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
# This script converts given migration file into rails scaffold command
# This script converts given migration file into a Rails scaffold command

output = STDOUT
ARGV.each do |file_name|
Expand Down
6 changes: 3 additions & 3 deletions example/fundamental_data
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ require 'ib-ruby'
require 'xmlsimple'
require 'pp'


ib = IB::Connection.new :client_id => 1112 #, :port => 7496 # TWS

ib.subscribe(:Alert) { |msg| puts msg.to_human }

# Fundamental Data will arrive as XML, parse it
ib.subscribe(:FundamentalData) { |msg| @xml = XmlSimple.xml_in(msg.data) }
# Fundamental Data will arrive in XML format, we need to parse it
ib.subscribe(:FundamentalData) { |msg| @xml = XmlSimple.xml_in(msg.data, :ForceArray => false) }

ibm = IB::Contract.new :symbol => 'IBM',
:exchange => 'NYSE',
Expand All @@ -36,4 +35,5 @@ ib.send_message :RequestFundamentalData,
# Needs some time to receive and parse XML. Standard timeout of 1 sec is just too low.
ib.wait_for(30) { @xml}

# Now just extract and use all the fundamental data you needed
pp @xml
11 changes: 9 additions & 2 deletions lib/ib/messages/outgoing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ module Outgoing
:account_code)

# data => { :id => request_id (int), :contract => Contract }
#
# Special case for options: "wildcards" in the Contract fields retrieve Option chains
# strike = 0 means all strikes
# right = "" meanns both call and put
# expiry = "" means all expiries
# expiry = "2013" means all expiries in 2013
# expiry = "201311" means all expiries in Nov 2013
# You'll get several ContractData (10) messages back if there is more than one match.
# When all the matches are delivered you'll get ContractDataEnd (52) message.
RequestContractDetails = RequestContractData =
def_message([9, 6],
[:contract, :serialize_short, [:con_id, :include_expired, :sec_id]])
Expand All @@ -84,8 +93,6 @@ module Outgoing
[:contract, :serialize_short, []],
:num_rows)

### Defining (complex) Outgoing Message classes for IB:

# When this message is sent, TWS responds with ExecutionData messages, each
# containing the execution report that meets the specified criteria.
# @data={:id => int: :request_id,
Expand Down

0 comments on commit fe43545

Please sign in to comment.