update our alpaca calls to be separate bid and ask

This commit is contained in:
Jon
2026-02-03 13:58:42 -07:00
parent 8872803563
commit e32e30af47
11 changed files with 116 additions and 71 deletions

View File

@@ -31,14 +31,12 @@ export class MomentumIndicator implements Indicator<MomentumResult> {
async evaluate(alpaca: Alpaca): Promise<MomentumResult> {
await wait(this.config.settleDelay);
const before = await alpaca.getLatestQuote(this.config.symbol);
const priceBefore = before.ap;
const priceBefore = await alpaca.getLatestAsk(this.config.symbol);
await wait(this.config.sampleDelay);
const after = await alpaca.getLatestQuote(this.config.symbol);
const priceAfter = after.ap;
const priceAfter = await alpaca.getLatestAsk(this.config.symbol);
const direction = priceAfter >= priceBefore ? 'up' : 'down';
return { direction, priceBefore, priceAfter };