How to install ib ruby api?

in my console,
laptop:~$ svn checkout svn://rubyforge.org/var/svn/ib-ruby
A ib-ruby/trunk
A ib-ruby/trunk/datatypes.rb
A ib-ruby/trunk/LICENSE
require ‘rubygems’
=> true
irb(main):003:0> require ‘ib’
LoadError: no such file to load – ib
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from (irb):3
from :0
what’s wrong?

Pen T. wrote:

in my console,
laptop:~$ svn checkout svn://rubyforge.org/var/svn/ib-ruby
A ib-ruby/trunk
A ib-ruby/trunk/datatypes.rb
A ib-ruby/trunk/LICENSE
require ‘rubygems’
=> true
irb(main):003:0> require ‘ib’
LoadError: no such file to load – ib
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from (irb):3
from :0
what’s wrong?

Hi,

Don’t Know but check this if it may help you for install ibruby gem,

http://rubyforge.org/projects/ibruby/

http://rubyforge.org/frs/?group_id=2573&release_id=14283

[email protected]:~$ irb -I ib-ruby/trunk
irb(main):001:0> require ‘datatypes’
NameError: uninitialized constant IB::Logger
from ./ib-ruby/trunk/datatypes.rb:27
from (irb):1:in require' from (irb):1 from :0 irb(main):002:0> $:.unshift 'ib-ruby/trunk' => ["ib-ruby/trunk", "ib-ruby/trunk", "/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_ruby/1.8/i486-linux", "/usr/local/lib/site_ruby/1.8/i386-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendor_ruby/1.8", "/usr/lib/ruby/vendor_ruby/1.8/i486-linux", "/usr/lib/ruby/vendor_ruby", "/usr/lib/ruby/1.8", "/usr/lib/ruby/1.8/i486-linux", "/usr/lib/ruby/1.8/i386-linux", "."] irb(main):003:0> require 'datatypes' NameError: uninitialized constant IB::Logger from ./ib-ruby/trunk/datatypes.rb:27 from (irb):3:inrequire’
from (irb):3
from :0
irb(main):004:0> require ‘ib’
=> true
irb(main):005:0>

maybe it is ok,but i don’t know why?

Pen T. wrote:

[email protected]:~$ irb -I ib-ruby/trunk
irb(main):001:0> require ‘datatypes’
NameError: uninitialized constant IB::Logger
from ./ib-ruby/trunk/datatypes.rb:27

Well, I only suggested require ‘datatypes’ because you showed
datatypes.rb as the only file checked out.

Looking on rubyforge, I see there are others. There is an examples/
directory. Use it. The examples say

require ‘ib’

rather than

require ‘datatypes’

(and I see that ib.rb in turn requires iblogger.rb)

hi,everyone,think for your help,it’s ok now

irb -I ib-ruby/trunk
irb(main):001:0> $:.unshift ‘ib-ruby/trunk’
irb(main):002:0> require ‘ib’
=> true
irb(main):005:0> ib = IB::IB.new()
=> #<IB::IB:0xb7638e10
@listeners={IB::IncomingMessages::NextValidID=>[#Proc:[email protected]/ib-ruby/trunk/ib.rb:119]},
@server={:remote_connect_time=>“20100914 08:07:10 EST”, :client_id=> ,
:socket=>#<IB::IBSocket: >, :reader_thread=>#<Thread:0xb7638820 sleep>,
:local_connect_time=>Tue Sep 14 20:07:13 -0400 2010, :version=>49},
@next_order_id=nil, @options={:ip=>“127.0.0.1”, :port=>“7496”},
@connected=true>
irb(main):006:0>
i have read :http://ib-ruby.rubyforge.org/
still don’t know how to use it
for example, if i want to get the stock yhoo(yahoo) qoute from 2010-1-1
till 2010-9-1
date,open,high,low,close,vol
would you mind to tell me to do it?
any advice appreciated.

Pen T. wrote:

in my console,
laptop:~$ svn checkout svn://rubyforge.org/var/svn/ib-ruby
A ib-ruby/trunk
A ib-ruby/trunk/datatypes.rb
A ib-ruby/trunk/LICENSE
require ‘rubygems’
=> true
irb(main):003:0> require ‘ib’
LoadError: no such file to load – ib
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from (irb):3
from :0
what’s wrong?

The library doesn’t have a file called ib.rb, and/or the library’s lib
directory is not in your $LOAD_PATH.

Try:

irb -I ib-ruby/trunk
require ‘datatypes’

Or:

$:.unshift ‘ib-ruby/trunk’
require ‘datatypes’

there is file in “/home/pt/ib-ruby/trunk/ib.rb”
[email protected]:~$ irb
irb(main):001:0> require “/home/pt/ib-ruby/trunk/ib.rb”
LoadError: no such file to load – messages
from /home/pt/ib-ruby/trunk/ib.rb:26:in require' from /home/pt/ib-ruby/trunk/ib.rb:26 from (irb):1:inrequire’
from (irb):1
from :0
irb(main):002:0>
why i can’t require it ?

it’s ok now,

[email protected]:~$ irb
irb(main):001:0> $:.unshift ‘ib-ruby/trunk’
=> [“ib-ruby/trunk”, “/usr/local/lib/site_ruby/1.8”,
“/usr/local/lib/site_ruby/1.8/i486-linux”,
“/usr/local/lib/site_ruby/1.8/i386-linux”, “/usr/local/lib/site_ruby”,
“/usr/lib/ruby/vendor_ruby/1.8”,
“/usr/lib/ruby/vendor_ruby/1.8/i486-linux”, “/usr/lib/ruby/vendor_ruby”,
“/usr/lib/ruby/1.8”, “/usr/lib/ruby/1.8/i486-linux”,
“/usr/lib/ruby/1.8/i386-linux”, “.”]
irb(main):002:0> require ‘ib’
=> true
irb(main):003:0> require ‘datatypes’
=> true
irb(main):004:0>

when i close my irb,re-open it
irb(main):005:0> quit
[email protected]:~$ irb
irb(main):001:0> require ‘ib’
LoadError: no such file to load – ib
from (irb):1:in `require’
from (irb):1
from :0
irb(main):002:0>
i don’t want to input $:.unshift ‘ib-ruby/trunk’ everytime when i
want to use it,how to solve it ?

Pen T. wrote:

i don’t want to input $:.unshift ‘ib-ruby/trunk’ everytime when i
want to use it,how to solve it ?

option 1: start your session with

irb -Iib-ruby/trunk

option 2: put the $:.unshift ‘ib-ruby/trunk’ into a file called boot.rb,
then you just do require ‘boot’ before require ‘ib’

option 3: install the ib gem (and then require ‘rubygems’; require ‘ib’)

option 4: put the session setup into ~/.irbrc [not recommended, you
don’t want all your sessions to have this]

option 5: copy all the ib code into the current directory [messy]

If you are building an application, I would be inclined to make a
vendor/ subdirectory and install ib under that, and have a boot.rb which
adds it to $:. Your app just needs require ‘boot’ at the top.

On Sep 14, 2010, at 21:47 , Pen T. wrote:

why i can’t require it ?
Did you read the error message?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs