CREATE TABLE WatchList
(
	watch_list_id INTEGER NOT NULL,
	symbol VARCHAR(15) NOT NULL,
	PRIMARY KEY (watch_list_id, symbol)
) 
;


CREATE TABLE Trades
(
	trade_id INTEGER NOT NULL AUTO_INCREMENT,
	symbol VARCHAR(15) NOT NULL,
	trade_date DATETIME NOT NULL,
	shares NUMERIC(19,3),
	price NUMERIC(19,3),
	buysell CHAR(1),
	status VARCHAR(10) NOT NULL,
	account VARCHAR(25) NOT NULL,
	commission NUMERIC(19,2) NOT NULL,
	date_sold DATETIME,
	sell_price NUMERIC(19,3),
	PRIMARY KEY (trade_id)
) 
;


CREATE TABLE Cash
(
	account VARCHAR(25) NOT NULL,
	date DATETIME NOT NULL,
	description VARCHAR(255),
	credit NUMERIC(19,2),
	debit NUMERIC(19,2),
	balance NUMERIC(19,2),
	transaction_id INTEGER NOT NULL AUTO_INCREMENT,
	PRIMARY KEY (account, date, transaction_id)
) 
;


CREATE TABLE WatchLists
(
	watch_list_id INTEGER NOT NULL AUTO_INCREMENT,
	watch_list_name VARCHAR(255) NOT NULL,
	PRIMARY KEY (watch_list_id)
) 
;


CREATE TABLE StopLimits
(
	symbol VARCHAR(15) NOT NULL,
	stop_limit NUMERIC(19,2),
	shares NUMERIC(19,2) NOT NULL,
	stop_type VARCHAR(15),
	active INTEGER,
	PRIMARY KEY (symbol, shares)
) 
;


CREATE TABLE Accounts
(
	account VARCHAR(25) NOT NULL,
	PRIMARY KEY (account)
) 
;
