Setup Alpaca API implementation
This commit is contained in:
@@ -1,9 +1,26 @@
|
||||
import Alpaca from '@alpacahq/alpaca-trade-api'
|
||||
import { AlpacaPortfolioProvider } from './portfolio'
|
||||
import { AlpacaQuoteProvider } from './quote'
|
||||
import { Exchange } from '../interface/exchange'
|
||||
import { PortfolioProvider } from '../interface/portfolio'
|
||||
import { QuoteProvider } from '../interface/quote'
|
||||
|
||||
export class AlpacaExchange implements Exchange {
|
||||
readonly alpaca: Alpaca;
|
||||
|
||||
/**
|
||||
* The portfolio provider for the exchange.
|
||||
*/
|
||||
readonly portfolioProvider: PortfolioProvider;
|
||||
|
||||
/**
|
||||
* The quote provider for the exchange.
|
||||
*/
|
||||
readonly quoteProvider: QuoteProvider;
|
||||
|
||||
/**
|
||||
* The name of the exchange.
|
||||
*/
|
||||
readonly name: string;
|
||||
|
||||
constructor(keyId: string, secretKey: string, paper: boolean) {
|
||||
@@ -13,6 +30,9 @@ export class AlpacaExchange implements Exchange {
|
||||
paper: paper
|
||||
});
|
||||
|
||||
this.portfolioProvider = new AlpacaPortfolioProvider(this.alpaca);
|
||||
this.quoteProvider = new AlpacaQuoteProvider(this.alpaca);
|
||||
|
||||
this.name = 'Alpaca';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user