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

This project received 6 bids from talented freelancers with an average bid price of $693 USD.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
Total Bids
Project Description

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 [url removed, login to view]”. 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 ;-)

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online