How to Load Option Chains from thinkorswim to Databases
thinkorswim is a very popular and awesome trading platform.
thinkorswim has fantastic features for traders with a technical background and allows easily getting real-time data for stocks, options and pairs in Microsoft Excel.
If you have no opened account, definitely try. You are welcome to point me as a referrer. My account name is Vaselenko.
The RTD.DB product allows updating databases using thinkorswim data via Excel formulas and has preconfigured databases.
Here is an example of loaded option data:
As you can see, thinkorswim has not only standard option chain data but also greeks, calculated implied volatility, probabilities, etc.
Here is a screenshot of the RTD.DB main screen:
As you can see, RTD.DB updates 4008 option contracts (rows) in the OptionDayHistoryTOS table.
We have successfully tested loading data for 40K option contracts also.
Below you can find steps to configure your database to get option data from thinkorswim:
- Install and test RTD.DB.
- Create an RTD database on your server.
- Configure a connection to your server.
- Configure updated database tables.
- Configure a list of option contracts to refresh.
Installing and Testing RTD.DB
Quick start steps:
- Download and install RTD.DB.
- Run RTD.DB using the link from 'Start, All Programs, Gartle, RTD.DB'.
You will see the following application screen:
RTD.DB will start updating the preconfigured local Microsoft SQL Server Compact database with data from Yahoo Finance for currencies, stocks, and options.
For example, you can see the OptionDayHistoryYahoo table.
Click the Stop button.
Creating RTD Database
Steps:
- Open the folder of the unzipped download package.
- Open the RTD Database folder and open a folder for the target database platform.
- Run the 1-edit-config.cmd batch file and edit the connection strings to your database server.
- Run the 2-create-database.cmd batch file.
- Run the 3-rtd-setup.cmd batch file.
- Run the 4-rtd-list.cmd batch file.
- Run the 5-rtd-grant.cmd batch file.
As a result, you will have the RTD database on your target server.
If the files have other names, please, read the readme.txt in the setup folder.
Configuring Connections
Steps:
- Run RTD.DB if it is not started.
- Click the Connections button.
- Edit and enable the connection string to your server and disable the default SQL Server Compact database.
- Click the Save button and close the application.
- Click the RTD.DB Stop button and then click the Start button.
Here is a screenshot of the gConnectionManager application used for editing connecting strings.
Configuring Updated Database Tables
The RTD database contains preconfigured tables for loading various data from various data sources with various time frames.
Steps to activate or deactivate loading data:
- Open the RTD database in your database manager.
- Open the rtd.RealTimeTables (rtd.real_time_tables) table in edit mode.
- Set 1 into the IS_DISABLED column to disable loading and set the value to NULL to enable loading.
For thinkorswim, activate the OptionDayHistoryTOS table. - Save changes.
- Click the RTD.DB Stop button and then click the Start button.
Here is an example of the table for Microsoft SQL Server:
See RTD.DB Database Configuration about configuration tables.
Editing Configuration Tables in Microsoft Excel
You can use Microsoft Excel to edit configuration tables if you have SaveToDB add-in installed.
Preparation steps:
- Open Microsoft Excel.
- Open the RTD Workbooks folder in the downloaded package.
- Open the workbook for your target server. For example, rtd-mysql.xlsx for MySQL.
- Open the SaveToDB tab, click Wizards menu, Change Connection Wizard.
- Specify a server, a database, and database credentials for your database. Click Next.
- Click Finish to change connections for the selected tables.
- Save the workbook to your location.
Configuration steps:
- Open the prepared workbook connected to your database.
- Open the RealTimeTables worksheet.
- Open the SaveToDB tab and click the Reload button.
- Set 1 into the IS_DISABLED column to disable loading and clear the value to enable loading.
- Open the SaveToDB tab and click the Save button.
Configuring List of Option Contracts to Refresh
As you can see above, option tables for thinkorswim are configured with the following code in the LOAD_CODE field:
SELECT Code FROM rtd.OptionListTOS
You can change this SQL code for loading option codes from your existing table.
Or you can use the preconfigured rtd.OptionListTOS table.
The rtd.OptionListTOS table contains test option codes:
You can insert required option codes into the table using any available method.
Note that you can use the workbook prepared in the previous step.
Copy the OptionListYahoo worksheet to a new one, rename it to OptionListTOS, click SaveToDB, Wizards, Data Connection
Wizard, and connect to the rtd.OptionListTOS table.
Note that you have to remove expired option codes from the table also.
Different editions of RTD.DB have different limits for a number of updated option codes.
The Personal edition ($100) allows updating option codes for up to 1000 stocks.
See RTD.DB Edition Comparison for details.
Getting Option Codes
RTD.DB loads option data for specified option codes. It does not load entire option chains automatically.
So if you need to load all option contracts for the specified symbols, you can use any solution to get option codes, for example, from Yahoo Finance, and to insert them into the rtd.OptionListTOS table.
You can solve this task using Market Data Downloader.
For example, for SQL Server, you can add the following SQL code to insert option codes from the OptionContacts table:
INSERT INTO RTD.rtd.OptionListTOS (Code) SELECT c.Code FROM ( SELECT '.' + c.Symbol + CONVERT(char(6), c.ExpDate, 12) + c.[Type] + CAST(CAST(c.Strike AS float) AS varchar) AS Code FROM MarketData.yahoo.OptionContracts c WHERE c.ExpDate > GETDATE() ) c LEFT OUTER JOIN RTD.rtd.OptionListTOS t ON t.Code = c.Code COLLATE SQL_Latin1_General_CP1_CI_AS WHERE t.Code IS NULL
Downloads
Products for Traders and Investors | |
---|---|
RTD.DB
The app saves data from trading platforms like Thinkorswim to databases Version: 5.25 | 04/30/2024 | 12.8MB | Getting Started | What's New | Edition Comparison |
Download |
MARKET.CSV
The app loads data from Yahoo Finance and MSN Money to CSV and SQL Server Version: 2.25 | 04/29/2024 | 1.5MB | Getting Started | What's New | Edition Comparison |
Download |
Disclaimer
thinkorswim is a registered trademark of TD Ameritrade IP Company.