UNPKG

@master-chief/alpaca-ts

Version:

A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.

249 lines (248 loc) 11.6 kB
import type { BaseHttpRequest } from "./rest/BaseHttpRequest.js"; import type { ApiRequestOptions } from "./rest/ApiRequestOptions.js"; declare type Resolver<T> = (options: ApiRequestOptions) => Promise<T>; declare type Headers = Record<string, string>; export declare type Config = { BASE: string; HEADERS?: Headers | Resolver<Headers> | undefined; }; declare type HttpRequestConstructor = new (config: Config) => BaseHttpRequest; interface ClientOptions { paper: boolean; credentials: { key: string; secret: string; }; } export declare class Client { private readonly baseHttpRequest; constructor(options?: ClientOptions, HttpRequest?: HttpRequestConstructor); get v2(): { getWatchlists: () => import("./index.js").CancelablePromise<import("./index.js").Watchlist[]>; postWatchlist: (args_0: { requestBody: import("./index.js").UpdateWatchlistRequest; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; getWatchlistById: (args_0: { watchlistId: string; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; updateWatchlistByI: (args_0: { watchlistId: string; requestBody?: import("./index.js").UpdateWatchlistRequest; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; addAssetToWatchlist: (args_0: { watchlistId: string; requestBody?: { symbol?: string; }; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; deleteWatchlistById: (args_0: { watchlistId: string; }) => import("./index.js").CancelablePromise<void>; getWatchlistByName: (args_0: { name: string; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; updateWatchlistByName: (args_0: { name: string; requestBody?: import("./index.js").UpdateWatchlistRequest; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; addAssetToWatchlistByName: (args_0: { name: string; requestBody?: { symbol?: string; }; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; deleteWatchlistByName: (args_0: { name: string; }) => import("./index.js").CancelablePromise<void>; removeAssetFromWatchlist: (args_0: { watchlistId: string; symbol: string; }) => import("./index.js").CancelablePromise<import("./index.js").Watchlist>; getPositions: () => import("./index.js").CancelablePromise<import("./index.js").Position[]>; deleteAllOpenPositions: (args_0: { cancelOrders?: boolean; }) => import("./index.js").CancelablePromise<import("./index.js").PositionClosedReponse[]>; getOpenPosition: (args_0: { symbolOrAssetId: string; }) => import("./index.js").CancelablePromise<import("./index.js").Position>; deleteOpenPosition: (args_0: { symbolOrAssetId: string; qty?: number; percentage?: number; }) => import("./index.js").CancelablePromise<import("./index.js").Order>; getStockBars: (args_0: { symbols: string; timeframe: string; start?: string; end?: string; limit?: number; pageToken?: string; adjustment?: "all" | "raw" | "split" | "dividend"; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").MultiBarsResponse>; getStockBarsLatest: (args_0: { symbols: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiBarsResponse>; getStockTrades: (args_0: { symbols: string; start?: string; end?: string; limit?: number; pageToken?: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").MultiTradesResponse>; getStockTradesLatest: (args_0: { symbols: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiTradesResponse>; getStockQuotes: (args_0: { symbols: string; start?: string; end?: string; limit?: number; pageToken?: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").MultiQuotesReponse>; getStockQuotesLatest: (args_0: { symbols: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiQuotesResponse>; getStockSnapshots: (args_0: { symbols: string; feed?: "iex" | "sip" | "otc"; }) => import("./index.js").CancelablePromise<import("./index.js").MultiSnapshotResponse>; getStockMetaExchanges: () => import("./index.js").CancelablePromise<import("./index.js").ExchangesResponse>; getStockMetaConditions: (args_0: { type: "trade" | "quote"; tape: "A" | "B" | "C"; }) => import("./index.js").CancelablePromise<Record<string, any>>; postOrder: (args_0: { requestBody: string; }) => import("./index.js").CancelablePromise<import("./index.js").Order>; getOrders: (args_0: { status?: "open" | "closed" | "all"; limit?: number; after?: string; until?: string; direction?: "asc" | "desc"; nested?: boolean; symbols?: string; side?: string; }) => import("./index.js").CancelablePromise<import("./index.js").Order[]>; deleteAllOrders: () => import("./index.js").CancelablePromise<import("./index.js").CanceledOrderResponse[]>; getOrderByOrderId: (args_0: { orderId: string; nested?: boolean; }) => import("./index.js").CancelablePromise<import("./index.js").Order>; patchOrderByOrderId: (args_0: { orderId: string; requestBody: import("./index.js").PatchOrderRequest; }) => import("./index.js").CancelablePromise<import("./index.js").Order>; deleteOrderByOrderId: (args_0: { orderId: string; }) => import("./index.js").CancelablePromise<void>; getCalendar: (args_0: { start?: string; end?: string; dateType?: string; }) => import("./index.js").CancelablePromise<import("./entities/Calendar.js").Calendar[]>; getClock: () => import("./index.js").CancelablePromise<import("./entities/Clock.js").Clock>; getAssets: (args_0: { status?: string; assetClass?: string; exchange?: string; attributes?: string; }) => import("./index.js").CancelablePromise<import("./entities/Assets.js").Assets[]>; getAssetBySymbolOrId: (args_0: { symbolOrAssetId: string; }) => import("./index.js").CancelablePromise<import("./entities/Assets.js").Assets>; getAccountActivities: (args_0: { activityTypes?: "trade_activity" | "non_trade_activity"; }) => import("./index.js").CancelablePromise<(import("./index.js").TradingActivities | import("./index.js").NonTradeActivities)[]>; getAccountActivitiesByType: (args_0: { activityType: string; date?: string; until?: string; after?: string; direction?: "asc" | "desc"; pageSize?: number; pageToken?: string; category?: string; }) => import("./index.js").CancelablePromise<(import("./index.js").TradingActivities | import("./index.js").NonTradeActivities)[]>; getAccount: () => import("./index.js").CancelablePromise<import("./entities/Account.js").Account>; getAccountPortfolioHistory: (args_0: { period?: string; timeframe?: string; dateEnd?: string; extendedHours?: string; }) => import("./index.js").CancelablePromise<import("./index.js").PortfolioHistory>; getAccountConfigurations: () => import("./index.js").CancelablePromise<import("./entities/AccountConfigurations.js").AccountConfigurations>; patchAccountConfigurations: (args_0: { requestBody?: import("./entities/AccountConfigurations.js").AccountConfigurations; }) => import("./index.js").CancelablePromise<import("./entities/AccountConfigurations.js").AccountConfigurations>; }; get v1beta3(): { readonly getCryptoTrades: (args_0: { symbols: string; start?: string; end?: string; exchanges?: string; limit?: number; pageToken?: string; }) => import("./index.js").CancelablePromise<import("./index.js").MultiTradesResponse>; readonly getCryptoTradesLatest: (args_0: { symbols: string; exchange: "ERSX" | "CBSE" | "FTXU"; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiTradesResponse>; readonly getCryptoBars: (args_0: { symbols: string; timeframe: string; start?: string; end?: string; pageToken?: string; limit?: number; exchanges?: string; }) => import("./index.js").CancelablePromise<import("./index.js").MultiBarsResponse>; readonly getCryptoBarsLatest: (args_0: { symbols: string; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiBarsResponse>; readonly getCryptoQuotes: (args_0: { symbols: string; start?: string; end?: string; exchanges?: string; limit?: number; pageToken?: string; }) => import("./index.js").CancelablePromise<import("./index.js").MultiQuotesReponse>; readonly getCryptoQuotesLatest: (args_0: { symbols: string; exchange: "ERSX" | "CBSE" | "FTXU"; }) => import("./index.js").CancelablePromise<import("./index.js").LatestMultiQuotesResponse>; readonly getCryptoSnapshots: (args_0: { exchange: "ERSX" | "CBSE" | "FTXU"; symbols: string; }) => import("./index.js").CancelablePromise<import("./index.js").MultiSnapshotResponse>; }; get v1beta1(): { getLogo: (args_0: { cryptoOrStockSymbol: string; placeholder?: boolean; }) => import("./index.js").CancelablePromise<Blob>; getScreenerMovers: (args_0: { marketType: "stocks" | "crypto"; top?: number; }) => import("./index.js").CancelablePromise<import("./index.js").MarketMoversResponse>; getNews: (args_0: { symbols: string; start?: string; end?: string; limit?: number; sort?: "DESC" | "ASC"; includeContent?: boolean; excludeContentless?: boolean; pageToken?: string; }) => import("./index.js").CancelablePromise<import("./index.js").GetNewsResponse>; }; } export {};