DROP TABLE IF EXISTS `T_CONTRACT_ORDER`;
CREATE TABLE `T_CONTRACT_ORDER` (
  `UUID` varchar(32) NOT NULL COMMENT '主键',
  `PARTY_ID` varchar(32) ,
  `SYMBOL` varchar(32)  COMMENT '代码',
  `ORDER_NO` varchar(64) ,
  `DIRECTION`varchar(32),
  `UNIT_AMOUNT` double ,
  `AMOUNT_CLOSE` double ,
  `FEE` double ,
  `DEPOSIT` double ,
  `DEPOSIT_OPEN` double ,
  `PROFIT` double ,
  `TRADE_AVG_PRICE` double ,
  `STOP_PRICE_PROFIT` double ,
  `STOP_PRICE_LOSS`double ,
  `CREATE_TIME` datetime ,
  `PIPS` double ,
  `PIPS_AMOUNT` double ,
  `STATE` varchar(32) ,
  `LEVER_RATE` double ,
  `VOLUME` double ,
  `VOLUME_OPEN` double ,
  PRIMARY KEY (`UUID`),
  KEY `INDEX_ORDER_STATUS` (`STATE`,`CREATE_TIME`),
  KEY `INDEX_ORDER_ORDER_NO` (`ORDER_NO`),
  KEY `INDEX_ORDER_PARTY_ID` (`PARTY_ID`,`STATE`,`DIRECTION`,`CREATE_TIME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `T_CONTRACT_APPLY_ORDER`;
CREATE TABLE `T_CONTRACT_APPLY_ORDER` (
`UUID` varchar(32) NOT NULL COMMENT '主键',
`PARTY_ID` varchar(32) ,
`SYMBOL` varchar(32)  COMMENT '代码',
`ORDER_NO` varchar(64) ,
`DIRECTION`varchar(32),
`OFFSET`varchar(32),
`VOLUME` double ,
`VOLUME_OPEN` double ,
`LEVER_RATE` double ,
`PRICE` double ,
`STOP_PRICE_PROFIT` double ,
`STOP_PRICE_LOSS`double ,
`ORDER_PRICE_TYPE`varchar(32),
`STATE` varchar(32) ,
`CREATE_TIME` datetime ,
`UNIT_AMOUNT` double ,
`FEE` double ,
`DEPOSIT` double ,
PRIMARY KEY (`UUID`),
KEY `INDEX_ORDER_STATUS` (`STATE`,`CREATE_TIME`),
KEY `INDEX_ORDER_ORDER_NO` (`ORDER_NO`),
KEY `INDEX_ORDER_PARTY_ID` (`PARTY_ID`,`STATE`,`DIRECTION`,`CREATE_TIME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;