MySQL database interface based on peewee development.
When using MySQL in VeighNa, you need to fill in the following field information in the global configuration:
name | meaning | required | example |
---|---|---|---|
database.name | Name | Yes | mysql |
database.host | Address | Yes | localhost |
database.port | Port | Yes | 3306 |
database.database | Instance | Yes | vnpy |
database.user | Username | Yes | root |
database.password | Password | Yes | 123456 |
VeighNa does not actively create instances of MySQL databases, so please make sure that the instance of the database filled in the database.database field has been created before using it.
If the instance has not been created, you can use [new_schema] in the MySQL Workbench client.
Due to the limitation of peewee's table building function, by default, the [symbol] field of the contract code is not case-sensitive when it is saved. If it affects the usage, you can fix it by manually modifying the MySQL data table as follows:
# Connect to the database with the MySQL command line tool
# Select the data instance
use vnpy;
# Modify the BINARY attribute of the SYMBOL field of the four tables
ALTER TABLE `dbbaroverview` MODIFY COLUMN `symbol` VARCHAR(45) BINARY;
ALTER TABLE `dbtickoverview` MODIFY COLUMN `symbol` VARCHAR(45) BINARY;
ALTER TABLE `dbbardata` MODIFY COLUMN `symbol` VARCHAR(45) BINARY;
ALTER TABLE `dbtickdata` MODIFY COLUMN `symbol` VARCHAR(45) BINARY;