This is a tournament where you submit the source code for a stock trading bot- implemented as a Dll.
- Weekly results.
To enter, create a bot as a Dynamic Link Library in C, C++ or C# - skeleton source code for a bot is provided. The compiled dlls are run by a master program that handles all of the virtual trading. Once a week your bot will be called 480 times to buy or sell shares (or both) at the same time as all other bots. Your net worth (ie profit and loss) will determine your position in the table.
After all bots have made their decision, the price is adjusted based on the aggregate sales/purchases. Shares also change according to information in the feed.
The articles below provide detail and downloads.
- A General article about writing a bot for the contest
- How to Write a Bot in C and C++
- How to Write a Bot in C#
Player Entries
When you first submit the bot dll source code you will be assigned an entry number and your files will be renamed bot23.c, bot42.cpp etc. I'll acknowledge each entry as it is submitted with your player number. You can re-submit new source code, but make sure it uses this same player number. The most recent submitted entry will be used. Do not send compiled code, just source code.Your Bot
Try and think of an imaginative name for your bot 20 characters or less long and nothing naughty or bad.The 100 Companies
Not real companies these are numbered 00-99. Each company specializes in one of ten industrial sectors- A-Automotive
- B-Banking
- C-Commodities
- E-Electronics
- F-Food/Drink
- I-Internet
- M-Manufacturing
- R-Retail
- T-Transport
- U-Utilities (Water, Power etc).
Share Prices
Each company has a million shares and start worth $10 a share. Your bot starts with $25,000. Every hundred shares bought in a company moves that company's share price up by 10c, selling them drops the price by 10c per 100 shares.Business News Feed
Every minute, before bots are called, news items will come in and are passed to your bot as a string called Feed. This happens before the share prices are affected by the news. These consist of a sector A etc with +,++ or ++ or -,-- and --. Eg A--- is very bad, A+ is mildly good.At the end of each minute, All companies with primary or secondary sectors affected by the business news will have their prices adjusted. For primary attributes a single + or - will move the price up or down by 10c, ++-- by 50c and +++--- by $1. For secondary attributes these effects are halved. Eg a firm with FT wil be affected by F+++ T-- by having its price change by 75c ($1 - 25c). If the firm was TF then the price would stay the same. (Down 50c for T-- and up 50c for F+++).
The Collar
No share price can drop below $1 or exceed $1000. If it reaches $1000, it will split 2 for 1 with each share now worth $500. If your bot had 50 shares that hit $1000 then it would now have 100 shares worth $500 each. If the share price moves below 1 then it is declared bankrupt and shares in it are worth 0. If you had 50,000 shares in a company that were worth $10 last week and it goes bankrupt this week then you lose $500,000!Long and Short Positions
A long position means you own shares that you have bought. Short position means you owe shares that you have sold (without owning them). You can hold a long position for as long as you wish but short positions will be closed off at the end of day. If your bot lacks enough cash to buy these shares back then shares you own are sold to make up the difference (A's first then Bs etc). If that fails to close your short position then your bot is bankrupt and out of the Challenge. If you are made bankrupt then you start again next week with $10,000.Short Selling
Your bot can "Short Sell". This means selling shares that you don't own. In practice it is done by borrowing shares from the broker in the expectation that the company will decline in value and the shares will be worth less. You then buy them back and make a profit. However you can only short sell if there are shares available to buy for that company. You can only short sell up to half your current worth which is your cash + value of any shares you own - value of any shares you owe.Dividends and Trading Costs
The brokers let you buy or sell shares without charging fees.Profit and Loss (P&L)
This is how much the value of your cash + any shares you hold is worth minus any you owe (see Short Selling). Shares are "Marked to Market" i.e. valued using the price of shares at the end of the day. These prices are the opening price of shares on the next day. Where your bot lies in the league table depends purely on your P&L.Rules
This is for glory only. About.com does not permit prizes to be given.Please submit your source code to the cplus.guide@about.com email address with the subject line Ongoing Programming Challenge 1. It must compile with Microsoft Visual C++ 2005/2008 Express Edition/Microsoft Visual Studio 2003/2005/2008 or Borland Turbo C++ Explorer, Microsoft Visual C# 2005/2008 Express Edition. If it doesn't compile, it can't be run so is automatically disqualified from this week's run. You can submit another entry at any time.
Please include your name, age (optional), blog/website url (optional) and country. Your email address will not be kept, used or displayed except to acknowledge your challenge entry. You can submit a new or changed bot each week.
Each week the results page, with the current state of the score board will be updated. It is a condition of entry that the source code for the #1 position program each week be made downloadable (but this will be delayed by one week) so that others can study it, learn from it and perhaps beat it.
Above all this is for fun, so enjoy it!

