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.

This plugin requires the mysql client libraries on the machine it is running on. Check if you have /usr/lib/libmysqlclient.so (or something similar).

If you want to compile this plugin yourself, you'll need the mysql client development package. This provides the C header files for the MySQL API.

Plugin Parameters


Note that you need to specify all 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
If any of the above is incorrect or unclear, please let me know. I'll be happy to explain, and improve these docs. Please contact the maintainers via the qtstalker forums on SourceForge.