-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.6.0.6765
-- --------------------------------------------------------



-- Dumping database structure for kval_darbs_riters
CREATE DATABASE IF NOT EXISTS `kval_darbs_riters` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `kval_darbs_riters`;

-- Dumping structure for table kval_darbs_riters.rr_410_accounts
CREATE TABLE IF NOT EXISTS `rr_410_accounts` (
  `account_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'konkreta konta id',
  `profile_id` int(11) unsigned NOT NULL COMMENT 'profila kas atbilst kontam id',
  `account_name` varchar(50) NOT NULL COMMENT 'konta nosaukums',
  PRIMARY KEY (`account_id`) USING BTREE,
  KEY `FK__profile` (`profile_id`),
  CONSTRAINT `FK__profile` FOREIGN KEY (`profile_id`) REFERENCES `rr_410_profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_accounts: ~5 rows (approximately)
INSERT INTO `rr_410_accounts` (`account_id`, `profile_id`, `account_name`) VALUES
	(1, 1, 'subacc1'),
	(8, 1, 'hhello'),
	(10, 3, 'profils1'),
	(11, 4, 'hakers'),
	(14, 7, 'testins1subbaccount');

-- Dumping structure for table kval_darbs_riters.rr_410_coin
CREATE TABLE IF NOT EXISTS `rr_410_coin` (
  `coin_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `coin_name` varchar(50) NOT NULL,
  PRIMARY KEY (`coin_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_coin: ~25 rows (approximately)
INSERT INTO `rr_410_coin` (`coin_id`, `coin_name`) VALUES
	(1, 'fee'),
	(2, 'fwrf'),
	(3, 'sfe'),
	(4, 'qr'),
	(5, 'wf'),
	(6, 'dwqw'),
	(7, 'btcb'),
	(8, 'btcbg'),
	(9, 'rt'),
	(10, 'pepe'),
	(11, 'karlis'),
	(12, 'lima'),
	(13, 'reinis'),
	(14, 'ge'),
	(15, 'grunde'),
	(16, 'jeee'),
	(17, 'eee'),
	(18, ''),
	(19, 'karlisss'),
	(20, '1000beta'),
	(21, 'lockhart'),
	(22, 'harry'),
	(23, 'hermione'),
	(24, 'albus'),
	(25, 'btc');

-- Dumping structure for table kval_darbs_riters.rr_410_coinpair
CREATE TABLE IF NOT EXISTS `rr_410_coinpair` (
  `coinpair_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `coinpair_name` varchar(50) NOT NULL,
  PRIMARY KEY (`coinpair_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_coinpair: ~23 rows (approximately)
INSERT INTO `rr_410_coinpair` (`coinpair_id`, `coinpair_name`) VALUES
	(1, 'edd'),
	(2, 'fwef'),
	(3, 'wef'),
	(4, 'qwd'),
	(5, 'usdtt'),
	(6, 'usdttg'),
	(7, 'usdttg3'),
	(8, 'rt'),
	(9, 'usdt14'),
	(10, 'usdt13'),
	(11, 'rihardu'),
	(12, 'eur'),
	(13, 'ee'),
	(14, 'eg'),
	(15, 'ralfs'),
	(16, 'juuu'),
	(17, ''),
	(18, 'rihardus'),
	(19, 'gilderoy'),
	(20, 'potter'),
	(21, 'granger'),
	(22, 'dubledore'),
	(23, 'USDT');

-- Dumping structure for table kval_darbs_riters.rr_410_direction
CREATE TABLE IF NOT EXISTS `rr_410_direction` (
  `direction_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `direction` varchar(5) NOT NULL,
  PRIMARY KEY (`direction_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_direction: ~2 rows (approximately)
INSERT INTO `rr_410_direction` (`direction_id`, `direction`) VALUES
	(1, 'Long'),
	(2, 'Short');

-- Dumping structure for table kval_darbs_riters.rr_410_history_input
CREATE TABLE IF NOT EXISTS `rr_410_history_input` (
  `trade_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` int(11) unsigned NOT NULL,
  `coin_id` int(11) unsigned NOT NULL,
  `coinpair_id` int(11) unsigned NOT NULL,
  `direction_id` int(11) unsigned NOT NULL,
  `open_price` decimal(23,15) unsigned DEFAULT NULL,
  `close_price` decimal(23,15) unsigned DEFAULT NULL,
  `leverage` int(5) unsigned DEFAULT 1,
  `close_date` date DEFAULT NULL,
  `photo` blob DEFAULT NULL,
  `percents` decimal(7,2) DEFAULT NULL,
  PRIMARY KEY (`trade_id`) USING BTREE,
  KEY `FK_rr_410_history_input_rr_410_accounts` (`account_id`),
  KEY `FK_rr_410_history_input_rr_410_coin` (`coin_id`),
  KEY `FK_rr_410_history_input_rr_410_coinpair` (`coinpair_id`),
  KEY `FK_rr_410_history_input_rr_410_direction` (`direction_id`),
  CONSTRAINT `FK_rr_410_history_input_rr_410_accounts` FOREIGN KEY (`account_id`) REFERENCES `rr_410_accounts` (`account_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_coin` FOREIGN KEY (`coin_id`) REFERENCES `rr_410_coin` (`coin_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_coinpair` FOREIGN KEY (`coinpair_id`) REFERENCES `rr_410_coinpair` (`coinpair_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_rr_410_history_input_rr_410_direction` FOREIGN KEY (`direction_id`) REFERENCES `rr_410_direction` (`direction_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- Dumping data for table kval_darbs_riters.rr_410_history_input: ~5 rows (approximately)
INSERT INTO `rr_410_history_input` (`trade_id`, `account_id`, `coin_id`, `coinpair_id`, `direction_id`, `open_price`, `close_price`, `leverage`, `close_date`, `photo`, `percents`) VALUES
	(5, 1, 11, 11, 1, 31.500000000000000, 32.000000000000000, 100, '2024-10-02', NULL, NULL),
	(11, 1, 8, 10, 2, 34.000000000000000, 35.000000000000000, 3, '2024-10-12', NULL, -8.82),
	(19, 1, 10, 10, 1, 123.000000000000000, 12.000000000000000, 1, '2024-10-10', NULL, -90.24),
	(21, 1, 11, 10, 1, 12.000000000000000, 1.000000000000000, 4, '2024-10-01', NULL, -366.67),
	(22, 1, 16, 16, 1, 12.000000000000000, 22.000000000000000, 3, '2024-10-17', NULL, 250.00),
	(23, 1, 10, 6, 1, 5.560000000000000, 5.000000000000000, 10, '2024-10-15', _binary 0x6261636b6965652d3238363734352d6c616e6473636170652e6a7067, -100.72),
	(24, 1, 8, 12, 2, 0.040000000000000, 0.100000000000000, 3, '2024-10-15', _binary 0x6261636b6965652d3236353636312d6c616e647363617065202831292e6a7067, -450.00),
	(25, 1, 17, 14, 1, 0.080000000000000, 0.030000000000000, 1, '0000-00-00', _binary 0x6261636b6965652d3237373037382d6c616e6473636170652e6a7067, -62.50),
	(27, 8, 10, 11, 1, 0.030000000000000, 0.090000000000000, 7, '2024-10-10', _binary 0x4469676573745f617574682e706e67, 1400.00),
	(28, 1, 10, 6, 1, 1.000000000000000, 2.000000000000000, 9, '2024-10-16', _binary 0x6261636b6965652d3236353636312d6c616e647363617065202831292e6a7067, 900.00),
	(30, 1, 20, 12, 1, 0.000789000000000, 0.000800000000000, 15, '2024-10-19', _binary 0x3433343138393234355f3933333938303038323036323834375f333734353530323336313137393230383037335f6e2e6a7067, 20.91),
	(31, 1, 21, 19, 1, 1.007600000000000, 1.009346000000000, 5, '2024-10-09', _binary 0x313938375f59464d32303044582e6a7067, 0.87),
	(32, 1, 22, 20, 2, 507.000000000000000, 55.347870000000000, 3, '2024-10-17', _binary 0x636c61722e6a7067, 267.25),
	(33, 1, 23, 21, 1, 10000.000000000000000, 10010.000000000000000, 17, '2024-10-10', _binary 0x41544339302e6a7067, 1.70),
	(34, 1, 10, 10, 2, 0.020000000000000, 0.010000000000000, 10, '0000-00-00', _binary 0x6261636b6965652d3236353636312d6c616e6473636170652e6a7067, 500.00),
	(35, 1, 24, 22, 1, 0.020000000000000, 0.040000000000000, 10, NULL, _binary 0x6141756732324e6577732d726170746f723730307273652e6a7067, NULL),
	(37, 14, 25, 23, 2, 654503.000000000000000, 636700.000000000000000, 10, '2024-10-25', _binary 0x30355f4965647665736d612e706e67, 27.20);

