Interactive Brokers TraderWorkstation C++ API - A simple program to Close All Positions.

The aim of the software "TradeCloser" is to close all positions on interactive brokers i.e. it emulates the same functionality as the Trade --> Close All Positions. The program will perform this at a set time and manner (specified on the command line), and output trade and related data to text files before the program then quits.

The program must compile on windows using a freely available compiler. The program will run from the command line. The program is intended to be run once per day on a daily basis. The program will first connect to TWS using the C++ API. It must be able to connect to a “Friends & Family” type account. Moreover, there may be existing connections with TWS (e.g. to other trading software) which the program must not interfere with.

When run from the command line, the following options may be applied:

-t HH:MM This is the Close Time – the time at which all trades will be closed. The default will be 20:35. The time is the time specified by Interactive Brokers.

-m REL|MKT This is the Close Method. If the type is REL, then an optional offset needs to be applied. E.g. the script will be run as “TradeCloser –t 20:35 –m REL 0.01”. The default offset should be 0.01.

-f FileLocation. Location for some output files. “C:\iPEAD” by default

The program will close all positions according to the above parameters.

Finally, the script will perform some housekeeping & data collection functions for the trades. Data is exported to tab delimited text files. The folder for the location of these files will be “C:\iPEAD” by default. There are two output files, as follows:

1) It will output the summary of the days trades. This is essentially equivalent to the text Output of the Trades Summary from TWS. E.g. by doing: Account-->Trade Log --> File-->Export Displayed Summary.

This will be exported to a filename “[url removed, login to view]”

2) The program will next collect trade data and market data for each closed position, and output this data to a text file. It will output a text file with the following filename:

[url removed, login to view]

This will include various data for each trade and associated market data. It is a tab delimited file. The first line is a header line, with each subsequent line representing a a unique ticker. The header is as follows:

Ticker CloseDate CloseTime OrderType OrderAction OrderFillTime ExitFillPrice Spread Open High Low Close 5Open 5High 5Low 5Close

Each field/column in the file is as follows:

Ticker – The symbol/ticker.

CloseDate – Todays Date

CloseTime - As entered from the program command line e.g. 20:35 by default

OrderType – The type of close specified by the command line e.g. LMT/REL

OrderAction – The direction in which the close was performed (e.g. BUY/SELL)

OrderFillTime – The time the exit order was filled

ExitFillPrice – The average price at which the order was filled

Spread - The difference between the ask and bid price, at the time at which the close was initiated (e.g. at time 20:35 by default)

Open - The Opening price for the minute in which the close was initiated

High - The high price “”



5Open - The opening price for the 5 minute bar in which the close was initiated (this will be the same as the field “Open” above)

5High - The high price for the 5 minute bar in which the close was intitiated (e.g. by default, the high of the bar from 20:35-20:40)



Thus, the program will need to collect data from the 5 minute bar *after* the specified close time. Therefore, the above output files will not be written until more than 5 minutes after the specified close time (e.g. after the close of the bar at 20:40 by default). The program will then close down.

Finally, if bidders could start their bid with the words (AntiMatter- ), then I know you have actually properly read the project outline ;-)

Skills: C++ Programming

See more: api close position, ticker line, programming symbol, it positions, i.t. positions, cplusplus set, antimatter, symbol family, all trade, c programming compiler, buy sell on line, simple program, program for interactive brokers api, INteractive Brokers, interactive api, housekeeping, c#api, Brokers, daily collection software, log api, tab delimited text, api programming tws, program interactive brokers api, options trading software, interactive brokers api market data

About the Employer:
( 23 reviews ) Oxford, United Kingdom

Project ID: #4498426

6 freelancers are bidding on average $693 for this job


(AntiMatter- ) Dear sir, I do have extensive experience with IBs API and I would be glad to help you. For more details on my experience and portfolio please check your PM.

$666 USD in 5 days
(1 Review)

please check my pm

$263 USD in 7 days
(0 Reviews)

Intresting project ... i would love to work on it ..but need some time to completely review the api and other details

$1578 USD in 21 days
(0 Reviews)

I have a very good understanding of C++ language and have full confidence in executing the project successfully.

$555 USD in 3 days
(0 Reviews)

Hi, I have extensive experience in C++. Best Regards, Eugene.

$305 USD in 9 days
(0 Reviews)

AntiMatter, more on the pm thanks

$555 USD in 3 days
(0 Reviews)

(AntiMatter- ) Please see PM. I have 10 years working experience in software development...

$500 USD in 4 days
(0 Reviews)