Administrator
2026-07-22 13020c80158ec25202c6296286941932f8e89b02
src/main/resources/static/gate-config.html
@@ -115,6 +115,7 @@
            <div class="form-group"><label>最大持仓张数</label><input id="maxPositionSize" placeholder="4"></div>
            <div class="form-group"><label>止损阶梯次数</label><input id="stopLossCount" placeholder="0"></div>
            <div class="form-group"><label>止盈网格跨度</label><input id="takeProfitGridSpan" placeholder="2"></div>
            <div class="form-group"><label>价格驱动开关</label><select id="priceDriveEnabled"><option value="true" selected>开启</option><option value="false">关闭</option></select></div>
        </form>
    </div>
@@ -190,7 +191,7 @@
    } catch(e) {
        // 文件不存在 → 用默认值填充,用户可编辑后保存
        fillForm({ gridRate:0.005, expectedProfit:0.15, maxLoss:1.5,
            baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2 });
            baseQuantity:'2', quantity:'2', maxPositionSize:4, stopLossCount:0, takeProfitGridSpan:2, priceDriveEnabled: true });
        toast('未找到配置,已加载默认值,编辑后请保存', 'success');
    }
    currentApiKey = key;
@@ -208,6 +209,7 @@
    byId('maxPositionSize').value = d.maxPositionSize ?? '';
    byId('stopLossCount').value = d.stopLossCount ?? '';
    byId('takeProfitGridSpan').value = d.takeProfitGridSpan ?? '';
    byId('priceDriveEnabled').value = (d.priceDriveEnabled === true || d.priceDriveEnabled === 'true') ? 'true' : 'false';
}
function collectForm() {
@@ -220,7 +222,8 @@
        quantity: byId('quantity').value,
        maxPositionSize: parseInt(byId('maxPositionSize').value) || 0,
        stopLossCount: parseInt(byId('stopLossCount').value) || 0,
        takeProfitGridSpan: parseInt(byId('takeProfitGridSpan').value) || 2
        takeProfitGridSpan: parseInt(byId('takeProfitGridSpan').value) || 2,
        priceDriveEnabled: byId('priceDriveEnabled').value === 'true'
    };
}