mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-16 21:41:02 +00:00
Fix: Block new trades if strategy has unresolved positions
This commit is contained in:
@@ -72,6 +72,14 @@ async function main() {
|
||||
for (const strategy of strategies) {
|
||||
if (!strategy.enabled) continue;
|
||||
|
||||
// FIX: Prevent parallel betting!
|
||||
// If the strategy has an unresolved position in limbo, it MUST wait.
|
||||
// This protects the strict mathematical sequence of Martingale systems.
|
||||
const acct = paper._getAccount(strategy.name);
|
||||
if (acct.openPositions.size > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const signal = strategy.evaluate(state);
|
||||
if (signal) {
|
||||
console.log(`[Worker] Signal from ${strategy.name}: ${signal.side} @ ${signal.price}¢ — ${signal.reason}`);
|
||||
|
||||
Reference in New Issue
Block a user