Files
goldenChart/frontend/src/utils/obvChartBars.ts
T
2026-06-09 22:30:19 +09:00

11 lines
534 B
TypeScript

import type { OHLCVBar } from '../types';
/** OBV 본선 계산에 필요한 최소 거래량 품질 (some>0 만으로는 STOMP volume=0 history 통과) */
export function barsMeetObvVolumeRequirement(bars: OHLCVBar[]): boolean {
if (bars.length < 2) return false;
const withVol = bars.filter(b => (Number(b.volume) || 0) > 0).length;
const volSum = bars.reduce((s, b) => s + (Number(b.volume) || 0), 0);
const minBarsWithVol = Math.max(20, Math.floor(bars.length * 0.5));
return volSum > 0 && withVol >= minBarsWithVol;
}