去掉trim data,修改check_fx回去
This commit is contained in:
@@ -1256,47 +1256,6 @@
|
||||
// ======= 趋势筛选(币对) =======
|
||||
let trendTable = null;
|
||||
|
||||
// 不在前端截断数据,保留完整历史,避免K线数量限制
|
||||
function trimDataInPlace(payload, maxLen = 2000) {
|
||||
if (!payload || typeof payload !== 'object') return;
|
||||
delete payload.original_kline_data;
|
||||
delete payload.original_macd;
|
||||
|
||||
// 截断大型数组,只保留最新 maxLen 条数据
|
||||
const arrayKeys = [
|
||||
'kline_data', 'element_kline_data', 'sub_sub_kline_data',
|
||||
'bi_list', 'element_bi_list', 'sub_sub_bi_list',
|
||||
'seg_list', 'element_seg_list', 'sub_sub_seg_list',
|
||||
'zs_list', 'element_zs_list', 'sub_sub_zs_list',
|
||||
'uncompleted_bi_list', 'uncompleted_seg_list', 'uncompleted_zs_list',
|
||||
'element_uncompleted_bi_list', 'element_uncompleted_seg_list', 'element_uncompleted_zs_list',
|
||||
'bsp_list', 'element_bsp_list', 'sub_sub_bsp_list',
|
||||
'trade_points', 'element_trade_points'
|
||||
];
|
||||
for (const key of arrayKeys) {
|
||||
if (Array.isArray(payload[key]) && payload[key].length > maxLen) {
|
||||
payload[key] = payload[key].slice(-maxLen);
|
||||
}
|
||||
}
|
||||
// 截断 MACD 子数组
|
||||
const macdKeys = ['macd', 'element_macd', 'sub_sub_macd'];
|
||||
for (const mk of macdKeys) {
|
||||
const m = payload[mk];
|
||||
if (m && typeof m === 'object') {
|
||||
for (const sub of ['macd', 'signal', 'histogram']) {
|
||||
if (Array.isArray(m[sub]) && m[sub].length > maxLen) {
|
||||
m[sub] = m[sub].slice(-maxLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 截断 ATR 数组
|
||||
for (const ak of ['atr', 'element_atr', 'sub_sub_atr']) {
|
||||
if (Array.isArray(payload[ak]) && payload[ak].length > maxLen) {
|
||||
payload[ak] = payload[ak].slice(-maxLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
let trendDetailTable = null;
|
||||
let trendChart = null;
|
||||
|
||||
@@ -2081,16 +2040,21 @@
|
||||
}
|
||||
ensureSubSubLteElement();
|
||||
});
|
||||
let _lastKlinePeriod = 'main';
|
||||
function updateChartDisplay() {
|
||||
if (currentData) {
|
||||
// 保存当前的可见逻辑范围
|
||||
// 检测K线周期是否切换
|
||||
const curPeriod = $('#subSubPeriodKline').is(':checked') ? 'subsub' :
|
||||
($('#elementPeriodKline').is(':checked') ? 'element' : 'main');
|
||||
const periodChanged = (curPeriod !== _lastKlinePeriod);
|
||||
_lastKlinePeriod = curPeriod;
|
||||
|
||||
// 保存当前的可见逻辑范围(周期切换时不保留,避免范围越界)
|
||||
let logicalRange = null;
|
||||
let visibleRange = null;
|
||||
|
||||
if (tvWidget && tvWidget.mainChart) {
|
||||
// 优先使用逻辑范围,这样在缩放级别上更准确
|
||||
if (!periodChanged && tvWidget && tvWidget.mainChart) {
|
||||
logicalRange = tvWidget.mainChart.timeScale().getVisibleLogicalRange();
|
||||
// 备用方案,获取实际时间戳范围
|
||||
visibleRange = tvWidget.mainChart.timeScale().getVisibleRange();
|
||||
}
|
||||
|
||||
@@ -2279,9 +2243,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 截断数据以限制内存占用
|
||||
trimDataInPlace(data, 2000);
|
||||
|
||||
// 保存当前数据
|
||||
if (currentData) {
|
||||
// 覆盖前断开旧引用,帮助GC尽快回收
|
||||
|
||||
Reference in New Issue
Block a user