prac

Tables (13)

ai_investors

  • ai_investor_id — bigint
  • invest_style — enum
  • created_at — timestamp
  • updated_at — timestamp

ai_orders

  • order_id — bigint
  • ai_investor_id — bigint — Foreign key → ai_investors.ai_investor_id
  • stock_id — bigint
  • side — enum
  • order_type — enum
  • price — decimal
  • quantity — int
  • fee — decimal
  • fee_rate — decimal
  • total_amount — decimal
  • status — enum
  • ordered_at — timestamp
  • filled_at — timestamp
  • cancelled_at — timestamp

ai_reports

  • report_id — bigint
  • ai_investor_id — bigint
  • round — int
  • start_date — date
  • end_date — date
  • market_analysis — text
  • strategy — text
  • portfolio_ratio — json
  • news_selection_criteria — text
  • risk_strategy — text
  • target_profit — decimal
  • prev_round_review — text
  • created_at — timestamp
  • updated_at — timestamp

ai_thought_logs

  • thought_id — bigint
  • ai_investor_id — bigint — Foreign key → ai_investors.ai_investor_id
  • order_id — bigint — Foreign key → ai_orders.order_id
  • trade_id — bigint
  • trigger — enum
  • consideration — enum
  • risk — enum
  • memo — varchar(255)
  • created_at — timestamp

ai_trades

  • trade_id — bigint
  • ai_investor_id — bigint — Foreign key → ai_investors.ai_investor_id
  • order_id — bigint — Foreign key → ai_orders.order_id
  • side — enum
  • price — decimal
  • quantity — int
  • fee — decimal
  • fee_rate — decimal
  • total_amount — decimal
  • traded_at — timestamp
  • created_at — timestamp

compare_cards

  • compare_id — bigint
  • user_id — bigint — Foreign key → users.user_id
  • total_trades — int
  • profit_rate — decimal
  • start_date — date
  • end_date — date
  • thought_pattern — json
  • insight — text
  • created_at — timestamp
  • updated_at — timestamp

portfolio_items

  • portfolio_item_id — bigint
  • portfolio_id — bigint — Foreign key → portfolios.portfolio_id
  • stock_id — bigint
  • quantity — int
  • avg_buy_price — decimal
  • total_buy_amount — decimal
  • current_value — decimal
  • profit_amount — decimal
  • profit_rate — decimal
  • updated_at — timestamp
  • first_buy_at — timestamp

portfolio_metrics_2w

  • metric_id — bigint
  • portfolio_id — bigint — Foreign key → portfolios.portfolio_id
  • user_id — bigint
  • start_date — date
  • end_date — date
  • profit_rate — decimal
  • total_value — decimal
  • total_profit — decimal
  • cash_balance — decimal
  • stock_value — decimal
  • total_trades — int
  • win_trades — int
  • loss_trades — int
  • avg_profit_per_trade — decimal
  • max_drawdown — decimal
  • sharpe_ratio — decimal
  • created_at — timestamp
  • updated_at — timestamp

portfolios

  • portfolio_id — bigint
  • user_id — bigint — Foreign key → users.user_id
  • total_value — decimal
  • cash_balance — decimal
  • stock_value — decimal
  • total_profit — decimal
  • profit_rate — decimal
  • created_at — timestamp
  • updated_at — timestamp
  • owner_type — enum
  • ai_report_id — bigint — Foreign key → ai_reports.report_id

user_orders

  • order_id — bigint
  • user_id — bigint — Foreign key → users.user_id
  • stock_id — bigint
  • side — enum
  • order_type — enum
  • price — decimal
  • quantity — int
  • fee — decimal
  • fee_rate — decimal
  • total_amount — decimal
  • status — enum
  • ordered_at — timestamp
  • filled_at — timestamp
  • cancelled_at — timestamp

user_thought_logs

  • thought_id — bigint
  • user_id — bigint — Foreign key → users.user_id
  • order_id — bigint — Foreign key → user_orders.order_id
  • trade_id — bigint
  • trigger — enum
  • consideration — enum
  • risk — enum
  • memo — varchar(255)
  • created_at — timestamp

user_trades

  • trade_id — bigint
  • user_id — bigint — Foreign key → users.user_id
  • order_id — bigint — Foreign key → user_orders.order_id
  • side — enum
  • price — decimal
  • quantity — int
  • fee — decimal
  • fee_rate — decimal
  • total_amount — decimal
  • traded_at — timestamp
  • created_at — timestamp

users

  • user_id — bigint
  • email — varchar(255)
  • password — varchar(255)
  • user_invest_style — enum
  • ai_invest_style — enum
  • initial_balance — decimal
  • created_at — timestamp
  • updated_at — timestamp