bitcoin auto trading system
Tables (12)
ApiEndpoint (거래소 정보를 저장하는 테이블)
- api_endpoint_id (API 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- exchange_id (거래소 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Exchange.exchange_id — NOT NULL
- api_type (매수, 매도, 조회 등)
- api_endpoint (API 엔드포인트 URL) — NOT NULL
- created_at (등록 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Auto Trading Container (자동 투자 컨테이너 정보를 저장하는 테이블)
- container_id (컨테이너 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- user_id (사용자 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → User.user_id — NOT NULL
- exchange_id (거래소 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Exchange.exchange_id — NOT NULL
- strategy_id (전략 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Strategy.strategy_id — NOT NULL
- wallet_id (Key) — PK, AUTO_INCREMENT — Foreign key → wallet.wallet_id — NOT NULL
- portfolio_id (기본 키) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Portfolio.portfolio_id — NOT NULL
- container_name (컨테이너 이름) — NOT NULL
- status (컨테이너 상태)
- status_message (상태에 대한 자세한 정보 ( 서버 꺼졌다던지, API 서버가 응답안한다던지 등))
- test_mode (테스트모드 인지의 여부)
- created_at (생성 날짜)
- updated_at (수정 날짜)
Coin (코인)
- coin_id (코인 키) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- coin_name (코인 이름) — NOT NULL
- coin_symbol (코인 심블(ex: BTC)) — NOT NULL UNIQUE
- created_at (등록 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Exchange (거래소)
- exchange_id (거래소 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- exchange_name (거래소 이름) — VARCHAR(50), UNIQUE, NOT NULL
- api_base_url (거래소 API 공통 URL)
- created_at (등록 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Portfolio (Untitled)
- portfolio_id (기본 키) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- coin_id (코인 키) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Coin.coin_id — NOT NULL
- quantity (수량) — NOT NULL
- average_price (매수평균가) — NOT NULL
- created_at (Field4) — DEFAULT CURRENT_TIMESTAMP
- updated_at (Field5) — DEFAULT CURRENT_TIMESTAMP
Strategy (투자 전략 정보)
- strategy_id (전략 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- creator_user_id (사용자 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → User.user_id — NOT NULL
- strategy_name (전략 이름) — NOT NULL
- description (전략 설명)
- is_deletable (삭제 가능 여부) — DEFAULT TRUE
- created_at (생성 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
StrategyCondition (전략 내 조건들을 저장하는 테이블)
- condition_id (조건 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- strategy_id (전략 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Strategy.strategy_id — NOT NULL
- condition_type (조건 타입 (매수/매도 등)) — NOT NULL
- parameters (조건에 필요한 파라미터 (JSON 형식)) — NOT NULL
- sequence (조건 적용 순서) — NOT NULL
- created_at (생성 날짜)
- updated_at (수정 날짜)
Transaction (거래 내역을 저장하는 테이블)
- transaction_id (Key거래 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- container_id (컨테이너 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Auto Trading Container.container_id — NOT NULL
- action (거래 종류 (BUY 또는 SELL)) — NOT NULL
- amount (거래 수량) — NOT NULL
- price (거래 가격) — NOT NULL
- fee (수수료) — NOT NULL
- status (거래 상태) — NOT NULL
- executed_at (거래 실행 시간) — DEFAULT CURRENT_TIMESTAMP
- created_at (생성 날짜) — DEFAULT CURRENT_TIMESTAMP
User (이용자 정보)
- user_id (사용자 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- username (로그인 ID) — UNIQUE, NOT NULL
- password (비밀번호) — NOT NULL
- nickname (닉네임)
- profile_image (프로필 이미지 URL)
- settings (개인 설정 (JSON 형식) - 굳이 없어도 될것 같기도) — JSON, NOT NULL
- created_at (가입 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (정보 수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
api_key (거래소 시크릿 키 를 담는 테이블)
- api_key_id (기본 키) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- user_id (사용자 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → User.user_id — NOT NULL
- exchange_id (거래소 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Foreign key → Exchange.exchange_id — NOT NULL
- api_key (시크릿 키)
- Field
realized_profit (실현수익을 저장하는 테이블)
- realized_profit_Id (실현수익 고유 식별자) — PRIMARY KEY, AUTO_INCRENEBT — Primary key — NOT NULL
- trade_type (거래 종류) — NOT NULL
- buy_price (매수 가격(매수 평균가)) — NOT NULL
- sell_price (매도 가격) — NOT NULL
- sell_quantity (매도 수량) — NOT NULL
- total_buy_amount (매수 금액) — NOT NULL
- sell_amount (매도 금액) — NOT NULL
- profit_rate (수익률 (%, 혹은 비율)) — NOT NULL
wallet (지갑)
- wallet_id (Key) — PK, AUTO_INCREMENT — Primary key — NOT NULL
- user_id (사용자 고유 식별자) — FOREIGN KEY — Foreign key → User.user_id — NOT NULL
- budget (할당된 예산)
- current_balance (현재 가용 가능한 금액)
- created_at (등록 날짜) — DEFAULT CURRENT_TIMESTAMP
- updated_at (수정 날짜) — DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP