Administrator
2026-09-21 e5931c6e148b04083d0a23b90dcac7de850d31b9
src/main/resources/static/gate-config.html
@@ -137,9 +137,9 @@
            <div class="form-group full" style="margin-top:6px;border-top:1px solid var(--border);padding-top:8px">
                <label style="font-size:13px;font-weight:600;color:var(--text)">自定义止损(开启后按触发价各挂一单,忽略默认阶梯)</label>
            </div>
            <div class="form-group"><label>自定义止损开关</label><select id="customStopLossEnabled"><option value="false" selected>关闭</option><option value="true">开启</option></select></div>
            <div class="form-group"><label>多仓止损触发价</label><input id="longCustomStopLossPrice" placeholder="如 2540(价格跌至触发平多)"></div>
            <div class="form-group"><label>空仓止损触发价</label><input id="shortCustomStopLossPrice" placeholder="如 2650(价格涨至触发平空)"></div>
            <div class="form-group"><label>自定义止损开关</label><select id="dualStopLossEnabled"><option value="false" selected>关闭</option><option value="true">开启</option></select></div>
            <div class="form-group"><label>多仓止损触发价</label><input id="longStopLossPrice" placeholder="如 2540(价格跌至触发平多)"></div>
            <div class="form-group"><label>空仓止损触发价</label><input id="shortStopLossPrice" placeholder="如 2650(价格涨至触发平空)"></div>
        </form>
    </div>
@@ -217,7 +217,7 @@
        fillForm({ gridRate:0.005, expectedProfit:0.15, maxLoss:1.5,
            baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2, priceDriveEnabled: true, rounds: 0,
            stopLossCountMode:'dual', addPositionInterval:3, addPositionQuantity:1, maxPositionPerSide:0, addPositionStartThreshold:1, placeExcessTakeProfit: 'off',
            customStopLossEnabled: false, longCustomStopLossPrice: null, shortCustomStopLossPrice: null });
            dualStopLossEnabled: false, longStopLossPrice: null, shortStopLossPrice: null });
        toast('未找到配置,已加载默认值,编辑后请保存', 'success');
    }
    currentApiKey = key;
@@ -243,9 +243,9 @@
    byId('maxPositionPerSide').value = d.maxPositionPerSide ?? 0;
    byId('addPositionStartThreshold').value = d.addPositionStartThreshold ?? 1;
    byId('placeExcessTakeProfit').value = normalizeTpMode(d.placeExcessTakeProfit);
    byId('customStopLossEnabled').value = (d.customStopLossEnabled === true || d.customStopLossEnabled === 'true') ? 'true' : 'false';
    byId('longCustomStopLossPrice').value = d.longCustomStopLossPrice || '';
    byId('shortCustomStopLossPrice').value = d.shortCustomStopLossPrice || '';
    byId('dualStopLossEnabled').value = (d.dualStopLossEnabled === true || d.dualStopLossEnabled === 'true') ? 'true' : 'false';
    byId('longStopLossPrice').value = d.longStopLossPrice || '';
    byId('shortStopLossPrice').value = d.shortStopLossPrice || '';
}
function collectForm() {
@@ -267,9 +267,9 @@
        maxPositionPerSide: intVal(byId('maxPositionPerSide').value, 0),
        addPositionStartThreshold: intVal(byId('addPositionStartThreshold').value, 1),
        placeExcessTakeProfit: byId('placeExcessTakeProfit').value,
        customStopLossEnabled: byId('customStopLossEnabled').value === 'true',
        longCustomStopLossPrice: parseFloat(byId('longCustomStopLossPrice').value) || null,
        shortCustomStopLossPrice: parseFloat(byId('shortCustomStopLossPrice').value) || null
        dualStopLossEnabled: byId('dualStopLossEnabled').value === 'true',
        longStopLossPrice: parseFloat(byId('longStopLossPrice').value) || null,
        shortStopLossPrice: parseFloat(byId('shortStopLossPrice').value) || null
    };
}
function intVal(str, fallback) {