Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Database static and streaming provider

RSS

What is it

Users have expressed demand to connect to databases, and Wealth-Lab listened: this provider helps connect to any ADO.NET compatible datasource. Out of the box, a typical PC with .NET framework supports Oracle, OleDb, ODBC, SQL Server and SQL Compact.

Features

  • Supports historical and real-time data
  • For static and streaming quotes, can query different databases
  • The provider is optimized for MS SQL Server (uses asynchronous methods)
  • If other database installs its .NET driver in the system, the provider can autodetect and support it - for example: SQLite, Firebird, MySQL etc.
  • Every data request is live, the data only exists in your database (and can't be edited in WL)
  • Supports Market Manager

Creating a new DataSet

To work with a database containing some data, you need to create a new static DataSet first. Pick the appropriate Provider from the list of available ones (e.g. System.Data.OleDb/ODBC for Excel, Access, text files and lots more, System.Data.SqlClient for SQL Server etc.), compose a connection string, and you're ready for the next step.

Usually, this is a no-brainer for the database guys, but should you feel lost in connection strings, clicking the bluish Connection string Help label will try to guess what kind of database you're trying to connect to, using the bits and pieces of your connection string and/or selected provider, and take you to the relevant page of the connectionstrings.com site.

  • Your connection string should include a database name.
  • Your connection string must not include curly braces i.e. { }

A rule of thumb is to first type in a connection string and only then proceed with selecting a provider. When you're finished with this step, the provider will populate the Table name dropdown box with the list of tables found. Select the one you need to make the provider fill the other boxes with available fields. Upon defining a field to serve as Security Name, the "Symbols" area is populated with found tickers. Note: when database contains thousands of symbols, this step may take a while (several minutes). Please be patient.

Match available fields to DateTime, Open, High, Low and Close. Volume and Named Series are optional. Note: for symbol names, you should use the varchar() type, not text. The provider won't let you confuse a DateTime field for prices and vice versa. To finish creation of your DataSet, select a bar scale and interval.

New DataSet Wizard

New DataSet Wizard

Setting up Streaming quotes

It's possible to use one source for static data while getting your streaming quotes from a different database (provided that the symbol exists in both). Setting up the provider for Streaming quotes is a two-step process:

  1. At any time, only one data source for streaming quotes can be defined. It's a global setting. To specify a database to use for real-time quotes, open the Data Manager tool, switch to the Database provider's tab, and repeat there all steps taken when completing the "New DataSet Wizard". For streaming quotes, only the Close price is required, Volume is optional.

    Configure streaming source

    Configure streaming source


  2. Finally, set "Database provider" as your current streaming provider in the Wealth-Lab's Preferences dialog, Streaming.

Note: you need to restart WL6 after changing Streaming settings.

Bonus

See this KB article on how easily you can import a bunch of CSV files to use with the Database provider:

Bulk import of data in CSV files to a SQL Server database

Usage Notes and Limitations

  • Bug: with ODBC/OLE DB data sources, the "From.. To.." or "Recent..." date range option will not work. Consequently, all Strategy Monitor features aren't going to function too. Use "Last Bars" or "All Data" instead. (Fixed in 2012.06)
  • Limitation: GetSessionOpen method is not currently supported (Added in 2012.06)
  • Limitation: Paper Trading through Database provider is not supported
  • Limitation: Open/Change fields in Quotes windows are not supported (only Last Price)
  • Limitation: Wealth-Lab restart required after re-configuring provider's Data Manager tab (Streaming properties)
  • Limitation: Volume is disabled for Streaming charts
  • Limitation: Tick charts can't be compressed into higher time frames (Wealth-Lab limitation?)
  • Limitation: Table name can not start with a digit
  • Compatibility: When Streaming quotes don't work and your SQL Server has some international settings, add this to your connection string (thanks Matthias):

    Current Language=us_english
  • Compatibility: If you have trouble connecting to MySQL, add this to your connection string:

    sql server mode=yes
  • Compatibility: If reading from a MySQL database generates an "Unable to convert MySQL date/time value to System.DateTime" error, add the attribute below to your connection string and make sure that date columns in the MySQL database either contains all valid values or contain NULL (i.e. are defined as allow Null value)

    Allow Zero Datetime=true
  • Note: when using MS Access tables for streaming quotes, it's highly recommended to work via OLE DB and not ODBC.
  • Note: on 64-bit operating systems, make sure you have installed ODBC and OLEDB drivers of appropriate "bitness". 64-bit Wealth-Lab can't use 32-bit ODBC drivers, and vice versa. For 64-bit drivers, visit this link: Microsoft Access Database Engine 2010 Redistributable. More info: Jet for Access, Excel and Txt on 64 bit systems.
  • Note: when building a connection string using a resource like connectionstrings.com, do not use curly brackets as this is not supported by the provider. Whenever suggested to use curly brackets, just skip them. Examples:

Driver={MySQL ODBC 5.1 Driver};incorrect
Driver=MySQL ODBC 5.1 Driver;correct
Driver={Microsoft Access Driver (*.mdb, *.accdb)};incorrect
Driver=Microsoft Access Driver (*.mdb, *.accdb);correct

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.