Bash script to fetch data from IB TWS and output to csv

Web, Mobile & Software Dev Scripts & Utilities Posted 3 years ago

Fixed Price

Budget: $100
Delivery by March 8, 2013

Start Date

February 27, 2013



The job is to create a bash script to fetch options historical data from Interactive Brokers TWS.
1. The individual stock symbols are in a csv file.
2. Then the options chains for the symbols have to be fetched with twstools. ( )
3. Then the options historical data will have to be fetched from IB TWS and output to a csv file in the format. The name of the csv file should be "optionsymbol.csv"
Speed to complete the task is not important but a quality job and extremely good documentation is vital. When this job is completed I am looking for some more help working with the csv-files and R.

Please describe if you have done similar work before.

Full ssh access to a server with all the required tools will be provided so you will be able to start work without need to set up anything.

Here is a sample bash-script to retrieve forex data and write it out to csv-files.
The thing that would have to be changed is to get the options contracts and then data for them instead of forex and write it out to individual csv files.

As you can see twstools does most of the datahandling so the script part is relatively simple.

nk@i5:~/twstools/twstools/sample$ cat

# change your host/port
TWSDO="twsdo -h -p 7496 --maxRequests=30 --pacingInterval=305000"

# get some contract details
${TWSDO} ${WORK_CONTRACTS}  > out_forex_contracts.xml   \
        || exit 1

# create historical data requests for these contracts
twsgen -H -b "15 mins" -w "BID_ASK" out_forex_contracts.xml  > out_forex_work_hist.xml  \
        || exit 1

# process the hist data job
${TWSDO} out_forex_work_hist.xml  > out_forex_hist.xml  \
        || exit 1

# convert to csv and sort traded and quotes into different files
twsgen -C  out_forex_hist.xml  |grep "^BA" | sort |uniq > out_forex_quotes.csv


Skills: linux

  • Other Skills:

Activity on this Job

Last Viewed by Client: 3 years ago

Invites Sent: 0

Unanswered Invites: 0

Hired: 1

About the Client

(4.38) 55 reviews

Tallinn 10:27 PM

127 Jobs Posted
67% Hire Rate, 1 Open Job

Over $10,000 Total Spent
103 Hires, 2 Active

$16.01/hr Avg Hourly Rate Paid
328 Hours

Member Since Nov 15, 2011