StockClaw(edited)

Tables (19)

app_agent_outputs (각 Agent의 개별 분석 결과)

  • id (Agent 결과 식별자) — bigint — Primary key — NOT NULL
  • analysis_request_id (분석 요청 식별자) — bigint — Foreign key → app_analysis_requests.id — NOT NULL
  • agent_type (어떤 Agent인지) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • score (Agent가 산출한 점수) — nemric(18,2)
  • summary (Agent 결과 요약)
  • output_payload (Agent의 상세 결과 JSON) — json
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_analysis_reports (최종 AI 종합 리포트)

  • id (리포트 식별자) — bigint — Primary key — NOT NULL
  • analysis_request_id (분석 요청 식별자) — bigint — Foreign key → app_analysis_requests.id — NOT NULL
  • opinion (최종 의견) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • target_price (목표주가) — nemric(18,2)
  • risk_level (리스크 수준) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • report_text (최종 리포트 본문)
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_analysis_requests (사용자의 분석 요청)

  • id (분석 요청 식별자) — bigint — Primary key — NOT NULL
  • user_id (사용자 아이디) — bigint — Foreign key → app_users.id — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • request_text (사용자가 입력한 원문)
  • status (분석 진행 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • requested_at (분석 요청 시점) — timestamp
  • completed_at (분석 완료 시점) — timestamp
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_approval_requests (Human-in-the-Loop 승인 요청)

  • id (승인 요청 식별자) — bigint — Primary key — NOT NULL
  • user_id (사용자 아이디) — bigint — Foreign key → app_users.id — NOT NULL
  • rule_trigger_event_id (룰 발동 이벤트 식별자) — bigint — Foreign key → app_rule_trigger_events.id — NOT NULL
  • message (Telegram 승인 메시지 원문)
  • status (승인 요청 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • requested_at (승인 요청을 보낸 시점) — timestamp
  • responded_at (사용자가 응답한 시점) — timestamp
  • expires_at (승인 요청 만료 시점) — timestamp
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_broker_accounts (증권사 계좌 연동 정보)

  • id (계좌 연동 정보 식별자) — bigint — Primary key — NOT NULL
  • user_id (사용자 아이디) — bigint — Foreign key → app_users.id — NOT NULL
  • broker (증권사 구분) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • account_no_masked (마스킹된 계좌번호) — varchar
  • credential_ref (민감정보 참조값) — varchar
  • trade_mode (거래 모드) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • is_active (현재 사용 계좌 여부)
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_executions (실제 체결 내역)

  • id (체결 식별자) — bigint — Primary key — NOT NULL
  • order_id (주문 식별자) — bigint — Foreign key → app_orders.id — NOT NULL
  • executed_quantity (체결 수량) — nemric(18,2)
  • executed_price (체결 가격) — nemric(18,2)
  • fee (수수료) — nemric(18,2)
  • tax (세금) — nemric(18,2)
  • executed_at (실제 체결 시각) — timestamp
  • kis_execution_no (KIS 체결 번호) — varchar
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_holdings (현재 보유 종목상태)

  • id (보유 상태 식별자) — bigint — Primary key — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • broker_account_id (계좌 연동 정보 식별자) — bigint — Foreign key → app_broker_accounts.id — NOT NULL
  • quantity (현재 보유 수량) — nemric(18,2)
  • average_price (평균 매입가) — nemric(18,2)
  • current_price (현재가) — nemric(18,2)
  • evaluation_amount (평가금액) — nemric(18,2)
  • unrealized_pnl (평가손익) — nemric(18,2)
  • unrealized_pnl_rate (평가손익률) — nemric(18,2)
  • synced_at (KIS 계좌와 마지막 동기화 시점) — timestamp
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_investment_rules (투자 룰)

  • id (투자 룰 식별자) — bigint — Primary key — NOT NULL
  • user_id (사용자 아이디) — bigint — Foreign key → app_users.id — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • original_text (사용자가 입력한 원문)
  • action (조건 충족 시 수행할 동작) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • metric (감시할 지표) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • operator (비교 연산자) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • threshold_value (조건 기준값) — nemric(18,2)
  • unit (기준값 단위) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • order_type (주문 유형) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • quantity (주문 수량) — nemric(18,2)
  • limit_price (지정가 주문 가격) — nemric(18,2)
  • status (룰 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • requires_approval (승인 필요 여부)
  • valid_until (룰 유효기간) — timestamp
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_job_runs (스케줄러 실행 이력)

  • id (run 아이디) — bigint — Primary key — NOT NULL
  • job_name (job 이름) — varchar
  • job_type (작업 종류) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • status (작업 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • started_at (작업 시작 시각) — timestamp
  • ended_at (작업 종료 시각) — timestamp
  • error_message (실패 시 오류 메시지)

app_orders (주문 요청)

  • id (주문 식별자) — bigint — Primary key — NOT NULL
  • broker_account_id (계좌 연동 정보 식별자) — bigint — Foreign key → app_broker_accounts.id — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • rule_id (투자 룰 식별자(Null 가능)) — bigint — Foreign key → app_investment_rules.id — NOT NULL
  • approval_request_id (승인 요청 식별자) — bigint — Foreign key → app_approval_requests.id — NOT NULL
  • side (매수/매도 구분) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • order_type (시장가/지정가 구분) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • quantity (주문 수량) — nemric(18,2)
  • limit_price (지정가 주문 가격) — nemric(18,2)
  • status (주문 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • kis_order_no (KIS에서 받은 주문번호) — varchar
  • requested_at (내부적으로 주문이 생성된 시점) — timestamp
  • submitted_at (실제 KIS API에 주문을 제출한 시점) — timestamp
  • failure_reason (주문 실패 시 원인을 저장)
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_portfolio_snapshots (포트폴리오의 시점별 과거 상태)

  • id (포트폴리오 과거 상태 식별자) — bigint — Primary key — NOT NULL
  • brocker_account_id (계좌 연동 정보 식별자) — bigint — Foreign key → app_broker_accounts.id — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • snapshot_at (스냅샷 기준 시점) — timestamp
  • total_asset_value (총자산 평가금액) — numeric(18,2)
  • cash_balance (예수금) — numeric(18,2)
  • evaluation_amount (평가금액) — numeric(18,2)
  • realized_pnl (실현손익) — numeric(18,2)
  • unrealized_pnl (평가손익) — numeric(18,2)
  • pnl_rate (수익률) — numeric(8,4)
  • position_weight (포트폴리오 내 종목 비중) — nemric(18,2)
  • created_at (스냅샷 저장 시점) — timestamp

app_rule_trigger_events (투자 룰이 실제로 발동된 기록)

  • id (룰 발동 이벤트 식별자) — bigint — Primary key — NOT NULL
  • rule_id (투자 룰 식별자) — bigint — Foreign key → app_investment_rules.id — NOT NULL
  • triggered_at (조건이 충족된 시점) — timestamp
  • observed_value (조건 판단 당시 관측값) — nemric(18,2)
  • trigger_status (발동 후 처리 상태)
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_stocks (종목 기준 정보)

  • id (내부 종목 식별자) — bigint — Primary key — NOT NULL
  • symbol (종목코드) — varchar
  • name_ko (한글 종목명) — varchar
  • market (시장 구분) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • sector (업종 대분류) — varchar
  • industry (산업 세부분류) — varchar
  • is_active (활성 종목 여부)
  • created_at (레코드 생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_users (사용자)

  • id (사용자 아이디) — bigint — Primary key — NOT NULL
  • telegram_user_id (Telegram 사용자를 식별) — bigint
  • telegram_chat_id (Telegram 채팅 식별자) — bigint
  • username (사용자 식별용 이름) — varchar
  • status (사용자 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • created_at (레코드 생성 시점) — timestamp
  • upldated_at (레코드 수정 시점) — timestamp

app_watchlist_items (관심종목 그룹 안에 실제 종목)

  • id (관심종목 항목 식별자) — bigint — Primary key — NOT NULL
  • watchlist_id (관심종목 그룹 식별자) — bigint — Foreign key → app_watchlists.id — NOT NULL
  • stock_id (내부 종목 식별자) — bigint — Foreign key → app_stocks.id — NOT NULL
  • memo (종목별 메모)
  • created_at (레코드생성 시점) — timestamp
  • updated_at (레코드 수정 시점) — timestamp

app_watchlists (사용자별 관심 종목 그룹)

  • id (관심종목 그룹 식별자) — bigint — Primary key — NOT NULL
  • user_id (사용자 식별자) — bigint — Foreign key → app_users.id — NOT NULL
  • name (관심종목 그룹 이름) — varchar

raw_api_response (외부 API의 원본 응답)

  • id (API 응답 원본 식별자) — bigint — Primary key — NOT NULL
  • collected_at (API 응답 수집 시각) — timestamp
  • source (외부 API 출처) — varchar
  • endpoint (호출 api 엔드포인트) — varchar
  • request_params (요청 파라미터 원본) — json
  • response_payload (응답 본문 원본) — json
  • status_code (HTTP/API 상태 코드) — integer

raw_browser_captures (Browser-Use/Computer-Use 캡처 정보)

  • id (브라우저 캡처 식별자) — bigint — Primary key — NOT NULL
  • collected_at (화면 캡처 시각) — timestamp
  • source (캡처 대상 출처) — varchar
  • task_type (캡처 작업 유형) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등
  • file_path (캡처 이미지 저장 경로)
  • page_url (캡처 대상 페이지 URL)
  • metadata (화면/브라우저 부가 정보) — json

raw_vision_extractions (Vision 모델 원본 결과)

  • id (Vision 추출 결과 식별자) — bigint — Primary key — NOT NULL
  • collected_at (Vision 추출 시각) — timestamp
  • capture_id (원본 캡처 참조 id) — bigint — Foreign key → raw_browser_captures.id — NOT NULL
  • model_name (사용한 vision 모델명) — varchar
  • extracted_payload (추출 결과 json) — json
  • confidence (추출 신뢰도) — nemric(18,2)
  • validation_status (추출 결과 검증 상태) — SCHEDULER, BROWSER_USE, COMPUTER_USE, MART_BATCH 등