UNPKG

@gabriel3615/ta_analysis

Version:

stock ta analysis

27 lines (26 loc) 695 B
export const srConfig = { pivot: { leftBars: 10, rightBars: 10, }, nearThresholdPercent: 0.1, timeframeWeights: { weekly: 0.6, daily: 0.4, }, }; export function updateSrConfig(partial) { // 浅合并 + 针对嵌套对象的合并 if (partial.pivot) { srConfig.pivot = { ...srConfig.pivot, ...partial.pivot }; } if (partial.timeframeWeights) { srConfig.timeframeWeights = { ...srConfig.timeframeWeights, ...partial.timeframeWeights, }; } if (typeof partial.nearThresholdPercent === 'number') { srConfig.nearThresholdPercent = partial.nearThresholdPercent; } }