feat(ui): strategy config form and backend endpoint

This commit is contained in:
2026-02-07 08:06:27 +08:00
parent f30bcdc680
commit 06081aa939
3 changed files with 102 additions and 15 deletions

View File

@@ -560,29 +560,53 @@
<h6 class="mb-0">Create New Strategy</h6>
</div>
<div class="card-body">
<form>
<form id="strategy-config-form">
<div class="mb-3">
<label class="form-label">Strategy Name</label>
<input type="text" class="form-control bg-dark border-secondary-dark text-light" placeholder="e.g., Momentum Breakout">
<input id="strategy-name" type="text" class="form-control bg-dark border-secondary-dark text-light" placeholder="e.g., Momentum Breakout" required>
</div>
<div class="mb-3">
<label class="form-label">Strategy Type</label>
<select class="form-select bg-dark border-secondary-dark text-light">
<option>Trend Following</option>
<option>Mean Reversion</option>
<option>Arbitrage</option>
<option>Machine Learning</option>
<select id="strategy-type" class="form-select bg-dark border-secondary-dark text-light">
<option value="trend">Trend Following</option>
<option value="mean-reversion">Mean Reversion</option>
<option value="arbitrage">Arbitrage</option>
<option value="ml">Machine Learning</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Initial Capital</label>
<div class="input-group">
<span class="input-group-text bg-dark border-secondary-dark text-light">$</span>
<input type="number" class="form-control bg-dark border-secondary-dark text-light" value="100000">
<input id="initial-capital" type="number" class="form-control bg-dark border-secondary-dark text-light" value="100000" min="1000" step="1000" required>
</div>
</div>
<div class="row mb-3">
<div class="col-md-6 mb-3 mb-md-0">
<label class="form-label">Entry Lookback (bars)</label>
<input id="entry-lookback" type="number" class="form-control bg-dark border-secondary-dark text-light" value="20" min="1">
</div>
<div class="col-md-6">
<label class="form-label">Exit Lookback (bars)</label>
<input id="exit-lookback" type="number" class="form-control bg-dark border-secondary-dark text-light" value="50" min="1">
</div>
</div>
<div class="row mb-3">
<div class="col-md-6 mb-3 mb-md-0">
<label class="form-label">Risk per Trade (%)</label>
<input id="risk-per-trade" type="number" class="form-control bg-dark border-secondary-dark text-light" value="1" min="0.1" max="5" step="0.1">
</div>
<div class="col-md-6">
<label class="form-label">Max Positions</label>
<input id="max-positions" type="number" class="form-control bg-dark border-secondary-dark text-light" value="5" min="1">
</div>
</div>
<div class="mb-3">
<label class="form-label">Notes</label>
<textarea id="strategy-notes" class="form-control bg-dark border-secondary-dark text-light" rows="2" placeholder="Optional notes about this configuration"></textarea>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary">Create & Backtest</button>
<button type="submit" class="btn btn-primary">Save Configuration</button>
</div>
</form>
</div>