Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Twsapi
- Messages
Search
Connect to TWS in main not in Thread (Java)
twsapi
Hi board,
I have a question regarding the thread programming in Java with the IB API. In the example application (Example 1) you see that first the main class is called and within that class a new thread is called e.g. new Example1(args[0]).start(); If I move the connect call to TWS e.g. connectToTWS(); into the main class the thread will not see/be able to access the open connection to TWS. My question is now, why is the thread not able to use the opened connection within main but need its own connection call? And can I actually use just one connection call in main to be used by multiple threads? What I want to achieve is that the main class opens the initial call to TWS and holds this open while different threads can use this open connection. As every call of connectToTWS(); requires me to allow access in the TWS client I only want to authorize my program once not every time a thread actually opens the connection. Not much of automation when I need to authorize it manually every time :) Thanks so much for your help! Regards |
Re: The following jar files is missing from the classpath: hsqldb.jar
BeeJay (GMX)
I'm using TWS 938.1 which starts and runs flawlessly if I open it bySorry, I dont use IBController. But there are a lot of users here which can help you how to change the classpath for the TWS in IBController. I do see the total.2012.jar file in C:\jts directory.-Dsun.java2d.noddraw=true -Xmx512M -XX:MaxPermSize=128M jclient/LoginFrame C:\jts |
Re: TWS API child order questions
Ed
If I remember right he was talking about a limit order which of course
toggle quoted message
Show quoted text
will sit until the price is met. Market orders in liquid markets are essentially instantaneous. On 7/12/2013 2:23 PM, cf16r wrote:
|
Re: Compiling TestSocketClient
bbbvvgtm
--- In TWSAPI@..., bbbvvgtm <no_reply@...> wrote:
Whoops. Forgot one thing you need to do if you want to disable the "Accept incoming connection attempt" message TWS gives you when you try to connect. (This makes full automation easier.) In Trader Workstation, click on Edit-Global Configuration, then click on "General". Under "Trusted IP Addresses", click "Create" and add "127.0.0.1" then click on "OK" to save it. |
Compiling TestSocketClient
bbbvvgtm
I just downloaded the latest versions from IB. I wanted to compile/run/modify TestSocketClient, but ran into a couple of minor gotchas. So, I decided to document it in case someone else finds it useful.
I started with IB's Getting Started document: I had some troubles in a couple of areas, so this is my getting started HowTo. Download and install the standalone desktop version of IB's Trader Workstation Start Trader Workstation Click on Edit-Global Configuration Make sure "Enable ActiveX and Socket Clients" checkbox is checked Note the number in "Socket port." (Here I will assume it's 7499.) Click "OK" to save the settings Download and install the IB API Create a new folder for your program. (Here I will assume it's C:\MyTestProgram.) Copy the following folders (and sub-folders) from IB's API location: Shared SocketClient TestSocketClient Launch Microsoft Visual Studio 2010 Professional Edition Hopefully 2008 and 2012 also work. I don't believe the Express Edition includes MFC and therefore will not work. Click on File - New - Project From Existing Code... What type of project would you like to create? → Visual C++ Click on "Next" Project file location: Browse to your folder (here C:\MyTestProgram). Project Name: MyTestProgram Click on "Next" Check the checkbox "Add support for MFC" Click on "Finish" Wait until your program is setup Click on Project – Properties (or you can right click on MyTestProgram in the Solution Explorer and choose Properties) Under Configuration Properties – C/C++ - General For "Additional Include Directories", enter "./Shared;./SocketClient/src" Do this for both "Debug" and "Release" (Configuration: at top) Under Configuration Properties – C/C++ - Code Generation For "Runtime Libraries", choose "Multi-Threaded DLL (/MD)" Do this for both "Debug" and "Release" (Configuration: at top) You should now be able to Build both the Debug and Release versions Run the program, (in the debugger or C:\MyTestProgram\Release\MyTestProgram.exe) Click on "Connect..." Change "Port" to the Socket Port noted above (7499). Click on "Req Mkt Data..." Change "Symbol" to "IBM" (or whatever) Click on "OK" You should now see IBM data being displayed You can a lot of what is happening in the file "client2Dlg.cpp" |
Re: problem with contract details
dairen62
i received exactly the same answer... hope for a quick solution :)
toggle quoted message
Show quoted text
--- In TWSAPI@..., clove2hitch <no_reply@...> wrote:
|
Re: The following jar files is missing from the classpath: hsqldb.jar
Thanks for your assistance with this. I tried starting TWS from the IB website. The script seemed to run a litle further after that as the username and password were entered and a log in attempt was made but then the same hsqldb message came up.
toggle quoted message
Show quoted text
I'm using TWS 938.1 which starts and runs flawlessly if I open it by using the TWS icon on the desktop. I'm also using IBControllerV2-9-0 with the default command line. I must admit I don't even know where the command line can be found. I opened various files and did not see anything which looks like what has been posted in this thread. Which file contains the command line? I do see the total.2012.jar file in C:\jts directory. Thanks David --- In TWSAPI@..., "BeeJay (GMX)" <bee_jay61@...> wrote:
|
Re: problem with contract details
clove2hitch
just got an answer from IB API support.
1 minute issue should be solved in near future(when???) Unfortunately IB imposes limitations on the amount of contracts --- In TWSAPI@..., clove2hitch <no_reply@...> wrote:
|
The following jar files is missing from the classpath: hsqldb.jar
btw12342001
Thanks for the info. I'm using 927.7. I don't usually upgrade as long as everything is working and IB doesn't force me to.
toggle quoted message
Show quoted text
--- In TWSAPI@..., "BeeJay (GMX)" <bee_jay61@...> wrote:
|
Re: problem with contract details
clove2hitch
Hi, i experience same issues!
toggle quoted message
Show quoted text
the first request answers quickly then a second after 1 minute then nothing... :-( I updated TWS and API to use latest stuff but even worse with the <>clients.exe crash (previous API clients versions don't crash). I'm going to log the issue to IB. Regards CH --- In TWSAPI@..., dairen62 <no_reply@...> wrote:
|
Re: Need Information Regarding FIll Or Kill Order
If you have the same problem when using TWS alone, it is not an API problem.
toggle quoted message
Show quoted text
You might still get help here but it is technically off-topic. Problems should always be addressed in TWS first before API questions become relevant. Otherwise you look in the wrong place for most problems. It is a common mistake. First try things in TWS. Second if you have problems with your code, try things in the API demo apps if possible. In your own code make sure you are receiving error callbacks (and logging or otherwise recording the information) so you can report all appropriate information when you post a question. You do not explain what you mean by "unable to get FOK value" when using TWS alone. If FOK simply does not show up in the popup list, then you probably have not enabled it in the Features under your TWS configuration. At the moment I'm running IB Gateway so I can only run TWS in demo mode. But there I see what I previously suggested to you. Under Configuration > Features > Order Management > Time-in-Force you must make sure Fill-or-Kill is checked. Is this your problem? The curious thing is that IB Gateway does not seem to provide the Features section. Perhaps this means all such features are turned on in IB Gateway. If so using the Gateway might be something else for you to try, at least to get more information, if necessary. -K On 7/12/13 12:24 AM, "narasingarao_kavali" <no_reply@...> wrote:
|
Re: Need Information Regarding FIll Or Kill Order
narasingarao_kavali
Hi Kurt,
toggle quoted message
Show quoted text
Yes, i am placing order with API (with ActiveX API) from the above link, we can place an order for stock for FOK Orders. i have subscribed for Stock Instruments and placed order from my Application with FOK as TimeinForce. but in IB TWS it is showing as Limit Order with Day as the TimeinForce. i have done same process in IB TWS also. but i am unable to get the FOK value in TimeinForce for Stock also. so, is there any scrip available to test this FOK order. ?? --- In TWSAPI@..., Kurt Bigler <kkb@...> wrote:
|
Re: The following jar files is missing from the classpath: hsqldb.jar
BeeJay (GMX)
If you post the the command you use to start the TWS, you should also mention the TWS version number, cause this command is for older TWS versions.
toggle quoted message
Show quoted text
Most JAR files are now stored in one single JAR file: "total.2012.jar". A more recent command is: C:\WINDOWS\system32\javaw.exe -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame C:\Jts Can you start TWS normally without using IBController? I don't use |
Re: The following jar files is missing from the classpath: hsqldb.jar
btw12342001
Can you start TWS normally without using IBController? I don't use that so am not sure how it works. The command I use to start TWS is the default from the installation script.
toggle quoted message
Show quoted text
C:\WINDOWS\system32\javaw.exe -cp jts.jar;hsqldb.jar;jcommon-1.0.12.jar;jfreechart-1.0.9.jar;jhall.jar;other.jar;rss.jar -Dsun.java2d.noddraw=true -Xmx512M -XX:MaxPermSize=128M jclient/LoginFrame C:\jts --- In TWSAPI@..., "DavidP" <af402469@...> wrote:
|
Re: The following jar files is missing from the classpath: hsqldb.jar
Thanks for the reply, yes the file is in C:\jts. The file I am using is hsqldb-1.7.3.3 I also have the folder hsqldb-2.3.0 with its contents as downloaded off the web. I run sampleIBControllerStart and then it brings up the error message.
toggle quoted message
Show quoted text
--- In TWSAPI@..., "btw12342001" <newguy@...> wrote:
|
Re: The following jar files is missing from the classpath: hsqldb.jar
vanx23_alias
Hi David,
I do format one of the computer's partitions and re-install everything from scratch every 6 months. I stumble into this error each time. At first, I was puzzled with this and was wondering what I was doing wrong. I couldn't pinpoint the root cause of this, but I found out that running another web based java application will miraculously make the web based TWS find everything it needs. This bug is easy to reproduce: 1) Format partition 2) Install OS and all required updates (In my case: Windows Server 2008 R2-x64) 3) Install latest Java Virtual machine (In my case: Java x86) 4) Make sure the Java plugging is working fine, by using the "Java Version Verifier" on the Java web site. 5) Finally, try lauching TWS from the InteractiveBrokers web site. Result: Boom! The missing jar's components will appears. After running the TMX's QuoteStream java web application, from QuoteMedia, everything will work fine for TWS. This is NOT something new. As far as I remember, I've been having this error for at least 2 years now. I've always wanted to report this bug to IB. Then, having the burden to prove IB the bug is on their side, kept my procrastinating to report it. As far as I have a work around, I keep procrastinating. I'm surprised that not much people have come across this bug. On the other hand, I guess not much people run TWS, as the first Java application, right of the bat, after having re-install and setup the OS. I know it's not a solution per say. But it may help you to stop searching for something wrong in your installation, which I'm sure is perfectly fine. As a side note: Although I've been silently monitoring this forum for more than a year now, I would like to take the opportunity of this first post/reply to salute all the contributors. Comments on this forum are always constructive, which is much appreciated. Regards, Mike --- In TWSAPI@..., "DavidP" <af402469@...> wrote:
|
Re: The following jar files is missing from the classpath: hsqldb.jar
btw12342001
You don't mention if you actually have the file. The default location in in the \jts directory.
toggle quoted message
Show quoted text
--- In TWSAPI@..., "DavidP" <af402469@...> wrote:
|
Re: Need Information Regarding FIll Or Kill Order
What you are stating is not quite clear.
On 7/11/13 3:36 AM, "narasingarao_kavali" <no_reply@...> wrote: Dear Friends,Do you mean you are placing an order via the API? You are specifying "FOK" in timeinforce? butWhat do you mean by showing? The Order echoed back to you by order callbacks does not match the Order you passed to placeOrder? The only think I can think of is maybe TWS requires that you enable the order feature in order to use it via the API. Have you tried placing the same order via TWS? -Kurt as limit order (LMT) with DAY as Time in Force instead of |
to navigate to use esc to dismiss