-- MySQL dump 10.11
--
-- Host: localhost    Database: mydb
-- ------------------------------------------------------
-- Server version	5.0.77-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `ai_base_strategies`
--

DROP TABLE IF EXISTS `ai_base_strategies`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `ai_base_strategies` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(200) default NULL,
  `created` datetime default NULL,
  `updated` datetime default NULL,
  `cloud_link` char(32) default NULL,
  `description` blob default NULL,
  `strategy_type` enum('intraday', 'swing') NOT NULL default 'intraday',
  `is_long` TINYINT default '1',
  `status` enum('optimize','nooptimize','archived') NOT NULL default 'optimize',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

DROP TABLE IF EXISTS `ai_strategies`;
-- Dump completed on 2015-10-30 18:44:44
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `ai_strategies` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `strategy_id` INT(11) NOT NULL,
    `name` varchar(100) NOT NULL,
    `creation` datetime DEFAULT NULL,
    `optimize_date` datetime DEFAULT NULL,
    `trading_date` datetime DEFAULT NULL,
    `settings` blob NOT NULL,
    `cloud_link` char(32) NOT NULL,
    `is_long` TINYINT NOT NULL DEFAULT '1',
    `timeframe` enum('intraday', 'swing') NOT NULL DEFAULT 'intraday',
    `score` double NOT NULL DEFAULT '0',
    `total_trades` INT(11) NOT NULL DEFAULT '0',
    `max_trades_per_day` INT(11) NOT NULL DEFAULT '0',
    `is_winrate` double NOT NULL DEFAULT '0',
    `is_profit_factor` double NOT NULL DEFAULT '0',
    `oos_winrate` double NOT NULL DEFAULT '0',
    `oos_profit_factor` double NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`),
    UNIQUE KEY `strategy_id` (`strategy_id`, `trading_date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `ai_trades`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ai_trades` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `trade_id` varchar(100) NOT NULL,
    `symbol` varchar(20) NOT NULL,
    `creation` datetime DEFAULT NULL,
    `entry_date` datetime DEFAULT NULL,
    `exit_date` datetime DEFAULT NULL,
    `shares` INT(11) NOT NULL DEFAULT '1',
    `entry_price` double NOT NULL,
    `exit_price` double DEFAULT NULL,
    `stop_price` double DEFAULT NULL,
    `target_price` double DEFAULT NULL,
    `time_stop` datetime DEFAULT NULL,
    `exit_reason` enum('open', 'time_stop', 'stop_hit', 'target_hit') NOT NULL DEFAULT 'open',
    `profit` double NOT NULL DEFAULT '0',
    `max_profit` double NOT NULL DEFAULT '0',
    `min_profit` double NOT NULL DEFAULT '0',
    `max_profit_time` datetime DEFAULT NULL,
    `min_profit_time` datetime DEFAULT NULL,
    `is_long` TINYINT NOT NULL DEFAULT '1',
    `winner` TINYINT NOT NULL DEFAULT '0',
    `strategy_id` INT(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `trade_id` (`trade_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3282033 DEFAULT CHARSET=latin1;

