Commit ·
2ca5f08
1
Parent(s): 1265987
Sort running bots before closed on dart-performance
Browse files- .gitignore +7 -0
- local_app.py +5 -1
.gitignore
CHANGED
|
@@ -53,3 +53,10 @@ latest_scan_*.json
|
|
| 53 |
bybit_pnl.json
|
| 54 |
bybit_pnl_history.json
|
| 55 |
bybit_bots_history.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
bybit_pnl.json
|
| 54 |
bybit_pnl_history.json
|
| 55 |
bybit_bots_history.json
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# One-off debug/test scripts
|
| 59 |
+
test_closed_bot.py
|
| 60 |
+
seed_closed_bot.py
|
| 61 |
+
test_bybit*.py
|
| 62 |
+
test_gate*.py
|
local_app.py
CHANGED
|
@@ -1080,7 +1080,11 @@ def bot_history_api():
|
|
| 1080 |
cumulative_pnl = 0.0
|
| 1081 |
total_seconds = 0
|
| 1082 |
|
| 1083 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1084 |
|
| 1085 |
for b in sorted_bots:
|
| 1086 |
pnl = float(b.get("final_pnl", 0) or 0)
|
|
|
|
| 1080 |
cumulative_pnl = 0.0
|
| 1081 |
total_seconds = 0
|
| 1082 |
|
| 1083 |
+
def _sort_key(b):
|
| 1084 |
+
status_rank = 0 if b.get("status") == "running" else 1
|
| 1085 |
+
return (status_rank, -b.get("create_time", 0))
|
| 1086 |
+
|
| 1087 |
+
sorted_bots = sorted(bots, key=_sort_key)
|
| 1088 |
|
| 1089 |
for b in sorted_bots:
|
| 1090 |
pnl = float(b.get("final_pnl", 0) or 0)
|