MySQL Plugin

Description

Import values from a MySQL database.

Using this plugin you can synchronise your qtstalker charts with quote data you keep in a MySQL database. The plugin does not depend on specific table or field names. Instead, you configure it by specifying the SQL query it should execute.

Main Dialog

When you start the MySQL Plugin, this dialog window appears:

MySQL Plugin Update Dialog

Once you have configured the plugin (see below), you'll usually just press the button at the top left, which performs the update.

This is what all four buttons do:

The other control on the page is the Full Reload check box.

Settings Dialog

Use the Settings Dialog to configure how to connect to the MySQL database and what statement to issue to retrieve quotes.

MySQL Plugin Settings Dialog

Note: You need to specify these settings only once. They are remembered between uses of the plugin.

The SQL Query

In order to keep this plugin maximally flexible, you must provide the SQL query to extract quotes for a specific symbol from the database.

The query you specify can be arbitrarily complex, as long as it is a single SQL SELECT statement which meets the following requirements:

Here is an example for someone using one table per symbol, table name corresponding to symbol name.

   SELECT day,open,high,low,close,volume
     FROM $SYMBOL$
     WHERE day > '$LASTDAY$'
     ORDER BY day

Here is another example, for someone using a single table for all quotes for all symbols.

   SELECT day,open,high,low,close,volume
     FROM Quotes
     WHERE symbol = '$SYMBOL$' AND day > '$LASTDAY$'
     ORDER BY day

One more example, which looks like my set-up. I have a Quotes table and a Symbols table, which both have a foreign key (stockId) referring to a shared primary key in a Stocks table.

   SELECT day,open,high,low,close,volume
     FROM Symbols JOIN Quotes USING (stockId)
     WHERE symbol = '$SYMBOL$' AND day > '$LASTDAY$'
     ORDER BY day

Technical Requirements

This plugin requires the mysql client libraries on the machine it is running on. Check if you have /usr/lib/libmysqlclient.so.*.