mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-17 05:51:02 +00:00
Feat: Add orphan polling task for delayed Kalshi results
This commit is contained in:
@@ -33,6 +33,7 @@ async function main() {
|
||||
|
||||
let latestMarketState = null;
|
||||
|
||||
// Handles markets that rotated BEFORE Kalshi posted the final result
|
||||
async function processOrphans() {
|
||||
if (paper._resetting) return;
|
||||
try {
|
||||
@@ -53,10 +54,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Settle delayed positions before continuing
|
||||
// Check orphans immediately on startup, then every 60 seconds
|
||||
await processOrphans();
|
||||
|
||||
// Continuously check open positions every 60s for delayed results
|
||||
setInterval(processOrphans, 60000);
|
||||
|
||||
const tracker = new MarketTracker();
|
||||
@@ -91,7 +90,6 @@ async function main() {
|
||||
|
||||
if (paper._resetting) return;
|
||||
|
||||
// Only attempt to settle and notify if the result is already available
|
||||
if (result) {
|
||||
const settledPositions = await paper.settle(ticker, result);
|
||||
if (settledPositions) {
|
||||
|
||||
Reference in New Issue
Block a user