Files
PineSript/Buyer/BitgetConfig.cs

76 lines
3.5 KiB
C#
Raw Normal View History

2026-04-25 17:32:49 +09:00
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";
// ── 파생 속성 ─────────────────────────────────────────────────
/// <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
};
}
}