Understanding RTD DB Configuration Tables
RTD DB requires two internal configuration tables:
- A table for RTD or DDE formulas.
- A table for updateable tables.
Use the install.sql file located in the RTD Databases folder of the downloaded package to create these tables in any supported database platform.
Refer to the Concept topic for an overview of configuring tables.
Formula Configuration
RTD DB retrieves formula configurations from a table containing the following fields:
- table_schema
- table_name
- column_name
- rtd_formula
- is_disabled
An additional primary key column may be included.
Configuration Data Formats:
table_schema | table_name | column_name | rtd_formula | is_disabled |
---|---|---|---|---|
<Table schema> | <Table name> | <Column name> | <RTD or DDE formula> | 1/0/NULL |
- The table_schema and table_name fields specify the database table.
- The column_name field specifies a column within the database table.
- The rtd_formula column specifies the RTD or DDE formula used to retrieve real-time data.
- The is_disabled field allows for the temporary disabling of field updates without removing the row.
Formulas must follow the same format as Microsoft Excel, but they should include a parameter in square brackets instead of actual tickers.
Example Configuration Table:
table_schema | table_name | column_name | rtd_formula |
---|---|---|---|
rtd | tos_historical_prices | symbol | |
rtd | tos_historical_prices | date | =Date() |
rtd | tos_historical_prices | time | =Time() |
rtd | tos_historical_prices | last | =TOS|LAST![Symbol] |
rtd | tos_historical_prices | change | =TOS|NET_CHANGE![Symbol] |
rtd | tos_historical_prices | percent_change | =TOS|PERCENT_CHANGE![Symbol] |
rtd | tos_historical_prices | open | =TOS|OPEN![Symbol] |
rtd | tos_historical_prices | high | =TOS|HIGH![Symbol] |
rtd | tos_historical_prices | low | =TOS|LOW![Symbol] |
rtd | tos_historical_prices | close | =TOS|CLOSE![Symbol] |
rtd | tos_historical_prices | volume | =TOS|VOLUME![Symbol] |
The columns of the tos_historical_prices
table are updated from the thinkorswim desktop real-time DDE server ("TOS"). The symbol
column serves as a dynamic parameter, while the time
column is calculated by RTD DB, as TOS does not provide time fields.
Refer to the complete list of built-in functions.
Table Configuration
RTD DB retrieves table configurations from a table containing the following fields:
- table_schema
- table_name
- load_code
- is_history
- is_disabled
- time_zone
- rtd_instance_name
An additional primary key column may be included.
Configuration Data Formats:
table_schema | table_name | load_code | is_history | is_disabled | time_zone | rtd_instance_name |
---|---|---|---|---|---|---|
<Table schema> | <Table name> | <SQL command> | 1/0/NULL | 1/0/NULL | <Time Zone> | <Instance Name> |
- The table_schema and table_name fields specify the database table.
- The load_code field specifies the SQL code used to load tickers for updates. For example:
SELECT DISTINCT Symbols FROM dbo.WatchList UNION SELECT DISTINCT Symbols FROM dbo.Portfolio
- The is_history field enables history mode. In this mode, RTD DB uses insert commands to update data first, followed by update commands if the insert fails.
- The is_disabled field allows for disabling table updates.
- The time_zone field defines the time zone of the table, which is used to adjust the current PC time in built-in functions like
=Time()
. SpecifyEastern Standard Time
for US exchanges. Refer to available time zones at https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - The rtd_instance_name field specifies the RTD DB instance responsible for updating the table. Other instances will ignore the table.
RTD DB Personal and Standard editions include two instances: x86 for 32-bit and x64 for 64-bit RTD DB executables. RTD DB Enterprise supports user-defined names configured in the application configuration file.
Example Table Configuration:
table_schema | table_name | load_code | is_history | is_disabled |
---|---|---|---|---|
rtd | tos_historical_prices | SELECT symbol FROM rtd.tos_stock_list |
Creating Configuration Tables
To create the tables, use the install.sql file in the RTD Databases folder of the downloaded package. This file facilitates table creation across any supported database platform.
The RTD Databases folder also contains ready-to-use templates for creating data tables, along with predefined configuration formulas.
Contents
- Formula Configuration
- Table Configuration
- Creating Configuration Tables