games_app/backend/dist-test-faq/services/gameTimingService.d.ts

20 lines
1.4 KiB
TypeScript

/**
* Round timing helpers for Candle Predict (synthetic candles, no market data).
*/
export declare function currentCandleOpenMs(nowMs: number, intervalMinutes: number): number;
/** True when this timestamp is a candle close for the given interval grid. */
export declare function isMaturityBoundaryForInterval(candleOpenMs: number, intervalMinutes: number): boolean;
export type RoundPhase = 'waiting' | 'betting' | 'locked';
/** Max configurable prediction window (leaves at least 5s of live candle per period). */
export declare function maxPredictionWindowSeconds(intervalMinutes: number): number;
/** Cap window so at least 5s of "live candle" remains before the next betting phase. */
export declare function effectivePredictionWindowSeconds(intervalMinutes: number, predictionWindowSeconds: number): number;
export declare function getActiveRoundTiming(nowMs: number, intervalMinutes: number, predictionWindowSeconds: number): {
openMs: number;
phase: RoundPhase;
nextOpenMs: number;
nextBettingStartMs: number;
};
/** Client-facing status: settled rounds stay "locked" until the candle interval ends. */
export declare function resolveDisplayStatus(dbStatus: 'waiting' | 'betting' | 'locked' | 'settled', timingPhase: RoundPhase, candleOpenMs: number, intervalMinutes: number, nowMs: number): 'waiting' | 'betting' | 'locked' | 'settled';
//# sourceMappingURL=gameTimingService.d.ts.map