
Need a Python API to extract data from the TWS trading platform
- or -
Post a project like this1317
£250(approx. $336)
- Posted:
- Proposals: 7
- Remote
- #3589093
- Awarded
Website Developer, Graphic Designer, Transcriber, Content writer, CAD Expert, Python Developer, Photo Editor, Web Scrapper, JAVA developer, Android developer, Wix/Shopify Expert,

Python | Web Scraping | Software development | API Development | Data Mining | Automation

329189254377872533871747984527048860892962887980
Description
Experience Level: Intermediate
PLS NOTE : In order to code this requirement for me, you will need access to the Interactive Brokers TWS platform with options data feed. If you do not have this, then this job is not a good fit.
I trade on the stock market using the Interactive Brokers TWS platform. I have existing Python scripts that perform various functions. I require a new Python API which downloads historical options data and creates a chart.
As an example, say for the stock AAPL, I require the last two business days worth of data at 10 minute intervals, showing the stock price, and also the price of an At-The-Money straddle (call option price + put option price) and then a chart drawn of the ATM straddle price/stock price for those 2 days.
This job would be relatively easy (less than a days work) for someone who understands the TWS platform platform and has trading experience themselves.
If the charting part is too complex, then I'm happy to have the data in an .csv file and I can just open it in Excel and chart it myself. So, in this case, I'm looking for output like the following in a file :
(Time, APPL stock price, Straddle price, Straddle-price/stock-price)
09:30, 147.2, 8.72, 0.059239
09:40, 148.1, 8.77, .........................
etc
Pls note that the straddle price is "At the Money" - so if the stock is at 147.2, then the straddle will be the price of the Call option + the price of the Put option for the 147 strike (first line above) and if the stock is at 148.1, then the straddle price will be the price of the Call option + the price of the Put option for the 148 strike etc.
Hence the Python script needs to work out the nearest integer for the stock price (147, 148 etc) and then extract data for the THAT strike for the Call and Put prices.
I can give you a head start by giving you a Python script which gets the APPL stock price as required above.
I can also give you a script I've written which gets the option prices.
The problem is that these scripts gives me a data dump for 2 days, and what I need is someone to use IF's/LOOPs to work out "What is the APPL stock price at 09:30? Once you get this then, find the Straddle price for this stock price. Then do the same thing for 09:40, and 09:50 hours etc etc. Then plot a chart of the time against the Straddle price."
The script would need to accept the following variables:
Stock symbol (eg APPL)
Expiry date for the options (eg 13-May-22)
Time interval (eg 10 mins)
Days required (eg 2, for two days worth of historical data, or 1 for just 1 days worth etc)
I provide below a sample of the chart I would like to see. Pls ignore the green and blue lines - I'm only interested in the orange one (mid prices). The horizontal axis shows the dates/times (column 1 in my above data example), and the vertical axis shows the "Straddle-price/stock-price" (column 4 above) as a percentage.
This chart is for a stock called 'CHWY' and the expiry week is 2020-Dec-11 (20201211).
I am using PyCharm and this script needs to work on that.
I trade on the stock market using the Interactive Brokers TWS platform. I have existing Python scripts that perform various functions. I require a new Python API which downloads historical options data and creates a chart.
As an example, say for the stock AAPL, I require the last two business days worth of data at 10 minute intervals, showing the stock price, and also the price of an At-The-Money straddle (call option price + put option price) and then a chart drawn of the ATM straddle price/stock price for those 2 days.
This job would be relatively easy (less than a days work) for someone who understands the TWS platform platform and has trading experience themselves.
If the charting part is too complex, then I'm happy to have the data in an .csv file and I can just open it in Excel and chart it myself. So, in this case, I'm looking for output like the following in a file :
(Time, APPL stock price, Straddle price, Straddle-price/stock-price)
09:30, 147.2, 8.72, 0.059239
09:40, 148.1, 8.77, .........................
etc
Pls note that the straddle price is "At the Money" - so if the stock is at 147.2, then the straddle will be the price of the Call option + the price of the Put option for the 147 strike (first line above) and if the stock is at 148.1, then the straddle price will be the price of the Call option + the price of the Put option for the 148 strike etc.
Hence the Python script needs to work out the nearest integer for the stock price (147, 148 etc) and then extract data for the THAT strike for the Call and Put prices.
I can give you a head start by giving you a Python script which gets the APPL stock price as required above.
I can also give you a script I've written which gets the option prices.
The problem is that these scripts gives me a data dump for 2 days, and what I need is someone to use IF's/LOOPs to work out "What is the APPL stock price at 09:30? Once you get this then, find the Straddle price for this stock price. Then do the same thing for 09:40, and 09:50 hours etc etc. Then plot a chart of the time against the Straddle price."
The script would need to accept the following variables:
Stock symbol (eg APPL)
Expiry date for the options (eg 13-May-22)
Time interval (eg 10 mins)
Days required (eg 2, for two days worth of historical data, or 1 for just 1 days worth etc)
I provide below a sample of the chart I would like to see. Pls ignore the green and blue lines - I'm only interested in the orange one (mid prices). The horizontal axis shows the dates/times (column 1 in my above data example), and the vertical axis shows the "Straddle-price/stock-price" (column 4 above) as a percentage.
This chart is for a stock called 'CHWY' and the expiry week is 2020-Dec-11 (20201211).
I am using PyCharm and this script needs to work on that.
Harry S.
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
12 Jun 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies