update our alpaca calls to be separate bid and ask
This commit is contained in:
@@ -32,8 +32,8 @@ export interface AlpacaClock {
|
||||
}
|
||||
|
||||
export interface AlpacaQuote {
|
||||
ap: number; // ask price
|
||||
bp: number; // bid price
|
||||
AskPrice: number;
|
||||
BidPrice: number;
|
||||
}
|
||||
|
||||
export interface AlpacaTrade {
|
||||
@@ -83,8 +83,17 @@ export class Alpaca {
|
||||
return this.alpaca.getClock();
|
||||
}
|
||||
|
||||
public async getLatestQuote(symbol: string) {
|
||||
return this.alpaca.getLatestQuote(symbol);
|
||||
public async getLatestAsk(symbol: string): Promise<number> {
|
||||
const quote = await this.alpaca.getLatestQuote(symbol);
|
||||
return quote.AskPrice;
|
||||
}
|
||||
public async getLatestBid(symbol: string): Promise<number> {
|
||||
const quote = await this.alpaca.getLatestQuote(symbol);
|
||||
return quote.BidPrice;
|
||||
}
|
||||
public async getLatestSpread(symbol: string): Promise<number> {
|
||||
const quote = await this.alpaca.getLatestQuote(symbol);
|
||||
return quote.AskPrice - quote.BidPrice;
|
||||
}
|
||||
public async getLatestTrades(symbols: string[]) {
|
||||
return this.alpaca.getLatestTrades(symbols);
|
||||
|
||||
Reference in New Issue
Block a user