CREATE TABLE "bot_state" ( "id" integer PRIMARY KEY NOT NULL, "cash" double precision NOT NULL, "start_capital" double precision NOT NULL, "cursor_ts" timestamp with time zone NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "decision_logs" ( "id" serial PRIMARY KEY NOT NULL, "pair" varchar(16) NOT NULL, "bar_ts" timestamp with time zone NOT NULL, "signal" text, "blocked_by" text, "close" double precision NOT NULL, "atr" double precision, "adx" double precision, "donchian_high" double precision, "trend_ema" double precision, "price_after_4h" double precision, "price_after_24h" double precision, "price_after_72h" double precision ); --> statement-breakpoint CREATE TABLE "equity_snapshots" ( "ts" timestamp with time zone PRIMARY KEY NOT NULL, "equity" double precision NOT NULL, "cash" double precision NOT NULL ); --> statement-breakpoint CREATE TABLE "paper_trades" ( "id" serial PRIMARY KEY NOT NULL, "pair" varchar(16) NOT NULL, "side" text NOT NULL, "entry_ts" timestamp with time zone NOT NULL, "entry_price" double precision NOT NULL, "exit_ts" timestamp with time zone NOT NULL, "exit_price" double precision NOT NULL, "qty" double precision NOT NULL, "pnl" double precision NOT NULL, "r" double precision NOT NULL, "exit_reason" text NOT NULL ); --> statement-breakpoint CREATE TABLE "positions" ( "pair" varchar(16) PRIMARY KEY NOT NULL, "side" text NOT NULL, "qty" double precision NOT NULL, "entry_ts" timestamp with time zone NOT NULL, "entry_price" double precision NOT NULL, "entry_cost" double precision NOT NULL, "initial_stop" double precision NOT NULL, "stop" double precision NOT NULL, "trail_extreme" double precision NOT NULL, "risk_amount" double precision NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX "decision_logs_pair_bar_ts" ON "decision_logs" USING btree ("pair","bar_ts");