Commit ·
4412eae
1
Parent(s): e47cd4c
feat(dart): manual investment field for added running bots
Browse files- local_app.py +7 -1
- templates/dart_add_bot.html +4 -0
local_app.py
CHANGED
|
@@ -1098,6 +1098,11 @@ def dart_add_bot_submit():
|
|
| 1098 |
bot_id = (request.form.get('bot_id') or '').strip()
|
| 1099 |
start_date = (request.form.get('start_date') or '').strip()
|
| 1100 |
start_time = (request.form.get('start_time') or '').strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1101 |
|
| 1102 |
if not bot_id.isdigit():
|
| 1103 |
return "Bot ID must be numeric", 400
|
|
@@ -1116,6 +1121,7 @@ def dart_add_bot_submit():
|
|
| 1116 |
"bot_id": bot_id,
|
| 1117 |
"start_local": local_dt.strftime('%Y-%m-%dT%H:%M'),
|
| 1118 |
"start_utc": start_utc,
|
|
|
|
| 1119 |
"added_at": int(_dt.datetime.utcnow().timestamp()),
|
| 1120 |
})
|
| 1121 |
_save_manual_running_bots(bots)
|
|
@@ -1146,7 +1152,7 @@ def bot_history_api():
|
|
| 1146 |
"end_time": None,
|
| 1147 |
"final_pnl": 0,
|
| 1148 |
"final_pnl_per": 0,
|
| 1149 |
-
"investment": 0,
|
| 1150 |
"duration_seconds": max(0, _now - _start) if _start else 0,
|
| 1151 |
})
|
| 1152 |
|
|
|
|
| 1098 |
bot_id = (request.form.get('bot_id') or '').strip()
|
| 1099 |
start_date = (request.form.get('start_date') or '').strip()
|
| 1100 |
start_time = (request.form.get('start_time') or '').strip()
|
| 1101 |
+
investment_raw = (request.form.get('investment') or '').strip()
|
| 1102 |
+
try:
|
| 1103 |
+
investment = float(investment_raw) if investment_raw else 0.0
|
| 1104 |
+
except Exception:
|
| 1105 |
+
return "Investment must be a number", 400
|
| 1106 |
|
| 1107 |
if not bot_id.isdigit():
|
| 1108 |
return "Bot ID must be numeric", 400
|
|
|
|
| 1121 |
"bot_id": bot_id,
|
| 1122 |
"start_local": local_dt.strftime('%Y-%m-%dT%H:%M'),
|
| 1123 |
"start_utc": start_utc,
|
| 1124 |
+
"manual_investment": investment,
|
| 1125 |
"added_at": int(_dt.datetime.utcnow().timestamp()),
|
| 1126 |
})
|
| 1127 |
_save_manual_running_bots(bots)
|
|
|
|
| 1152 |
"end_time": None,
|
| 1153 |
"final_pnl": 0,
|
| 1154 |
"final_pnl_per": 0,
|
| 1155 |
+
"investment": float(_m.get("manual_investment", 0) or 0),
|
| 1156 |
"duration_seconds": max(0, _now - _start) if _start else 0,
|
| 1157 |
})
|
| 1158 |
|
templates/dart_add_bot.html
CHANGED
|
@@ -40,6 +40,10 @@
|
|
| 40 |
<input type="text" id="bot_id" name="bot_id" placeholder="e.g. 639017655998648796" required pattern="[0-9]+" inputmode="numeric">
|
| 41 |
<div class="hint">Numeric ID from Bybit's bot detail page.</div>
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
<label>Start Date & Time (Armenia, UTC+4)</label>
|
| 44 |
<div class="row">
|
| 45 |
<div><input type="date" id="start_date" name="start_date" value="{{ default_date }}" required></div>
|
|
|
|
| 40 |
<input type="text" id="bot_id" name="bot_id" placeholder="e.g. 639017655998648796" required pattern="[0-9]+" inputmode="numeric">
|
| 41 |
<div class="hint">Numeric ID from Bybit's bot detail page.</div>
|
| 42 |
|
| 43 |
+
<label for="investment">Investment (USD)</label>
|
| 44 |
+
<input type="text" id="investment" name="investment" placeholder="e.g. 50" inputmode="decimal">
|
| 45 |
+
<div class="hint">Optional. Leave blank if unknown.</div>
|
| 46 |
+
|
| 47 |
<label>Start Date & Time (Armenia, UTC+4)</label>
|
| 48 |
<div class="row">
|
| 49 |
<div><input type="date" id="start_date" name="start_date" value="{{ default_date }}" required></div>
|