Add bot orchestrator, wire up index.ts, remove old runDay
Bot validates strategy capital allocations, waits for market open, runs all strategies concurrently, and passes signals to the executor. The main loop in index.ts now delegates to Bot.runDay(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,23 +24,3 @@ export async function waitForNextOpen(alpaca: Alpaca) {
|
||||
return wait(new Date(clock.next_open).valueOf() - new Date().valueOf());
|
||||
}
|
||||
|
||||
export async function runDay(alpaca: Alpaca) {
|
||||
console.log('waiting for open');
|
||||
await waitForNextOpen(alpaca);
|
||||
|
||||
await wait(60000); //wait a minute
|
||||
|
||||
const q = await alpaca.getLatestQuote('TQQQ');
|
||||
await wait(1000);
|
||||
|
||||
const q2 = await alpaca.getLatestQuote('TQQQ');
|
||||
|
||||
if (q2.ap - q.ap > 0) {
|
||||
//up day
|
||||
console.log('up day: ', new Date())
|
||||
}
|
||||
else {
|
||||
//down day
|
||||
console.log('down day', new Date());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user