update our alpaca calls to be separate bid and ask
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user