This commit is contained in:
vipg
2025-12-19 15:53:06 +08:00
parent b47f77cbbe
commit 1e281e3487
2 changed files with 120 additions and 197 deletions

59
bak.md
View File

@@ -82,4 +82,61 @@ END $$;
DO $$
BEGIN
RAISE NOTICE '============ trading_records 部署完成 ============';
END $$;
END $$;
----
open_year - 开仓时间:年
open_month - 开仓时间:月
open_day - 开仓时间:日
symbol - 品种
contract - 合约
direction - 方向
open_price - 开仓价格
open_fee - 开仓手续费
close_year - 平仓时间:年
close_month - 平仓时间:月
close_day - 平仓时间:日
close_price - 平仓价格
close_fee - 平仓手续费
price_diff - 平仓差价
min_tick - 品种最小跳点
tick_price - 跳点价格
diff_pnl - 差价盈亏
total_fee - 手续费合计
close_pnl - 平仓盈亏
这个文件是一份模板文件我的SQL语句是
CREATE TABLE trading_records (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY, -- id
event_type VARCHAR(40) NOT NULL, -- 事件名称
payload JSONB NOT NULL, -- 数据
deleted BOOLEAN NOT NULL DEFAULT FALSE, -- 删除状态
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 记录创建时间
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP -- 记录修改时间
);
其中payload的字段为
{
open_year - 开仓时间:年
open_month - 开仓时间:月
open_day - 开仓时间:日
symbol - 品种
contract - 合约
direction - 方向
open_price - 开仓价格
open_fee - 开仓手续费
close_year - 平仓时间:年
close_month - 平仓时间:月
close_day - 平仓时间:日
close_price - 平仓价格
close_fee - 平仓手续费
price_diff - 平仓差价
min_tick - 品种最小跳点
tick_price - 跳点价格
diff_pnl - 差价盈亏
total_fee - 手续费合计
close_pnl - 平仓盈亏
}
你的任务是按照上传的文件的样式,帮我调整新增的业务逻辑。