알림 시간봉 오류 수정
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
import { useEffect, useRef, useCallback, useState } from 'react';
|
||||
import { parseStompJson } from '../utils/stompMessage';
|
||||
import { subscribeStompTopic } from '../utils/stompChartBroker';
|
||||
import { signalBelongsToCurrentSession } from '../utils/tradeSignalOwnership';
|
||||
|
||||
export interface LiveMarker {
|
||||
time: number;
|
||||
@@ -16,6 +17,10 @@ export interface LiveMarker {
|
||||
price: number;
|
||||
market: string;
|
||||
candleType: string;
|
||||
strategyId?: number | null;
|
||||
userId?: number | null;
|
||||
deviceId?: string | null;
|
||||
executionType?: string | null;
|
||||
}
|
||||
|
||||
export interface MarketCandleSub {
|
||||
@@ -57,9 +62,17 @@ export function useLiveStrategyMarkers({
|
||||
|
||||
const pushMarker = useCallback((market: string, candleType: string, data: {
|
||||
time: number; close: number; signal: string;
|
||||
strategyId?: number | null;
|
||||
userId?: number | null;
|
||||
deviceId?: string | null;
|
||||
executionType?: string | null;
|
||||
}) => {
|
||||
if (data.signal !== 'BUY' && data.signal !== 'SELL') return;
|
||||
|
||||
if (!signalBelongsToCurrentSession({ userId: data.userId, deviceId: data.deviceId })) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = `${market}:${candleType}:${data.time}:${data.signal}`;
|
||||
if (seenRef.current.has(key)) return;
|
||||
seenRef.current.add(key);
|
||||
@@ -70,6 +83,10 @@ export function useLiveStrategyMarkers({
|
||||
price: data.close,
|
||||
market,
|
||||
candleType,
|
||||
strategyId: data.strategyId,
|
||||
userId: data.userId,
|
||||
deviceId: data.deviceId,
|
||||
executionType: data.executionType,
|
||||
};
|
||||
|
||||
const prev = markersByMarketRef.current[market] ?? [];
|
||||
@@ -120,6 +137,10 @@ export function useLiveStrategyMarkers({
|
||||
close: number;
|
||||
signal?: string;
|
||||
candleType?: string;
|
||||
strategyId?: number | null;
|
||||
userId?: number | null;
|
||||
deviceId?: string | null;
|
||||
executionType?: string | null;
|
||||
}>(msg);
|
||||
if (!data?.signal || data.signal === 'NONE') return;
|
||||
const resolvedCandleType = data.candleType ?? ct;
|
||||
@@ -127,6 +148,10 @@ export function useLiveStrategyMarkers({
|
||||
time: data.time,
|
||||
close: data.close,
|
||||
signal: data.signal,
|
||||
strategyId: data.strategyId,
|
||||
userId: data.userId,
|
||||
deviceId: data.deviceId,
|
||||
executionType: data.executionType,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user