@adaptic/utils 0.0.359

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +824 -0
  2. package/dist/index.cjs +13641 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +13614 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/test.js +7336 -0
  7. package/dist/test.js.map +1 -0
  8. package/dist/types/adaptic.d.ts +18 -0
  9. package/dist/types/adaptic.d.ts.map +1 -0
  10. package/dist/types/alpaca-functions.d.ts +233 -0
  11. package/dist/types/alpaca-functions.d.ts.map +1 -0
  12. package/dist/types/alpaca-market-data-api.d.ts +371 -0
  13. package/dist/types/alpaca-market-data-api.d.ts.map +1 -0
  14. package/dist/types/alpaca-trading-api.d.ts +315 -0
  15. package/dist/types/alpaca-trading-api.d.ts.map +1 -0
  16. package/dist/types/alphavantage.d.ts +44 -0
  17. package/dist/types/alphavantage.d.ts.map +1 -0
  18. package/dist/types/crypto.d.ts +46 -0
  19. package/dist/types/crypto.d.ts.map +1 -0
  20. package/dist/types/display-manager.d.ts +24 -0
  21. package/dist/types/display-manager.d.ts.map +1 -0
  22. package/dist/types/format-tools.d.ts +54 -0
  23. package/dist/types/format-tools.d.ts.map +1 -0
  24. package/dist/types/index.d.ts +415 -0
  25. package/dist/types/index.d.ts.map +1 -0
  26. package/dist/types/logging.d.ts +12 -0
  27. package/dist/types/logging.d.ts.map +1 -0
  28. package/dist/types/market-hours.d.ts +24 -0
  29. package/dist/types/market-hours.d.ts.map +1 -0
  30. package/dist/types/market-time.d.ts +184 -0
  31. package/dist/types/market-time.d.ts.map +1 -0
  32. package/dist/types/metrics-calcs.d.ts +6 -0
  33. package/dist/types/metrics-calcs.d.ts.map +1 -0
  34. package/dist/types/misc-utils.d.ts +49 -0
  35. package/dist/types/misc-utils.d.ts.map +1 -0
  36. package/dist/types/performance-metrics.d.ts +88 -0
  37. package/dist/types/performance-metrics.d.ts.map +1 -0
  38. package/dist/types/polygon-indices.d.ts +85 -0
  39. package/dist/types/polygon-indices.d.ts.map +1 -0
  40. package/dist/types/polygon.d.ts +126 -0
  41. package/dist/types/polygon.d.ts.map +1 -0
  42. package/dist/types/price-utils.d.ts +26 -0
  43. package/dist/types/price-utils.d.ts.map +1 -0
  44. package/dist/types/technical-analysis.d.ts +90 -0
  45. package/dist/types/technical-analysis.d.ts.map +1 -0
  46. package/dist/types/test.d.ts +2 -0
  47. package/dist/types/test.d.ts.map +1 -0
  48. package/dist/types/testing/options-ws.d.ts +2 -0
  49. package/dist/types/testing/options-ws.d.ts.map +1 -0
  50. package/dist/types/time-utils.d.ts +17 -0
  51. package/dist/types/time-utils.d.ts.map +1 -0
  52. package/dist/types/types/adaptic-types.d.ts +11 -0
  53. package/dist/types/types/adaptic-types.d.ts.map +1 -0
  54. package/dist/types/types/alpaca-types.d.ts +998 -0
  55. package/dist/types/types/alpaca-types.d.ts.map +1 -0
  56. package/dist/types/types/alphavantage-types.d.ts +66 -0
  57. package/dist/types/types/alphavantage-types.d.ts.map +1 -0
  58. package/dist/types/types/index.d.ts +21 -0
  59. package/dist/types/types/index.d.ts.map +1 -0
  60. package/dist/types/types/logging-types.d.ts +10 -0
  61. package/dist/types/types/logging-types.d.ts.map +1 -0
  62. package/dist/types/types/market-time-types.d.ts +59 -0
  63. package/dist/types/types/market-time-types.d.ts.map +1 -0
  64. package/dist/types/types/metrics-types.d.ts +33 -0
  65. package/dist/types/types/metrics-types.d.ts.map +1 -0
  66. package/dist/types/types/polygon-indices-types.d.ts +190 -0
  67. package/dist/types/types/polygon-indices-types.d.ts.map +1 -0
  68. package/dist/types/types/polygon-types.d.ts +204 -0
  69. package/dist/types/types/polygon-types.d.ts.map +1 -0
  70. package/dist/types/types/ta-types.d.ts +89 -0
  71. package/dist/types/types/ta-types.d.ts.map +1 -0
  72. package/package.json +55 -0
