| | |
| | | let logLines = []; |
| | | const logPanel = document.getElementById('logPanel'); |
| | | |
| | | function $(id) { return document.getElementById(id); } |
| | | function byId(id) { return document.getElementById(id); } |
| | | |
| | | function toast(msg, type) { |
| | | const t = document.getElementById('toast'); |
| | |
| | | } |
| | | |
| | | function fillForm(d) { |
| | | $('#gridRate').value = d.gridRate || ''; |
| | | $('#expectedProfit').value = d.expectedProfit || ''; |
| | | $('#maxLoss').value = d.maxLoss || ''; |
| | | $('#baseQuantity').value = d.baseQuantity || ''; |
| | | $('#quantity').value = d.quantity || ''; |
| | | $('#maxPositionSize').value = d.maxPositionSize ?? ''; |
| | | $('#stopLossCount').value = d.stopLossCount ?? ''; |
| | | byId('gridRate').value = d.gridRate || ''; |
| | | byId('expectedProfit').value = d.expectedProfit || ''; |
| | | byId('maxLoss').value = d.maxLoss || ''; |
| | | byId('baseQuantity').value = d.baseQuantity || ''; |
| | | byId('quantity').value = d.quantity || ''; |
| | | byId('maxPositionSize').value = d.maxPositionSize ?? ''; |
| | | byId('stopLossCount').value = d.stopLossCount ?? ''; |
| | | } |
| | | |
| | | function collectForm() { |
| | | return { |
| | | apiKey: currentApiKey, |
| | | gridRate: parseFloat($('#gridRate').value) || 0, |
| | | expectedProfit: parseFloat($('#expectedProfit').value) || 0, |
| | | maxLoss: parseFloat($('#maxLoss').value) || 0, |
| | | baseQuantity: $('#baseQuantity').value, |
| | | quantity: $('#quantity').value, |
| | | maxPositionSize: parseInt($('#maxPositionSize').value) || 0, |
| | | stopLossCount: parseInt($('#stopLossCount').value) || 0 |
| | | gridRate: parseFloat(byId('gridRate').value) || 0, |
| | | expectedProfit: parseFloat(byId('expectedProfit').value) || 0, |
| | | maxLoss: parseFloat(byId('maxLoss').value) || 0, |
| | | baseQuantity: byId('baseQuantity').value, |
| | | quantity: byId('quantity').value, |
| | | maxPositionSize: parseInt(byId('maxPositionSize').value) || 0, |
| | | stopLossCount: parseInt(byId('stopLossCount').value) || 0 |
| | | }; |
| | | } |
| | | |