2009 Interactive Brokers Collegiate Trading Olympiad

  • Thread starter Thread starter dstefan
  • Start date Start date
I'm trying to run the C++ sample program, but I get a message that the DlgShareAllocation.cpp file cannot be found. If I remove that file from the list of source files, I get error messages that there are unresolved external symbols related to CDlgUnderComp.

Has anyone else dealt with this issue?

I have the same problem. The files DlgShareAllocation.cpp and DlgShareAllocation.h do not exist in the API distribution. Has anyone managed to compile the example C++ socket client?
 
I have never used the C++ API but I want to ask couple of questions. Did you download and install TWS? I assumed you downloaded the SDK also.

Have you looked at this site?

Welcome to StockBotProgramming.com

There are some examples of how to connect to TWS from C++.
 
One additional comment, if you know Java, stick to Java in order to code using the TWS SDK. It's easier and works a little bit better. IIRC, TWS is written in Java and interacts much better with Java programs.
 
1. Yes, I did download and install TWS.

2. I did not see any C++ related SDK to be installed.

3. Yes, I have gone through the C++ tutorials at StockBotProgramming.com, and I was able to use the source code there to connect to TWS and to receive pricing data.

4. However, if I (a) add c:\ib_api_9_51\shared\ and c:\ib_api_9_51\socketclient\ to the include files directory and the library files directory and (b) put directives in my main file to #include <ewrapper.h> and #include <esocketclient.h>, then, when I try to compile, I get a ton of error messages saying that there are syntax errors in the commondefs.h, ewrapper.h and esocketclient.h files.


I have never used the C++ API but I want to ask couple of questions. Did you download and install TWS? I assumed you downloaded the SDK also.

Have you looked at this site?

Welcome to StockBotProgramming.com

There are some examples of how to connect to TWS from C++.
 
Ross, is the winsock library in the list of libraries to link against? This was an old problem with earlier versions of VS. I don't know if this problem is still there.
 
Ross, is the winsock library in the list of libraries to link against? This was an old problem with earlier versions of VS. I don't know if this problem is still there.

Sorry, what do you mean by "list of libraries to link against"? Apologies, but I'm a novice.
 
Ross, if you follow the instructions in the link I posted, you already added the right libraries. If you just downloaded the project, just read the instructions again and make sure the setup is correct.

I don't know exactly what the problem is but I will try to look around.
 
Ross, if you follow the instructions in the link I posted, you already added the right libraries. If you just downloaded the project, just read the instructions again and make sure the setup is correct.

I don't know exactly what the problem is but I will try to look around.

If you mean the instruction to "go to Configure Properties->Linker->Input. Add to additional dependencies "WSOCK32.lib"," then, yep, already did that.
 
I'm trying to run the C++ sample program, but I get a message that the DlgShareAllocation.cpp file cannot be found. If I remove that file from the list of source files, I get error messages that there are unresolved external symbols related to CDlgUnderComp.

Has anyone else dealt with this issue?

I finally managed to get the TestSocketClient to compile. Here is what you need to do:

  • Make sure your Visual Studio paths are set (example: Include Files -> C:\IB_API_9_60\Shared and Library Files -> C:\IB_API_9_60\SocketClient\lib)
  • In the TestSocketClient folder, load the client2.dsp into Visual Studio
  • Remove DlgShareAllocation.cpp and DlgShareAllocation.h from the project.
  • From the menu item Project > Add Existing Item add the files DlgAlgoParams.cpp and DlgUnderComp.cpp

Update:

If your client crashes when you try to connect you need to add the two files from the SocketClient\src folder to your project : EClientSocket.cpp and MySocket.cpp

Build the project and you should have a working client that connects to TWS.
 
My commission is 5% of your winnings from the competition. :)

I think it is generally advisable to get them to agree to this BEFORE giving up the goods. :) Otherwise they'll just say "I already figured it out.'

I already figured it out. :) :) :)
 
Trading Plan Deadline in 3 Days

The final deadline for the Olympiad is in 3 days. I'm going to submit a revised trading plan before then but I was hoping to see if anyone could criticize it beforehand. It's copied below, omitting most of the long list of futures contracts which the system will consider (basically everything on the Chicago and NY futures exchanges):

--------------------------------------------------------
Max Dama
University of California Berkeley Haas School of Business
United States of America

Matlab with ActiveX API

Strategy I: Localized Regression, Global Macro Factor Model
Trade a long/short portfolio of the futures listed below. Entry points are determined once per week by a localized regression model based on a support vector machine with a gaussian (RBF) kernel. The three contracts forecasted to outperform (underperform) the most are entered long (short). Each position is exited at the end of the week or by hitting the stop. To control risk, positions are sized to set total weekly value-at-risk (standard deviation of returns) to approximately 12%, therefore each position contributes approximately 2%, with rounding error due to indivisibility of contracts. The stop is set 1-SD, 2.5% by construction, below (above) the entry price for long (short) positions. Normal entry and exit will use market orders.
This strategy makes money by exploiting information in price movements among many different contracts, which can be interpreted as macroeconomic factors. It exploits the inefficiency of human traders to correlate the data from >10 diverse streams. The strategy has the advantage of being adaptive due to weekly retraining on fresh data.

Exchange: CBOE
Contracts:
VXD CBOE DJIA VOLATILITY INDEX DV
VXN CBOE NDX VOLATILITY INDEX VN
VT CBOE S&P 500 THREE MONTH VARIANCE VT
IIK CBOE S&P 500 TWELVE MONTH VARIANCE VA
VIX CBOE VOLATILITY INDEX VX
RVX RUSSELL 2000 VOLATILITY INDEX VR

Exchange: CBOT
Contracts:
SR 10 YEAR SWAP FUTURES SR
ZN 10 YEAR US TREASURY NOTE ZN
...
...
-------------------------------------------------------------

Thanks for your input. In case it helps, the full plan including the rest of the list is on my blog, maxdama.com. I hope some others are ready to go because this is basically the deadline and yet there haven't been many messages here recently. If you're participating, I'd like to talk about the API and competition mechanics.
 
Hi all,
does anyone have an idea on how to disable TWS's auto logoff feature? It's not very convenient to set up every night and if once I forget to do it ...ahh, you know :)

Max: I've read your trading plan and seems to be nice for me, but futures is not where I would take my step, not because of their nature, but because I'm not (yet) experienced in futures trading.

I'm also interested in algorithmic trading, and found your blog very informative (altough I hadn't had so much time to read it through) and I would talk about the API, the competition, algo trading with you, drop me an email blaze dot david at ymail.com, if interested!
 
Hi all,
does anyone have an idea on how to disable TWS's auto logoff feature? It's not very convenient to set up every night and if once I forget to do it ...ahh, you know :)

Everything I have read on various forums suggests that the ridiculous auto logoff cannot be disabled. If you hear otherwise, let me know. There are scripts available for auto login but I haven't tried them yet.
 
Max, that strategy seems pretty interesting but, in my experience, it will be hard to win with such a strategy.
 
alain,

Thanks for reading. I am not so much going for the $100,000 as I am just trying to learn. It's great to have free access to data for participating.
 
If that the case, you are doing the right thing. It is a great opportunity to learn.
 
Max,

You plan looks good but I would include a sentence to allow you to execute this strategy with a smaller timeframe (1 to 3 day?) and lower SD in case you are close to the winners but need more exposure to the market to place. It's always good to have the flexibility even if you decide not to use the shorter time frame near the end of the contest.
 
Back
Top Bottom