@@ -0,0 +1,18 @@
1
+ import { AssetOverviewResponse } from './types';
2
+ type ApolloClientType = any;
3
+ /**
4
+ * Returns a shared Apollo client instance with connection pooling.
5
+ * This should be used for all @adaptic/backend-legacy operations.
6
+ *
7
+ * @returns {Promise<ApolloClientType>} The shared Apollo client instance.
8
+ */
9
+ export declare const getSharedApolloClient: () => Promise<ApolloClientType>;
10
+ /**
11
+ * Fetches the asset overview for a given symbol from the Adaptic backend.
12
+ *
13
+ * @param {string} symbol - The symbol of the asset to fetch.
14
+ * @returns {Promise<AssetOverviewResponse>} - A promise that resolves to the asset overview response.
15
+ */
16
+ export declare const fetchAssetOverview: (symbol: string) => Promise<AssetOverviewResponse>;
17
+ export {};
18
+ //# sourceMappingURL=adaptic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptic.d.ts","sourceRoot":"","sources":["../../src/adaptic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,SAAS,CAAC;AAI/D,KAAK,gBAAgB,GAAG,GAAG,CAAC;AAK5B;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,gBAAgB,CAWtE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,qBAAqB,CA0DtF,CAAC"}
@@ -0,0 +1,233 @@
1
+ import { types } from '@adaptic/backend-legacy';
2
+ import { AccountConfiguration, AlpacaPosition, SimpleNews, CreateOrderParams, GetOrdersParams, AlpacaOrder, ReplaceOrderParams, AlpacaAuth, AlpacaAccountDetails, PortfolioHistoryResponse, FetchPortfolioHistoryProps, AlpacaAsset, DataFeed, LatestQuotesResponse } from './types/alpaca-types';
3
+ import { ApolloClientType, NormalizedCacheObject } from '@adaptic/backend-legacy';
4
+ /**
5
+ * Creates a new order in Alpaca.
6
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
7
+ * @param {CreateOrderParams} params - The parameters for creating the order.
8
+ * @returns {Promise<Order>} The created order.
9
+ */
10
+ export declare function createOrder(auth: AlpacaAuth, params: CreateOrderParams): Promise<AlpacaOrder>;
11
+ /**
12
+ * Retrieves a list of orders from Alpaca.
13
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
14
+ * @param {GetOrdersParams} [params={}] - The parameters for fetching orders.
15
+ * @returns {Promise<AlpacaOrder[]>} The list of orders.
16
+ */
17
+ export declare function getOrders(auth: AlpacaAuth, params?: GetOrdersParams): Promise<AlpacaOrder[]>;
18
+ /**
19
+ * Cancels all orders in Alpaca.
20
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
21
+ * @returns {Promise<{ id: string; status: number }[]>} The list of canceled orders with their statuses.
22
+ */
23
+ export declare function cancelAllOrders(auth: AlpacaAuth): Promise<{
24
+ id: string;
25
+ status: number;
26
+ }[]>;
27
+ /**
28
+ * Retrieves a specific order from Alpaca.
29
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
30
+ * @param {string} orderId - The ID of the order to retrieve.
31
+ * @param {boolean} [nested] - Whether to include nested details.
32
+ * @returns {Promise<Order>} The requested order.
33
+ */
34
+ export declare function getOrder(auth: AlpacaAuth, orderId: string, nested?: boolean): Promise<AlpacaOrder>;
35
+ /**
36
+ * Replaces an existing order in Alpaca.
37
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
38
+ * @param {string} orderId - The ID of the order to replace.
39
+ * @param {ReplaceOrderParams} params - The parameters for replacing the order.
40
+ * @returns {Promise<Order>} The updated order.
41
+ */
42
+ export declare function replaceOrder(auth: AlpacaAuth, orderId: string, params: ReplaceOrderParams): Promise<AlpacaOrder>;
43
+ /**
44
+ * Cancels a specific order in Alpaca.
45
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
46
+ * @param {string} orderId - The ID of the order to cancel.
47
+ * @returns {Promise<{ success: boolean; message?: string }>} - Success status and optional message if order not found.
48
+ */
49
+ export declare function cancelOrder(auth: AlpacaAuth, orderId: string): Promise<{
50
+ success: boolean;
51
+ message?: string;
52
+ }>;
53
+ /**
54
+ * Fetches news articles from Alpaca API for specified symbols.
55
+ * @param {string} symbols - The symbols to fetch news for (comma-separated for multiple symbols, e.g. "AAPL,MSFT,GOOG")
56
+ * @param {Object} params - Optional parameters for fetching news
57
+ * @param {AlpacaAuth} params.auth - Optional Alpaca authentication details
58
+ * @param {Date | string} params.start - Start date for fetching news (default is last 24 hours)
59
+ * @param {Date | string} params.end - End date for fetching news (default is now)
60
+ * @param {number} params.limit - Maximum number of articles to return (default is 10)
61
+ * @param {'asc' | 'desc'} params.sort - Sorting order (default is descending)
62
+ * @param {string} params.page_token - Token for pagination
63
+ * @param {boolean} params.include_content - Whether to include content in the news articles (default is true)
64
+ * @returns {Promise<{ news: SimpleNews[]; nextPageToken?: string }>} The fetched news articles.
65
+ */
66
+ export declare function fetchNews(symbols: string, params?: {
67
+ auth?: AlpacaAuth;
68
+ start?: Date | string;
69
+ end?: Date | string;
70
+ limit?: number;
71
+ sort?: 'asc' | 'desc';
72
+ page_token?: string;
73
+ include_content?: boolean;
74
+ }): Promise<{
75
+ news: SimpleNews[];
76
+ nextPageToken?: string;
77
+ }>;
78
+ export interface FetchAccountDetailsProps {
79
+ auth?: AlpacaAuth;
80
+ accountId?: string;
81
+ client?: ApolloClientType<NormalizedCacheObject>;
82
+ alpacaAccount?: types.AlpacaAccount;
83
+ }
84
+ /**
85
+ * Fetches account details from Alpaca API.
86
+ * @param {FetchAccountDetailsProps} props - The properties for fetching account details.
87
+ * @returns {Promise<AlpacaAccountDetails>} The account details.
88
+ */
89
+ export declare function fetchAccountDetails({ accountId, client, alpacaAccount, auth }: FetchAccountDetailsProps): Promise<AlpacaAccountDetails>;
90
+ /**
91
+ * Fetches portfolio history for one Alpaca account.
92
+ * @param {FetchPortfolioHistoryProps} props - The properties for fetching portfolio history.
93
+ * @returns {Promise<PortfolioHistoryResponse>} The portfolio history.
94
+ */
95
+ /** Fetches portfolio history for one Alpaca account, as stored in Adaptic backend
96
+ */
97
+ export declare function fetchPortfolioHistory({ params, accountId, client, alpacaAccount }: FetchPortfolioHistoryProps): Promise<PortfolioHistoryResponse>;
98
+ /**
99
+ * Fetches all positions for an Alpaca trading account.
100
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
101
+ * @returns {Promise<AlpacaPosition[]>} The list of positions.
102
+ */
103
+ export declare function fetchAllPositions(auth: AlpacaAuth): Promise<AlpacaPosition[]>;
104
+ /**
105
+ * Fetches a specific position for an Alpaca account.
106
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
107
+ * @param {string} symbolOrAssetId - The symbol or asset ID to fetch the position for.
108
+ * @returns {Promise<{ position: AlpacaPosition | null; message?: string }>} The position details or null with message if not found.
109
+ */
110
+ export declare function fetchPosition(auth: AlpacaAuth, symbolOrAssetId: string): Promise<{
111
+ position: AlpacaPosition | null;
112
+ message?: string;
113
+ }>;
114
+ /**
115
+ * Closes a specific position in Alpaca.
116
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
117
+ * @param {string} symbolOrAssetId - The symbol or asset ID of the position to close.
118
+ * @param {Object} [params] - Optional parameters for closing the position.
119
+ * @param {number} [params.qty] - Quantity of shares to close (up to 9 decimal places).
120
+ * @param {number} [params.percentage] - Percentage of position to close (0-100, up to 9 decimal places).
121
+ * @param {boolean} [params.useLimitOrder] - Whether to use a limit order to close the position.
122
+ * @param {boolean} [params.cancelOrders] - Whether to cancel open orders for the symbol before closing.
123
+ * @param {number} [params.slippagePercent1] - Slippage percentage for limit orders (default: 0.1).
124
+ * @param {boolean} [params.extendedHours] - Whether to enable extended hours trading (default: false).
125
+ * @returns {Promise<AlpacaOrder>} The order created to close the position.
126
+ */
127
+ export declare function closePosition(auth: AlpacaAuth, symbolOrAssetId: string, params?: {
128
+ qty?: number;
129
+ percentage?: number;
130
+ useLimitOrder?: boolean;
131
+ cancelOrders?: boolean;
132
+ slippagePercent1?: number;
133
+ extendedHours?: boolean;
134
+ }): Promise<AlpacaOrder>;
135
+ export declare function makeRequest(auth: AlpacaAuth, params: {
136
+ endpoint: string;
137
+ method: string;
138
+ body?: any;
139
+ queryString?: string;
140
+ apiBaseUrl?: string;
141
+ }): Promise<any>;
142
+ /**
143
+ * Create a limit order
144
+ * @param symbol (string) - the symbol of the order
145
+ * @param qty (number) - the quantity of the order
146
+ * @param side (string) - the side of the order
147
+ * @param limitPrice (number) - the limit price of the order
148
+ * @param position_intent (string) - the position intent of the order
149
+ * @param extended_hours (boolean) - whether the order is in extended hours
150
+ * @param client_order_id (string) - the client order id of the order
151
+ */
152
+ export declare function createLimitOrder(auth: AlpacaAuth, params?: {
153
+ symbol: string;
154
+ qty: number;
155
+ side: 'buy' | 'sell';
156
+ limitPrice: number;
157
+ position_intent: 'buy_to_open' | 'buy_to_close' | 'sell_to_open' | 'sell_to_close';
158
+ extended_hours: boolean;
159
+ client_order_id?: string;
160
+ }): Promise<AlpacaOrder>;
161
+ /**
162
+ * Closes all positions in Alpaca.
163
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
164
+ * @param {Object} [params] - Optional parameters for closing all positions.
165
+ * @param {boolean} [params.cancelOrders] - If true, cancels all open orders before closing positions.
166
+ * @param {boolean} [params.useLimitOrders] - If true, uses limit orders to close positions.
167
+ * @returns {Promise<Array<{ symbol: string; status: number; body?: Order }>>} The status of each position closure attempt.
168
+ */
169
+ export declare function closeAllPositions(auth: AlpacaAuth, params?: {
170
+ cancel_orders?: boolean;
171
+ useLimitOrders?: boolean;
172
+ slippagePercent1?: number;
173
+ }): Promise<Array<{
174
+ symbol: string;
175
+ status: number;
176
+ body?: AlpacaOrder;
177
+ }> | void>;
178
+ /**
179
+ * Close all positions using limit orders during extended hours trading
180
+ * @param cancelOrders Whether to cancel related orders (default: true)
181
+ * @returns Promise that resolves when all positions are closed
182
+ */
183
+ /**
184
+ * Closes all positions in Alpaca using limit orders during extended hours trading.
185
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
186
+ * @param {Object} [params] - Optional parameters for closing all positions.
187
+ * @param {boolean} [params.cancelOrders] - If true, cancels all open orders before closing positions.
188
+ * @returns {Promise<Array<{ symbol: string; status: number; body?: Order }>>} The status of each position closure attempt.
189
+ */
190
+ export declare function closeAllPositionsAfterHours(auth: AlpacaAuth, params?: {
191
+ cancel_orders?: boolean;
192
+ slippagePercent1?: number;
193
+ }): Promise<Array<{
194
+ symbol: string;
195
+ status: number;
196
+ body?: AlpacaOrder;
197
+ }> | void>;
198
+ /**
199
+ * Get the most recent quotes for requested symbols
200
+ * @param symbols Array of stock symbols to query
201
+ * @param feed Optional data source (sip/iex/delayed_sip)
202
+ * @param currency Optional currency in ISO 4217 format
203
+ * @returns Latest quote data for each symbol
204
+ * @throws Error if request fails or rate limit exceeded
205
+ */
206
+ export declare function getLatestQuotes(auth: AlpacaAuth, params: {
207
+ symbols: string[];
208
+ feed?: DataFeed;
209
+ currency?: string;
210
+ }): Promise<LatestQuotesResponse>;
211
+ /**
212
+ * Retrieves the configuration for a specific Alpaca account.
213
+ * @param {types.AlpacaAccount} account - The Alpaca account to retrieve the configuration for.
214
+ * @returns {Promise<AccountConfiguration>} The account configuration.
215
+ */
216
+ export declare function getConfiguration(account: types.AlpacaAccount): Promise<AccountConfiguration>;
217
+ /**
218
+ * Updates the configuration for a specific Alpaca account.
219
+ * @param {types.User} user - The user making the update.
220
+ * @param {types.AlpacaAccount} account - The Alpaca account to update.
221
+ * @param {AccountConfiguration} updatedConfig - The updated configuration.
222
+ * @returns {Promise<AccountConfiguration>} The updated account configuration.
223
+ */
224
+ export declare function updateConfiguration(user: types.User, account: types.AlpacaAccount, updatedConfig: AccountConfiguration): Promise<AccountConfiguration>;
225
+ export declare function cleanContent(htmlContent: string): string;
226
+ /**
227
+ * Retrieves an asset from Alpaca by symbol or asset ID.
228
+ * @param {AlpacaAuth} auth - The authentication details for Alpaca.
229
+ * @param {string} symbolOrAssetId - The symbol or asset ID to retrieve.
230
+ * @returns {Promise<Asset>} The requested asset.
231
+ */
232
+ export declare function getAsset(auth: AlpacaAuth, symbolOrAssetId: string): Promise<AlpacaAsset>;
233
+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a,EAAE,oBAAoB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAwK/B;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0BxD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA4B9F"}
@@ -0,0 +1,371 @@
1
+ import { Bar, AlpacaQuote, TimeFrame, AlpacaAsset, OptionBar, OptionsChainParams, OptionsChainResponse, LatestOptionsTradesParams, LatestOptionsTradesResponse, LatestOptionsQuotesParams, LatestOptionsQuotesResponse, LatestQuotesResponse, LatestTradesResponse, HistoricalOptionsBarsParams, HistoricalOptionsBarsResponse, HistoricalOptionsTradesParams, HistoricalOptionsTradesResponse, OptionsSnapshotsParams, OptionsSnapshotsResponse, OptionsConditionCodesResponse, OptionsExchangeCodesResponse, OptionTickType, SimpleNews, DataFeed, StockStreamEventName, OptionStreamEventName, StockStreamEventMap, OptionStreamEventMap } from './types/alpaca-types';
2
+ import { EventEmitter } from 'events';
3
+ /**
4
+ * Parameters for retrieving historical market data bars
5
+ * @see https://data.alpaca.markets/v2/stocks/bars
6
+ */
7
+ export interface HistoricalBarsParams {
8
+ /** Comma-separated list of stock symbols to query, e.g. 'AAPL,MSFT,TSLA' */
9
+ symbols: string[];
10
+ /**
11
+ * Bar duration/timeframe
12
+ * Format: [1-59]Min/T, [1-23]Hour/H, 1Day/D, 1Week/W, [1,2,3,4,6,12]Month/M
13
+ * Examples: "1Min", "5Min", "1Hour", "1Day", "1Week", "1Month"
14
+ */
15
+ timeframe: TimeFrame;
16
+ /**
17
+ * Start datetime in RFC-3339 format (YYYY-MM-DD)
18
+ * Example: "2024-02-11T09:00:00Z"
19
+ */
20
+ start?: string;
21
+ /**
22
+ * End datetime in RFC-3339 format (YYYY-MM-DD)
23
+ * Example: "2024-02-11T16:00:00Z"
24
+ */
25
+ end?: string;
26
+ /**
27
+ * Number of bars to return (1-10000)
28
+ * Default: 1000
29
+ */
30
+ limit?: number;
31
+ /**
32
+
33
+ /**
34
+ * Pagination token for retrieving next page of results
35
+ * Returned in the next_page_token field of the response
36
+ */
37
+ page_token?: string;
38
+ /**
39
+ * Sort order of returned bars
40
+ * - asc: Oldest to newest (default)
41
+ * - desc: Newest to oldest
42
+ */
43
+ sort?: 'asc' | 'desc';
44
+ }
45
+ /**
46
+ * Response from historical bars endpoint
47
+ * Contains OHLCV (Open, High, Low, Close, Volume) data for requested symbols
48
+ */
49
+ export interface HistoricalBarsResponse {
50
+ /**
51
+ * Map of symbol to array of bar data
52
+ * Each bar contains OHLCV data for the specified timeframe
53
+ */
54
+ bars: {
55
+ [symbol: string]: Bar[];
56
+ };
57
+ /**
58
+ * Token for retrieving the next page of results
59
+ * null if there are no more results
60
+ */
61
+ next_page_token: string | null;
62
+ /** Currency of the price data in ISO 4217 format */
63
+ currency: string;
64
+ }
65
+ /**
66
+ * Response from latest bars endpoint
67
+ * Contains the most recent minute bar for each requested symbol
68
+ */
69
+ export interface LatestBarsResponse {
70
+ /**
71
+ * Map of symbol to latest bar data
72
+ * Each bar contains OHLCV data for the most recent minute
73
+ */
74
+ bars: {
75
+ [symbol: string]: Bar;
76
+ };
77
+ /** Currency of the price data in ISO 4217 format */
78
+ currency: string;
79
+ }
80
+ /**
81
+ * Response from last trade endpoint for a single symbol
82
+ * Contains detailed information about the most recent trade
83
+ */
84
+ export interface LastTradeResponse {
85
+ /** Status of the request */
86
+ status: string;
87
+ /** The stock symbol that was queried */
88
+ symbol: string;
89
+ /**
90
+ * Details of the last trade
91
+ * @property price - Trade price
92
+ * @property size - Trade size (quantity)
93
+ * @property exchange - Exchange where trade occurred (see Common Exchange Codes in docs)
94
+ * @property cond1-4 - Trade conditions
95
+ * @property timestamp - UNIX epoch timestamp in milliseconds
96
+ */
97
+ last: {
98
+ price: number;
99
+ size: number;
100
+ exchange: number;
101
+ cond1: number;
102
+ cond2: number;
103
+ cond3: number;
104
+ cond4: number;
105
+ timestamp: number;
106
+ };
107
+ }
108
+ /**
109
+ * Singleton class for interacting with Alpaca Market Data API
110
+ * Provides methods for fetching historical bars, latest bars, last trades, latest trades, latest quotes, and latest quote for a single symbol
111
+ */
112
+ export declare class AlpacaMarketDataAPI extends EventEmitter {
113
+ private static instance;
114
+ private headers;
115
+ private dataURL;
116
+ private apiURL;
117
+ private v1beta1url;
118
+ private stockStreamUrl;
119
+ private optionStreamUrl;
120
+ private stockWs;
121
+ private optionWs;
122
+ private stockSubscriptions;
123
+ private optionSubscriptions;
124
+ setMode(mode?: 'sandbox' | 'test' | 'production'): void;
125
+ getMode(): 'sandbox' | 'test' | 'production';
126
+ private constructor();
127
+ static getInstance(): AlpacaMarketDataAPI;
128
+ on<K extends StockStreamEventName>(event: K, listener: (data: StockStreamEventMap[K]) => void): this;
129
+ on<K extends OptionStreamEventName>(event: K, listener: (data: OptionStreamEventMap[K]) => void): this;
130
+ emit<K extends StockStreamEventName>(event: K, data: StockStreamEventMap[K]): boolean;
131
+ emit<K extends OptionStreamEventName>(event: K, data: OptionStreamEventMap[K]): boolean;
132
+ private connect;
133
+ private sendSubscription;
134
+ connectStockStream(): void;
135
+ connectOptionStream(): void;
136
+ disconnectStockStream(): void;
137
+ disconnectOptionStream(): void;
138
+ subscribe(streamType: 'stock' | 'option', subscriptions: {
139
+ trades?: string[];
140
+ quotes?: string[];
141
+ bars?: string[];
142
+ }): void;
143
+ unsubscribe(streamType: 'stock' | 'option', subscriptions: {
144
+ trades?: string[];
145
+ quotes?: string[];
146
+ bars?: string[];
147
+ }): void;
148
+ private makeRequest;
149
+ /**
150
+ * Get historical OHLCV bars for specified symbols, including pre-market and post-market data
151
+ * Automatically handles pagination to fetch all available data
152
+ * @param params Parameters for historical bars request
153
+ * @returns Historical bars data with all pages combined
154
+ */
155
+ getHistoricalBars(params: HistoricalBarsParams): Promise<HistoricalBarsResponse>;
156
+ /**
157
+ * Get the most recent minute bar for requested symbols
158
+ * @param symbols Array of stock symbols to query
159
+ * @param currency Optional currency in ISO 4217 format
160
+ * @returns Latest bar data for each symbol
161
+
162
+ */
163
+ getLatestBars(symbols: string[], currency?: string): Promise<LatestBarsResponse>;
164
+ /**
165
+ * Get the last trade for a single symbol
166
+ * @param symbol The stock symbol to query
167
+ * @returns Last trade details including price, size, exchange, and conditions
168
+ */
169
+ getLastTrade(symbol: string): Promise<LastTradeResponse>;
170
+ /**
171
+ * Get the most recent trades for requested symbols
172
+ * @param symbols Array of stock symbols to query
173
+ * @param feed Optional data source (sip/iex/delayed_sip)
174
+ * @param currency Optional currency in ISO 4217 format
175
+ * @returns Latest trade data for each symbol
176
+
177
+ */
178
+ getLatestTrades(symbols: string[], feed?: DataFeed, currency?: string): Promise<LatestTradesResponse>;
179
+ /**
180
+ * Get the most recent quotes for requested symbols
181
+ * @param symbols Array of stock symbols to query
182
+ * @param feed Optional data source (sip/iex/delayed_sip)
183
+ * @param currency Optional currency in ISO 4217 format
184
+ * @returns Latest quote data for each symbol
185
+ */
186
+ getLatestQuotes(symbols: string[], feed?: DataFeed, currency?: string): Promise<LatestQuotesResponse>;
187
+ /**
188
+ * Get the latest quote for a single symbol
189
+ * @param symbol The stock symbol to query
190
+ * @param feed Optional data source (sip/iex/delayed_sip)
191
+ * @param currency Optional currency in ISO 4217 format
192
+ * @returns Latest quote data with symbol and currency information
193
+ */
194
+ getLatestQuote(symbol: string, feed?: DataFeed, currency?: string): Promise<{
195
+ quote: AlpacaQuote;
196
+ symbol: string;
197
+ currency: string;
198
+ }>;
199
+ /**
200
+ * Get the previous day's closing price for a symbol
201
+ * @param symbol The stock symbol to query
202
+ * @param referenceDate Optional reference date to get the previous close for
203
+ * @returns Previous day's closing price data
204
+ */
205
+ getPreviousClose(symbol: string, referenceDate?: Date): Promise<Bar | null>;
206
+ /**
207
+ * Get hourly price data for a symbol
208
+ * @param symbol The stock symbol to query
209
+ * @param start Start time in milliseconds
210
+ * @param end End time in milliseconds
211
+ * @returns Array of hourly price bars
212
+ */
213
+ getHourlyPrices(symbol: string, start: number, end: number): Promise<Bar[]>;
214
+ /**
215
+ * Get half-hourly price data for a symbol
216
+ * @param symbol The stock symbol to query
217
+ * @param start Start time in milliseconds
218
+ * @param end End time in milliseconds
219
+ * @returns Array of half-hourly price bars
220
+ */
221
+ getHalfHourlyPrices(symbol: string, start: number, end: number): Promise<Bar[]>;
222
+ /**
223
+ * Get daily price data for a symbol
224
+ * @param symbol The stock symbol to query
225
+ * @param start Start time in milliseconds
226
+ * @param end End time in milliseconds
227
+ * @returns Array of daily price bars
228
+ */
229
+ getDailyPrices(symbol: string, start: number, end: number): Promise<Bar[]>;
230
+ /**
231
+ * Get intraday price data for a symbol
232
+ * @param symbol The stock symbol to query
233
+ * @param minutePeriod Minutes per bar (1, 5, 15, etc.)
234
+ * @param start Start time in milliseconds
235
+ * @param end End time in milliseconds
236
+ * @returns Array of intraday price bars
237
+ */
238
+ getIntradayPrices(symbol: string, minutePeriod: number, start: number, end: number): Promise<Bar[]>;
239
+ /**
240
+ * Analyzes an array of price bars and returns a summary string
241
+ * @param bars Array of price bars to analyze
242
+ * @returns A string summarizing the price data
243
+ */
244
+ static analyzeBars(bars: Bar[]): string;
245
+ /**
246
+ * Get all assets available for trade and data consumption from Alpaca
247
+ * @param params Optional query params: status (e.g. 'active'), asset_class (e.g. 'us_equity', 'crypto')
248
+ * @returns Array of AlpacaAsset objects
249
+ * @see https://docs.alpaca.markets/reference/get-v2-assets-1
250
+ */
251
+ getAssets(params?: {
252
+ status?: string;
253
+ asset_class?: string;
254
+ }): Promise<AlpacaAsset[]>;
255
+ /**
256
+ * Get a single asset by symbol or asset_id
257
+ * @param symbolOrAssetId Symbol or asset_id
258
+ * @returns AlpacaAsset object
259
+ * @see https://docs.alpaca.markets/reference/get-v2-assets-symbol_or_asset_id
260
+ */
261
+ getAsset(symbolOrAssetId: string): Promise<AlpacaAsset>;
262
+ /**
263
+ * Get options chain for an underlying symbol
264
+ * Provides the latest trade, latest quote, and greeks for each contract symbol of the underlying symbol
265
+ * @param params Options chain request parameters
266
+ * @returns Options chain data with snapshots for each contract
267
+ * @see https://docs.alpaca.markets/reference/optionchain
268
+ */
269
+ getOptionsChain(params: OptionsChainParams): Promise<OptionsChainResponse>;
270
+ /**
271
+ * Get the most recent trades for requested option contract symbols
272
+ * @param params Latest options trades request parameters
273
+ * @returns Latest trade data for each option contract symbol
274
+
275
+ * @see https://docs.alpaca.markets/reference/optionlatesttrades
276
+ */
277
+ getLatestOptionsTrades(params: LatestOptionsTradesParams): Promise<LatestOptionsTradesResponse>;
278
+ /**
279
+ * Get the most recent quotes for requested option contract symbols
280
+ * @param params Latest options quotes request parameters
281
+ * @returns Latest quote data for each option contract symbol
282
+
283
+ * @see https://docs.alpaca.markets/reference/optionlatestquotes
284
+ */
285
+ getLatestOptionsQuotes(params: LatestOptionsQuotesParams): Promise<LatestOptionsQuotesResponse>;
286
+ /**
287
+ * Get historical OHLCV bars for option contract symbols
288
+ * Automatically handles pagination to fetch all available data
289
+ * @param params Historical options bars request parameters
290
+ * @returns Historical bar data for each option contract symbol with all pages combined
291
+
292
+ * @see https://docs.alpaca.markets/reference/optionbars
293
+ */
294
+ getHistoricalOptionsBars(params: HistoricalOptionsBarsParams): Promise<HistoricalOptionsBarsResponse>;
295
+ /**
296
+ * Get historical trades for option contract symbols
297
+ * Automatically handles pagination to fetch all available data
298
+ * @param params Historical options trades request parameters
299
+ * @returns Historical trade data for each option contract symbol with all pages combined
300
+
301
+ * @see https://docs.alpaca.markets/reference/optiontrades
302
+ */
303
+ getHistoricalOptionsTrades(params: HistoricalOptionsTradesParams): Promise<HistoricalOptionsTradesResponse>;
304
+ /**
305
+ * Get snapshots for option contract symbols
306
+ * Provides latest trade, latest quote, and greeks for each contract symbol
307
+ * @param params Options snapshots request parameters
308
+ * @returns Snapshot data for each option contract symbol
309
+
310
+ * @see https://docs.alpaca.markets/reference/optionsnapshots
311
+ */
312
+ getOptionsSnapshot(params: OptionsSnapshotsParams): Promise<OptionsSnapshotsResponse>;
313
+ /**
314
+ * Get condition codes for options trades or quotes
315
+ * Returns the mapping between condition codes and their descriptions
316
+ * @param tickType The type of tick data ('trade' or 'quote')
317
+ * @returns Mapping of condition codes to descriptions
318
+
319
+ * @see https://docs.alpaca.markets/reference/optionmetaconditions
320
+ */
321
+ getOptionsConditionCodes(tickType: OptionTickType): Promise<OptionsConditionCodesResponse>;
322
+ /**
323
+ * Get exchange codes for options
324
+ * Returns the mapping between option exchange codes and exchange names
325
+ * @returns Mapping of exchange codes to exchange names
326
+
327
+ * @see https://docs.alpaca.markets/reference/optionmetaexchanges
328
+ */
329
+ getOptionsExchangeCodes(): Promise<OptionsExchangeCodesResponse>;
330
+ /**
331
+ * Analyzes an array of option bars and returns a summary string
332
+ * @param bars Array of option bars to analyze
333
+ * @returns A string summarizing the option price data
334
+ */
335
+ static analyzeOptionBars(bars: OptionBar[]): string;
336
+ /**
337
+ * Formats option greeks for display
338
+ * @param greeks Option greeks object
339
+ * @returns Formatted string with greek values
340
+ */
341
+ static formatOptionGreeks(greeks: any): string;
342
+ /**
343
+ * Interprets condition codes using the provided condition codes mapping
344
+ * @param conditionCodes Array of condition codes from trade or quote
345
+ * @param conditionCodesMap Mapping of condition codes to descriptions
346
+ * @returns Formatted string with condition descriptions
347
+ */
348
+ static interpretConditionCodes(conditionCodes: string[], conditionCodesMap: OptionsConditionCodesResponse): string;
349
+ /**
350
+ * Gets the exchange name from exchange code using the provided exchange codes mapping
351
+ * @param exchangeCode Exchange code from trade or quote
352
+ * @param exchangeCodesMap Mapping of exchange codes to names
353
+ * @returns Exchange name or formatted unknown exchange
354
+ */
355
+ static getExchangeName(exchangeCode: string, exchangeCodesMap: OptionsExchangeCodesResponse): string;
356
+ /**
357
+ * Fetches news articles from Alpaca API for a symbol, paginating through all results.
358
+ * @param symbol The symbol to fetch news for (e.g., 'AAPL')
359
+ * @param params Optional parameters: start, end, limit, sort, include_content
360
+ * @returns Array of SimpleNews articles
361
+ */
362
+ fetchNews(symbol: string, params?: {
363
+ start?: Date | string;
364
+ end?: Date | string;
365
+ limit?: number;
366
+ sort?: 'asc' | 'desc';
367
+ include_content?: boolean;
368
+ }): Promise<SimpleNews[]>;
369
+ }
370
+ export declare const marketDataAPI: AlpacaMarketDataAPI;
371
+ //# sourceMappingURL=alpaca-market-data-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpaca-market-data-api.d.ts","sourceRoot":"","sources":["../../src/alpaca-market-data-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,WAAW,EACX,SAAS,EAET,WAAW,EACX,SAAS,EAET,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,6BAA6B,EAC7B,+BAA+B,EAC/B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,4BAA4B,EAC5B,cAAc,EACd,UAAU,EAEV,QAAQ,EAGR,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAYtC;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,sB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