SyncDB LT
- 实用工具
- Maxim Kuznetsov
- 版本: 1.0
A service to keep the SQLite database up to date. Fast real-time operation. Saves open positions and orders, current quotes, and trading history. Take advantage of SQLite's capabilities for intermediate data storage, analytics, and integration of the MetaTrader platform. Save all your data in one place. Use the saved data in SQL analytical queries, from Python and other languages, to build dashboards and integrate MetaTrader
This version "Learn & Test" is designed for familiarization and training, as well as debugging your programs.
The service will synchronize data only for demo accounts.
No other restrictions or differences from SyncDB (https://www.mql5.com/en/market/product/127024 )
Parameters
SyncDB LT creates and maintains 2 databases at the same time :
db/{server_name}.{account}.history-lt.db is a replenished history database that contains the history of transactions and information about instruments
db/ram/{server_name}.{account}.trade-lt.db is an updated database that contains open orders and positions, current prices.
Where {server_name} is the name of the DC trading server, it will be delivered automatically. {account} the number of the trading account on it. Thus, with the simultaneous operation of several terminals, their data is stored separately and will not cause mutual locks and slowdowns.
I strongly recommend placing the db/ram directory on a ram disk or fast media.
Very simple parameters:
- priceUpdateSec, 15 - the period (seconds) for updating prices in the database. When using a ram disk, you can specify smaller values, up to 0
- useCommon , true. Use a [COMMON] shared data directory.
- dbFolder , "db". The name of the database storage folder
The scheme of the trade-lt.db database
The database contains the necessary minimum, in the style of mt4 and adapted for frequent additions. After creating the database with the script, you can make your own adjustments to it (add indexes, computable fields, additional data and tables)
CREATE TABLE IF NOT EXISTS Trade ( ticket INT PRIMARY KEY, symbol VARCHAR(16), 'type' VARCHAR(16), lots REAL, openPrice REAL, stopLoss REAL, takeProfit REAL, price REAL, 'time' DATETIME, closeTime DATETIME, expiration DATETIME, profit REAL, swap REAL, commission REAL, magic INT , 'comment' VARCHAR(255) ) WITHOUT ROWID
and
CREATE TABLE IF NOT EXISTS Watch ( name VARCHAR(16) PRIMARY KEY, 'time' DATETIME, bid REAL, ask REAL, spread INTEGER, stopLevel INTEGER, tickValue REAL ) WITHOUT ROWID
History-lt.db database schema
CREATE TABLE IF NOT EXISTS History ( ticket INT PRIMARY KEY, symbol VARCHAR(16), 'type' VARCHAR(16), lots REAL, openPrice REAL, stopLoss REAL, takeProfit REAL, price REAL, 'time' DATETIME, closeTime DATETIME, expiration DATETIME, profit REAL, swap REAL, commission REAL, magic INTEGER, 'comment' VARCHAR(255) ) WITHOUT ROWID
and
CREATE TABLE IF NOT EXISTS Symbol ( name VARCHAR(16) PRIMARY KEY, base VARCHAR(16), quote VARCHAR(16), digits INTEGER, point REAL, tickSize REAL, minLot REAL, maxLot REAL, lotStep REAL ) WITHOUT ROWID
Usage
Just run an instance of the SyncDB LT service, and use the data in your applications and for integration.
This version "Learn & Test" is designed for familiarization and training, as well as debugging your programs.
The service will synchronize data only for demo accounts.
No other restrictions or differences from SyncDB (https://www.mql5.com/en/market/product/127024 )