A crypto exchange app, that allows spot and futures trading.
CREATE TABLE IF NOT EXISTS `luxucex_positions` (
`code` char(36) NOT NULL,
`pair` varchar(100) NOT NULL,
`type` varchar(100) NOT NULL,
`contract_quantity` varchar(100) NOT NULL,
`entry` float NOT NULL,
`leverage` int(11) NOT NULL,
`allocated_margin` float NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp(),
`liquidation` float DEFAULT NULL,
`owner` varchar(100) NOT NULL,
PRIMARY KEY (`code`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `luxucex_market_transactions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`identifier` varchar(100) NOT NULL,
`type` enum('buy', 'sell') NOT NULL,
`coin` varchar(50) NOT NULL,
`amount` decimal(20, 8) unsigned NOT NULL,
`price` decimal(20, 8) unsigned NOT NULL,
`created_at` datetime NOT NULL DEFAULT curtime(),
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `luxucex_transfers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sender` varchar(255) NOT NULL,
`receiver` varchar(255) NOT NULL,
`coin` varchar(255) NOT NULL,
`amount` decimal(20, 8) unsigned NOT NULL,
`created_at` datetime NOT NULL DEFAULT curtime(),
PRIMARY KEY (`id`),
KEY `FK_luxucex_transfers_luxucex_accounts` (`sender`),
KEY `FK_luxucex_transfers_luxucex_accounts_2` (`receiver`),
CONSTRAINT `FK_luxucex_transfers_luxucex_accounts` FOREIGN KEY (`sender`) REFERENCES `luxucex_accounts` (`address`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_luxucex_transfers_luxucex_accounts_2` FOREIGN KEY (`receiver`) REFERENCES `luxucex_accounts` (`address`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `luxucex_tradinghistory` (
`key` int(11) NOT NULL AUTO_INCREMENT,
`pair` varchar(100) NOT NULL,
`entry` varchar(100) DEFAULT NULL,
`margin` varchar(100) NOT NULL,
`leverage` varchar(100) NOT NULL,
`size` varchar(100) NOT NULL,
`type` varchar(100) NOT NULL,
`close` varchar(100) DEFAULT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp(),
`action` varchar(100) NOT NULL,
`pnl` varchar(100) DEFAULT NULL,
`owner` varchar(100) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `luxucex_accounts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`char_id` varchar(255) NOT NULL,
`balance` bigint(20) NOT NULL DEFAULT 0,
`crypto` longtext NOT NULL,
`address` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `player` (`char_id`) USING BTREE,
UNIQUE KEY `address` (`address`),
KEY `char_id` (`char_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;