가상투자 메뉴 기능 구현
This commit is contained in:
@@ -1066,3 +1066,56 @@ export async function saveLiveStrategySettingsBulk(
|
||||
})) ?? [];
|
||||
return list;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// 가상투자 — 실시간 조건 충족 현황 (Ta4j Rule.isSatisfied)
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface LiveConditionRowDto {
|
||||
id: string;
|
||||
indicatorType: string;
|
||||
displayName: string;
|
||||
conditionType: string;
|
||||
conditionLabel: string;
|
||||
thresholdLabel: string;
|
||||
currentValue: number | null;
|
||||
targetValue: number | null;
|
||||
satisfied: boolean | null;
|
||||
timeframe: string;
|
||||
side: 'buy' | 'sell';
|
||||
}
|
||||
|
||||
export interface LiveConditionStatusDto {
|
||||
market: string;
|
||||
strategyId: number;
|
||||
timeframe: string;
|
||||
matchRate: number;
|
||||
rows: LiveConditionRowDto[];
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
/** 백엔드 Ta4j 조건 평가 — 3초 주기 폴링용 (종목별, 캐시 없음) */
|
||||
export async function fetchLiveConditionStatus(
|
||||
market: string,
|
||||
strategyId: number,
|
||||
): Promise<LiveConditionStatusDto | null> {
|
||||
const params = new URLSearchParams({
|
||||
market,
|
||||
strategyId: String(strategyId),
|
||||
});
|
||||
return request<LiveConditionStatusDto>(`/strategy/live-conditions?${params}`, {
|
||||
cache: 'no-store',
|
||||
});
|
||||
}
|
||||
|
||||
/** 차트 실시간 파이프라인 pin (STOMP warm-up) */
|
||||
export async function pinCandleWatch(market: string, candleType: string): Promise<void> {
|
||||
try {
|
||||
await fetch(
|
||||
`${API_BASE}/candles/watch?market=${encodeURIComponent(market)}&type=${encodeURIComponent(candleType)}`,
|
||||
{ method: 'POST' },
|
||||
);
|
||||
} catch {
|
||||
/* pin 실패해도 평가 API는 시도 */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user