-- optimize table sig.col_log_vbdiamond final;

create database sig;

create table sig.backtest_trading_plan (
	id Int64 comment 'id',
    user_id Int64 comment '用户id',
    plan_id Int64 comment '交易计划id',
	ctime Int64 comment '创建时间'
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(toDateTime(ctime/1000))
primary key (plan_id, user_id, id)
order by (plan_id, user_id, id)
SETTINGS index_granularity = 8192
comment '交易计划回测';

create table sig.backtest_trading_trade (
	id Int64 comment 'id',
    backtest_id Int64 comment '回测id',
	ctime Int64 comment '创建时间'
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(toDateTime(ctime/1000))
primary key (backtest_id, id)
order by (backtest_id, id)
SETTINGS index_granularity = 8192
comment '交易计划回测订单';

