-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New incoming message code missing from twsIDs.R ? #19
Comments
Hi @PrivacyMatter. Thanks for the report. I may very well have missed that change. As I mentioned in the commit message, I was not able to easily identify the functional changes because of all the formatting changes. I just pushed the two branches I used to compare (1) the version of master Soren's PR was based on, with (2) the changes in his PR. I would really appreciate it if you could take a look at them and see if you can verify that I indeed missed something he changed. |
Hi,
The one clue that I noticed is that when I compare twsIDs on the branch used as the master for Soren's PR to the first version on the branch you used for applying the changes, the file appears in a "renamed" state. Maybe something happened there that I'm missing, but the bottom line is that the changes you made on 113ec06 disappeared together with the file by a following commit on the same branch. A possibly related issue: after pulling the latest version on master, I encountered another problem: I could no longer connect to the server (I'm using the latest IB Gateway version). Some investigation of the logs in gateway indicated that it is probably a mismatch in the memory representation of some structures. Changing `.IBAPI.VERSION` <- 'clientV63' #client Version 63 I was hoping that introducing this line by applying the changes in twsIDs.R will solve the problem, but it doesn't look like it does. Even after I copied the version of twsIDs from commit 113ec06 and rebuilt the library, I cannot connect to the server unless I change the I will appreciate your input on that. Thanks, |
Hi again, Ok, so it seems that there are many additional problems with the message structure and the connection process, as many changes that were done on the lint-censix branch and were not migrated to the trunk, so using twsIDs.R for version 63 does not work either. At the bottom line, the problem seems to be somewhat more complex than I thought:
The easiest way to get the library to work for me at the moment is to revert to twsIDs.R of version 47, and change twsConnect to identify itself as client version 47. That does not match the rest of the code on the trunk that assumes version 63, but so far the functionality that I need happens to work despite this mismatch. |
Thanks for your detailed analysis! I'll review this weekend. |
Thanks again for taking the time to investigate these issues!
Yeah, that is a consequence of how I tried to make the two branches easier to compare. I used I haven't had time to try and replicate your analysis, but I did do some work to try and make the differences more apparent. I just pushed 3 new branches that call
I tried to remove as many of the whitespace changes from Soren's "styled" PR branch. That should make it easier to compare the 3. I haven't tried to compare them yet, and I likely won't have time to do it for a week or so. I'd really appreciate any help! |
Hi, will try to get to it. As I mentioned I think there was a problem at least with twsConnect as things didn’t work right with either versions assigned to, but will try to see if that was solved when I have the time to test/look at it. Not sure exactly when, in the midst of some other things. |
I looked at this and... wow, I missed a lot. Please don't spend time investigating until this gets cleaned up. I started working on it yesterday, and will continue to work on it this week. |
Great, thanks, just saved me some tine I don’t have :)
Drop me a message when things look more stable
And I’ll take a look then.
BTW: there is a tiny bug that was there way before you touched it, so don’t have it in front of me but will look later on and drop a message. Something about using either con[[1]] or conn[[1]], or something similar towards the end of reqMktData. Will check later.
Thanks,
Yossi
…Sent from my iPhone
On Sep 16, 2019, at 7:24 AM, Joshua Ulrich ***@***.***> wrote:
I looked at this and... wow, I missed a lot. Please don't spend time investigating until this gets cleaned up. I started working on it yesterday, and will continue to work on it this week.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi, so i just saw it via github. In Line 206 in d098292
There is using con[[1]] is incorrect, I think. con is defined as conn[[1]] (I.e the actual connection vs the twsConnection object) — see Line 83 in d098292
con or conn[[1]] , I think.
|
The handshake between the server and client changed somewhere between version 47 and 63. Now it needs a START_API message after the client and server versions have been established. The server responds to the START_API message with 1. a managed account message, 2. a next valid ID, and 3. messages with the status of the data farms Soren did not store the server response, so this commit does not recreate his PR verbatim. One major difference: this change does not remove the ewrapper, so the next valid ID is still stored in the ewrapper environment instead of the global environment (as it does in Soren's PR). See #19, see #9.
The two commits I just pushed attempt to restore all the functionality I missed. I'm able to connect to TWS now, and I'm able to pull currency data using the TWS demo. conn <- twsConnect()
currency <- twsCurrency("EUR")
reqMktData(conn, currency)
TWS Message: 2 1 300 Can't find EId with tickerId:1
TWS Message: 2 -1 2108 Market data farm connection is inactive but should be available upon demand.usfuture
TWS Message: 2 -1 2108 Market data farm connection is inactive but should be available upon demand.usfuture
<20190919 07:04:54.339495> id=1 symbol=EUR bidPrice: 1.10704 bidSize: 5000000
<20190919 07:04:54.340327> id=1 symbol=EUR askPrice: 1.10705 askSize: 2995000
<20190919 07:04:54.340815> id=1 symbol=EUR bidSize: 5000000
<20190919 07:04:54.341098> id=1 symbol=EUR askSize: 2995000
<20190919 07:04:54.341475> id=1 symbol=EUR lastSize: 0
<20190919 07:04:54.341817> id=1 symbol=EUR highPrice: 1.10740
<20190919 07:04:54.342205> id=1 symbol=EUR lowPrice: 1.10230
<20190919 07:04:54.342559> id=1 symbol=EUR closePrice: 1.10300
<20190919 07:04:54.343188> id=1 symbol=EUR Halted: 0.0 That's all I was able to test this morning. I'd appreciate any testing you can do. Thanks! |
Thanks Joshua. I am in the midst of extending my use of the library for quite a bit, adding code that also put orders, etc (yes, testing on paper account first); the plus side is that I'll hopefully be able to do quite a deeper / more thorough testing, but OTOH it will probably take a few days till I get to it. One thing that I noticed is that the bug I mentioned in my previous message is still there (using Line 206 in 19695d6
This bug does fire for me, not sure why it doesn't on your tests -- am I missing something? |
I didn't test that line yesterday. I tested it now, and it does not throw an error for me. I agree that it looks like In my tests, EDIT: My comment isn't meant to suggest that I won't make your suggested change. I probably will. |
As for testing: writing the code that uses the library more heavily takes a bit longer than expected (as these things always do); I do hope to have some code that uses the library to monitor and make actual trades with a paper account at some point during next week. That's my highest propriety at the moment in the project I'm working on. Once I have that, it will be a good opportunity to test the latest version on the branch. |
No worries! And thanks for the detailed explanation. I'm going to make your suggested change and close this issue. Please open new issues for new problems you find (one issue per problem). Thanks again for all your contributions! You have been incredibly helpful! |
Hi,
I noticed that commit a9ae056 introduced support for new incoming message types, such as MARKET_DATA_TYPE, COMMISSION_REPORT, etc (codes 58:68) and they are handled in processMsg.R, e.g:
but I do not see these new message codes in twsIDs.R:
I also checked the value of .twsIncomingMSG after installing the latest version and these message indeed seems to be missing, even though the processMsg function does reference them (probably R lazy evaluation is what still allows the code to be built).
Am I missing something, or that these codes were indeed left out?
Thanks.
The text was updated successfully, but these errors were encountered: