数据是一套系统的运行基础,如何保证数据及时同步到数据库内保存很重要 。
基于MT5API 同步数据到MYSQL数据
同步内容:用户信息,账号资金信息,订单信息,成交信息,持仓信息等
首先创建数据库表结构:
users:
CREATE TABLE `mt5_users`(`Login` bigint(20) UNSIGNED NOT NULL DEFAULT 0,`Timestamp` bigint(20) NOT NULL DEFAULT 0,`Group` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`CertSerialNumber` bigint(20) UNSIGNED NOT NULL DEFAULT 0,`Rights` bigint(20) UNSIGNED NOT NULL DEFAULT 0,`Registration` datetime(0) NOT NULL DEFAULT '1970-01-01 00:00:00',`LastAccess` datetime(0) NOT NULL DEFAULT '1970-01-01 00:00:00',`LastPassChange` datetime(0) NOT NULL DEFAULT '1970-01-01 00:00:00',`FirstName` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`LastName` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`MiddleName` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Company` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Account` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Country` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Language` int(10) UNSIGNED NOT NULL DEFAULT 0,`ClientID` bigint(20) UNSIGNED NOT NULL DEFAULT 0,`City` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`State` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`ZipCode` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Address` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Email` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`ID` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Status` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Comment` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Color` int(10) UNSIGNED NOT NULL DEFAULT 0,`PhonePassword` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`Leverage` int(10) UNSIGNED NOT NULL DEFAULT 0,`Agent` bigint(20) UNSIGNED NOT NULL DEFAULT 0,`TradeAccounts` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`LeadCampaign` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`LeadSource` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`TimestampTrade` bigint(20) NOT NULL DEFAULT 0,`Balance` double NOT NULL DEFAULT 0,`Credit` double NOT NULL DEFAULT 0,`InterestRate` double NOT NULL DEFAULT 0,`CommissionDaily` double NOT NULL DEFAULT 0,`CommissionMonthly` double NOT NULL DEFAULT 0,`BalancePrevDay` double NOT NULL DEFAULT 0,`BalancePrevMonth` double NOT NULL DEFAULT 0,`EquityPrevDay` double NOT NULL DEFAULT 0,`EquityPrevMonth` double NOT NULL DEFAULT 0,`Name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`MQID` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`LastIP` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',`ApiData` varchar(4000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',PRIMARY KEY (`Login`) USING BTREE) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
资金信息
订单表
成交表
持仓表
【基于MT5 manager API的 同步数据】同步频率默认设定为 1分钟一次
- 基于AT89C51单片机的贪吃蛇游戏设计
- 毕业设计资料 基于52单片机的脉搏心率测量仪系统
- 基于Spring Boot智能无人仓库管理
- 基于SpringBoot智能无人仓库管理
- springboot154基于Spring Boot智能无人仓库管理
- 附源码 基于springboot实验室管理系统-计算基毕设86757
- UWB高精度定位系统源码,工厂人员定位系统源码
- 8 stm32项目——基于stm32的智能家居设计
- 【Ubuntu】基于C++实现人脸识别
- 陀螺产业区块链第六季 | 基于区块链的智能入住系统