134 lines
6.3 KiB
C#
134 lines
6.3 KiB
C#
namespace Buyer
|
|
{
|
|
/// <summary>
|
|
/// Bitget 실시간 트레이더 설정.
|
|
/// 모든 외부 의존 값은 이 클래스에서 변수화합니다.
|
|
/// </summary>
|
|
public class BitgetConfig
|
|
{
|
|
// ── 종목 설정 ─────────────────────────────────────────────────
|
|
/// <summary>거래 심볼 (예: XRPUSDT)</summary>
|
|
public string Symbol { get; set; } = "XRPUSDT";
|
|
|
|
/// <summary>상품 타입 (USDT-FUTURES | COIN-FUTURES)</summary>
|
|
public string ProductType { get; set; } = "USDT-FUTURES";
|
|
|
|
/// <summary>
|
|
/// 캔들 시간 단위 — Bitget API 형식 그대로 입력합니다.
|
|
/// 지원 값: 1m 3m 5m 15m 30m 1H 2H 4H 6H 12H 1D 1W 1M
|
|
/// </summary>
|
|
public string Granularity { get; set; } = BitgetGranularity.Min30;
|
|
|
|
// ── WarmUp 설정 ───────────────────────────────────────────────
|
|
/// <summary>
|
|
/// 시작 전 로드할 과거 봉 수.
|
|
/// Pine Script 지표의 최대 윈도우(sma72 등)보다 충분히 커야 합니다.
|
|
/// </summary>
|
|
public int WarmUpBars { get; set; } = 500;
|
|
|
|
// ── REST API ─────────────────────────────────────────────────
|
|
/// <summary>Bitget REST API 베이스 URL</summary>
|
|
public string RestBaseUrl { get; set; } = "https://api.bitget.com";
|
|
|
|
/// <summary>REST 요청 타임아웃 (초)</summary>
|
|
public int RestTimeoutSec { get; set; } = 10;
|
|
|
|
// ── 폴링 설정 ─────────────────────────────────────────────────
|
|
/// <summary>
|
|
/// REST API 호출 간격 (밀리초).
|
|
/// 1000 = 1초마다 호출. Bitget 레이트 리밋 여유 있음.
|
|
/// </summary>
|
|
public int PollIntervalMs { get; set; } = 1000;
|
|
|
|
/// <summary>
|
|
/// 폴링 1회에 조회할 최근 봉 수.
|
|
/// 현재 진행 중인 봉 1개 + 완성 봉 확인용 2개 = 3 권장.
|
|
/// </summary>
|
|
public int PollCandleCount { get; set; } = 3;
|
|
|
|
// ── Pine Script ───────────────────────────────────────────────
|
|
/// <summary>실행할 .pine 스크립트 파일 경로</summary>
|
|
public string PineScriptPath { get; set; } = "./example.pine";
|
|
|
|
// ── API 키 ────────────────────────────────────────────────────
|
|
/// <summary>
|
|
/// API 키 JSON 파일 경로.
|
|
/// 비어있으면 포지션 동기화 및 실제 주문이 비활성화됩니다.
|
|
/// </summary>
|
|
public string ApiKeyFilePath { get; set; } = "";
|
|
|
|
/// <summary>마진 코인 (USDT-FUTURES 기준: USDT)</summary>
|
|
public string MarginCoin { get; set; } = "USDT";
|
|
|
|
// ── 주문 설정 ─────────────────────────────────────────────────
|
|
/// <summary>
|
|
/// 1회 주문에 사용할 USDT 금액.
|
|
/// 진입 시점의 현재가로 계약 수를 자동 계산합니다.
|
|
/// 예) OrderUsdt=50, 현재가=2.5 → 20계약
|
|
/// 0 이하면 OrderSize(계약 수 고정)를 사용합니다.
|
|
/// </summary>
|
|
public decimal OrderUsdt { get; set; } = 50m;
|
|
|
|
/// <summary>
|
|
/// 계약 수 고정 모드 (OrderUsdt = 0 일 때 사용).
|
|
/// OrderUsdt > 0 이면 이 값은 무시됩니다.
|
|
/// </summary>
|
|
public decimal OrderSize { get; set; } = 1m;
|
|
|
|
/// <summary>마진 모드 (crossed = 교차 | isolated = 격리)</summary>
|
|
public string MarginMode { get; set; } = "crossed";
|
|
|
|
/// <summary>레버리지 배수</summary>
|
|
public int Leverage { get; set; } = 10;
|
|
|
|
// ── 실행 모드 ─────────────────────────────────────────────────
|
|
/// <summary>
|
|
/// DryRun 모드.
|
|
/// true → 신호 발생 시 로그만 출력, 실제 주문 미전송 (기본값 — 안전)
|
|
/// false → 실제 주문 전송
|
|
/// </summary>
|
|
public bool DryRun { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 시작 직후 BUY → SELL → SHORT → COVER 순서로 테스트 신호를 발생시킵니다.
|
|
/// 주문 파이프라인(로그 또는 실제 API) 검증용.
|
|
/// </summary>
|
|
public bool TestOnStart { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// CLI -test 모드에서 실행할 신호 목록.
|
|
/// 비어있으면 BUY/SELL/SHORT/COVER 전체 실행.
|
|
/// 값 예: ["BUY"], ["SHORT"], ["BUY","SELL"]
|
|
/// </summary>
|
|
public List<string> TestSignals { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// true이면 테스트 사이클 완료 후 프로그램을 종료합니다.
|
|
/// CLI -test 옵션 사용 시 자동으로 true로 설정됩니다.
|
|
/// </summary>
|
|
public bool ExitAfterTest { get; set; } = false;
|
|
|
|
// ── 파생 속성 ─────────────────────────────────────────────────
|
|
/// <summary>REST API에 전달할 granularity — Granularity 그대로 사용</summary>
|
|
public string RestGranularity => Granularity;
|
|
|
|
/// <summary>Granularity 문자열 → 분(minutes)</summary>
|
|
public int IntervalMinutes => Granularity switch
|
|
{
|
|
"1m" => 1,
|
|
"3m" => 3,
|
|
"5m" => 5,
|
|
"15m" => 15,
|
|
"30m" => 30,
|
|
"1H" => 60,
|
|
"2H" => 120,
|
|
"4H" => 240,
|
|
"6H" => 360,
|
|
"12H" => 720,
|
|
"1D" => 1440,
|
|
"1W" => 10080,
|
|
_ => 30
|
|
};
|
|
}
|
|
}
|