mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-16 21:41:02 +00:00
Fix: Block trades/settlements during reset, sync state
This commit is contained in:
@@ -50,6 +50,7 @@ async function main() {
|
||||
writeState(latestMarketState, paper, strategies);
|
||||
|
||||
if (!state) return;
|
||||
if (paper._resetting) return;
|
||||
|
||||
for (const strategy of strategies) {
|
||||
if (!strategy.enabled) continue;
|
||||
@@ -70,6 +71,11 @@ async function main() {
|
||||
tracker.on('settled', async ({ ticker, result }) => {
|
||||
console.log(`[Worker] Market ${ticker} settled: ${result}`);
|
||||
|
||||
if (paper._resetting) {
|
||||
console.log(`[Worker] Skipping settlement for ${ticker} — reset in progress`);
|
||||
return;
|
||||
}
|
||||
|
||||
const settledPositions = await paper.settle(ticker, result);
|
||||
|
||||
for (const strategy of strategies) {
|
||||
|
||||
Reference in New Issue
Block a user