Giter Club home page Giter Club logo

Comments (2)

topofocus avatar topofocus commented on August 16, 2024

Hi,
I was unable to run the tests after applying the changes.
Got

newdevel:~/workspace/ib-api$ bundle exec guard
18:46:25 - INFO - Guard::RSpec is running
18:46:25 - INFO - Guard is now watching at '/home/ubuntu/workspace/ib-api'
18:46:54 - INFO - Running: spec/ib/connect_spec.rb

An error occurred while loading spec_helper.
Failure/Error: self::Classes[message_id] = message_class

FrozenError:
  can't modify frozen Hash
# ./lib/ib/messages/abstract_message.rb:92:in `def_message'
# ./lib/ib/messages/outgoing.rb:20:in `<module:Outgoing>'
# ./lib/ib/messages/outgoing.rb:8:in `<module:Messages>'
# ./lib/ib/messages/outgoing.rb:6:in `<module:IB>'
# ./lib/ib/messages/outgoing.rb:5:in `<top (required)>'
# ./lib/ib/messages.rb:11:in `require'
# ./lib/ib/messages.rb:11:in `<top (required)>'
# ./lib/ib/connection.rb:4:in `require'
# ./lib/ib/connection.rb:4:in `<top (required)>'
# ./lib/requires.rb:8:in `require'
# ./lib/requires.rb:8:in `<top (required)>'
# ./lib/ib-api.rb:6:in `require'
# ./lib/ib-api.rb:6:in `<top (required)>'
# ./spec/spec_helper.rb:7:in `require'
# ./spec/spec_helper.rb:7:in `<top (required)>'

revoked the merge into to master branch.

Lets look together, what went wrong (mail me: topofocus@gmail,com)

from ib-api.

topofocus avatar topofocus commented on August 16, 2024

Hi,
using the improved random id generation I run in some trouble

newdevel:~/workspace/ib-api/bin$ ./console 

>> IB-Core Interactive Console <<
---------------------------------------------

Namespace is IB ! 

---------------------------------------------
Connected to server, version: 137,
 connection time: 2020-10-15 12:47:44 +0000 local, 2020-10-15T12:47:43+00:00 remote.
< ManagedAccounts: DF167347 - DU167348 - DU167349>
TWS Warning 2107: HMDS data farm connection is inactive but should be available upon demand.ushmds
newdevel:~/workspace/ib-api/bin$ 

the console does not start

First I changed the method name to 'generate', because ib-api at some point tests if a Constant responds to call.

Same result.

When i switched bach to `random 99999' anything works fine again.
Then

newdevel:~/workspace/ib-api/lib$ grep -rn random_id .
./ib/connection.rb:44:                   client_id: random_id,
./ib/connection.rb:179:        id = random_id
./ib/connection.rb:416:		def random_id

leads to the solution: random_id is also used to generate id's for the received-array, where messages arriving from the tws are stored.

   def subscribe *args, &block
      @subscribe_lock.synchronize do
        subscriber = args.last.respond_to?(:call) ? args.pop : block
        id = random_id

Then this experiment reveals the problem.
Modifiying random_it to

		def random_id
			puts SafeRandIdGenerator.generate
			rand 9999
		end

ans subsequent usage of the console
``'`
newdevel:~/workspace/ib-api/bin$ ./console

IB-Core Interactive Console

Namespace is IB !


25967018522
25967018522
25967018522
25967018522
25967018522
25967018522
Connected to server, version: 137,
connection time: 2020-10-15 13:03:38 +0000 local, 2020-10-15T13:03:37+00:00 remote.
< ManagedAccounts: DF167347 - DU167348 - DU167349>
Got next valid order id: 14.


exploits that tws-messages went to only one received-array-entry. 

No wonder, that the application crashes.

from ib-api.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.