UNPKG

3.7 kBTypeScriptView Raw
1import { Account, Order, Position, Asset, Watchlist, Calendar, Clock, AccountConfigurations, PortfolioHistory, Activity, DefaultCredentials, OAuthCredentials, OrderCancelation, PageOfTrades, PageOfQuotes, PageOfBars, Bar_v1, LastQuote_v1, LastTrade_v1, Snapshot, NewsPage, LatestTrade, Endpoints } from './entities.js';
2import { GetOrder, GetOrders, PlaceOrder, ReplaceOrder, CancelOrder, GetPosition, ClosePosition, GetAsset, GetAssets, GetWatchList, CreateWatchList, UpdateWatchList, AddToWatchList, RemoveFromWatchList, DeleteWatchList, GetCalendar, UpdateAccountConfigurations, GetAccountActivities, GetPortfolioHistory, GetBars, GetBars_v1, GetTrades, GetQuotes, GetLastTrade_v1, GetLastQuote_v1, GetSnapshot, GetSnapshots, ClosePositions, GetNews, GetLatestTrade } from './params.js';
3export declare class AlpacaClient {
4 params: {
5 rate_limit?: boolean;
6 endpoints?: Endpoints | Map<keyof Endpoints, any>;
7 credentials?: DefaultCredentials | OAuthCredentials;
8 };
9 private baseURLs;
10 private limiter;
11 constructor(params: {
12 rate_limit?: boolean;
13 endpoints?: Endpoints | Map<keyof Endpoints, any>;
14 credentials?: DefaultCredentials | OAuthCredentials;
15 });
16 isAuthenticated(): Promise<boolean>;
17 getAccount(): Promise<Account>;
18 getOrder(params: GetOrder): Promise<Order>;
19 getOrders(params?: GetOrders): Promise<Order[]>;
20 placeOrder(params: PlaceOrder): Promise<Order>;
21 replaceOrder(params: ReplaceOrder): Promise<Order>;
22 cancelOrder(params: CancelOrder): Promise<boolean>;
23 cancelOrders(): Promise<OrderCancelation[]>;
24 getPosition(params: GetPosition): Promise<Position>;
25 getPositions(): Promise<Position[]>;
26 closePosition(params: ClosePosition): Promise<Order>;
27 closePositions(params: ClosePositions): Promise<Order[]>;
28 getAsset(params: GetAsset): Promise<Asset>;
29 getAssets(params?: GetAssets): Promise<Asset[]>;
30 getWatchlist(params: GetWatchList): Promise<Watchlist>;
31 getWatchlists(): Promise<Watchlist[]>;
32 createWatchlist(params: CreateWatchList): Promise<Watchlist[]>;
33 updateWatchlist(params: UpdateWatchList): Promise<Watchlist>;
34 addToWatchlist(params: AddToWatchList): Promise<Watchlist>;
35 removeFromWatchlist(params: RemoveFromWatchList): Promise<boolean>;
36 deleteWatchlist(params: DeleteWatchList): Promise<boolean>;
37 getCalendar(params?: GetCalendar): Promise<Calendar[]>;
38 getNews(params?: GetNews): Promise<NewsPage>;
39 getClock(): Promise<Clock>;
40 getAccountConfigurations(): Promise<AccountConfigurations>;
41 updateAccountConfigurations(params: UpdateAccountConfigurations): Promise<AccountConfigurations>;
42 getAccountActivities(params: GetAccountActivities): Promise<Activity[]>;
43 getPortfolioHistory(params?: GetPortfolioHistory): Promise<PortfolioHistory>;
44 /** @deprecated Alpaca Data API v2 is currently in public beta. */
45 getBars_v1(params: GetBars_v1): Promise<{
46 [symbol: string]: Bar_v1[];
47 }>;
48 /** @deprecated Alpaca Data API v2 is currently in public beta. */
49 getLastTrade_v1(params: GetLastTrade_v1): Promise<LastTrade_v1>;
50 /** @deprecated Alpaca Data API v2 is currently in public beta. */
51 getLastQuote_v1(params: GetLastQuote_v1): Promise<LastQuote_v1>;
52 getTrades(params: GetTrades): Promise<PageOfTrades>;
53 getQuotes(params: GetQuotes): Promise<PageOfQuotes>;
54 getBars(params: GetBars): Promise<PageOfBars>;
55 getLatestTrade({ symbol, feed, limit, }: GetLatestTrade): Promise<LatestTrade>;
56 getSnapshot(params: GetSnapshot): Promise<Snapshot>;
57 getSnapshots(params: GetSnapshots): Promise<{
58 [key: string]: Snapshot;
59 }>;
60 private request;
61}