package report.database import org.jetbrains.exposed.sql.Table // ๐Ÿ’ก [์‹ ๊ทœ] ์„ค์ • ๋ณ€๊ฒฝ ์ด๋ ฅ ์ „์šฉ ํ…Œ์ด๋ธ” object ConfigHistoryTable : Table("config_history") { val id = integer("id").autoIncrement() val updatedAt = varchar("updated_at", 50) // ๋งˆ์ง€๋ง‰ ์ˆ˜์ • ์‹œ๊ฐ„ val configJson = text("config_json") // ์„ค์ •๊ฐ’ JSON override val primaryKey = PrimaryKey(id) } // [1] ์ž์‚ฐ ์Šค๋ƒ…์ƒท ๋งˆ์Šคํ„ฐ (์„ค์ • ํ•„๋“œ ์ œ๊ฑฐ) object AssetSnapshotTable : Table("asset_snapshots") { val id = integer("id").autoIncrement() val date = varchar("date", 10) val snapshotType = varchar("type", 20) val totalAsset = long("total_asset") val totalProfitRate = double("profit_rate") val deposit = long("deposit") val appliedConfigJson = text("applied_config") val remark = varchar("remark", 255).nullable() override val primaryKey = PrimaryKey(id) } // [2] ๋ณด์œ  ์ข…๋ชฉ ์ƒ์„ธ (UnifiedStockHolding ๊ธฐ์ค€) object SnapshotHoldingsTable : Table("snapshot_holdings") { val id = integer("id").autoIncrement() val snapshotId = reference("snapshot_id", AssetSnapshotTable.id) val code = varchar("code", 20) val name = varchar("name", 100) val quantity = integer("quantity") val avgPrice = double("avg_price") val positionId = varchar("position_id", 50).nullable().index() val currentPrice = double("current_price") val profitRate = double("profit_rate") val evalAmount = long("eval_amount") val isDomestic = bool("is_domestic") val isTodayEntry = bool("is_today_entry") // ๋‹น์ผ ์ง„์ž… ์—ฌ๋ถ€ override val primaryKey = PrimaryKey(id) } // [3] ๋งค๋งค ์ด๋ ฅ ๋ฐ ๊ฒฐ์ • ๊ทผ๊ฑฐ (TradingDecision + ์ˆ˜์ •๋œ TradeHistoryTable) object TradeHistoryTable : Table("trade_history") { val id = integer("id").autoIncrement() val orderNo = varchar("order_no", 50).uniqueIndex() val stockCode = varchar("stock_code", 20) val stockName = varchar("stock_name", 100) val orderTime = varchar("order_time", 50) val isBuy = bool("is_buy") val status = varchar("status", 20) val orderQty = integer("order_qty").default(0) val reason = text("reason") // AI ํŒ๋‹จ ์ „๋ฌธ val currentPrice = double("current_price").nullable() // ๊ฒฐ์ • ๋‹น์‹œ ๊ฐ€๊ฒฉ val aiScore = double("ai_score").nullable() // ์ข…ํ•ฉ ์ ์ˆ˜ val newsScore = double("news_score").nullable() val systemScore = double("system_score").nullable() val financialScore = double("financial_score").nullable() val technicalScore = double("technical_score").nullable() val investmentGrade = text("investment_grade").nullable() // ํˆฌ์ž ๋“ฑ๊ธ‰ (S, A, B...) val holdingAvgPrice = double("holding_avg_price").default(0.0) override val primaryKey = PrimaryKey(id) } // [4] ์ฒด๊ฒฐ ์ƒ์„ธ (๊ทธ๋Œ€๋กœ ์œ ์ง€) object ExecutionDetailsTable : Table("execution_details") { val id = integer("id").autoIncrement() val tradeId = reference("trade_id", TradeHistoryTable.id) val execTime = varchar("exec_time", 50) val price = double("price") val quantity = integer("quantity") override val primaryKey = PrimaryKey(id) }