goldenChat base source add
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 심리도 / 투자심리도 (업비트)
|
||||
* - 심리도: N일 중 종가 상승일 비율 × 100
|
||||
* - 투자심리도: N일 중 상승일 거래량 비중 × 100
|
||||
*/
|
||||
|
||||
export const PSYCHOLOGICAL_DEFAULT_LENGTH = 12;
|
||||
export const INVEST_PSYCHOLOGICAL_DEFAULT_LENGTH = 10;
|
||||
|
||||
/** 레거시 type → 업비트 명칭 type */
|
||||
export function resolvePsychologicalIndicatorType(type: string): string {
|
||||
if (type === 'NewPsychological') return 'Psychological';
|
||||
return type;
|
||||
}
|
||||
|
||||
export function normalizePsychologicalParams(
|
||||
type: string,
|
||||
params: Record<string, number | string | boolean>,
|
||||
): Record<string, number | string | boolean> {
|
||||
const defaultLen =
|
||||
type === 'InvestPsychological'
|
||||
? INVEST_PSYCHOLOGICAL_DEFAULT_LENGTH
|
||||
: PSYCHOLOGICAL_DEFAULT_LENGTH;
|
||||
const length = Math.max(1, Number(params.length ?? defaultLen) || defaultLen);
|
||||
return { ...params, length };
|
||||
}
|
||||
Reference in New Issue
Block a user