@adaptic/utils 0.1.44 → 0.1.46
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.
- package/dist/index.cjs +4558 -59031
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4554 -58772
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +218 -563
- package/dist/test.js.map +1 -1
- package/dist/types/adaptic.d.ts.map +1 -1
- package/dist/types/alpaca-functions.d.ts +233 -0
- package/dist/types/alpaca-functions.d.ts.map +1 -0
- package/dist/types/alpaca-market-data-api.d.ts +10 -12
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
- package/dist/types/alpaca-trading-api.d.ts +2 -2
- package/dist/types/alpaca-trading-api.d.ts.map +1 -1
- package/dist/types/alphavantage.d.ts.map +1 -1
- package/dist/types/asset-allocation-algorithm.d.ts +0 -6
- package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
- package/dist/types/crypto.d.ts +2 -2
- package/dist/types/crypto.d.ts.map +1 -1
- package/dist/types/examples/asset-allocation-example.d.ts +6 -7
- package/dist/types/examples/asset-allocation-example.d.ts.map +1 -1
- package/dist/types/index.d.ts +37 -373
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/market-hours.d.ts.map +1 -1
- package/dist/types/market-time.d.ts +11 -73
- package/dist/types/market-time.d.ts.map +1 -1
- package/dist/types/metrics-calcs.d.ts.map +1 -1
- package/dist/types/misc-utils.d.ts +0 -3
- package/dist/types/misc-utils.d.ts.map +1 -1
- package/dist/types/performance-metrics.d.ts +5 -5
- package/dist/types/performance-metrics.d.ts.map +1 -1
- package/dist/types/polygon-indices.d.ts +2 -2
- package/dist/types/polygon-indices.d.ts.map +1 -1
- package/dist/types/polygon.d.ts.map +1 -1
- package/dist/types/price-utils.d.ts.map +1 -1
- package/dist/types/technical-analysis.d.ts.map +1 -1
- package/dist/types/trading-policy/defaults.d.ts +46 -0
- package/dist/types/trading-policy/defaults.d.ts.map +1 -0
- package/dist/types/trading-policy/index.d.ts +8 -0
- package/dist/types/trading-policy/index.d.ts.map +1 -0
- package/dist/types/types/adaptic-types.d.ts +1 -1
- package/dist/types/types/adaptic-types.d.ts.map +1 -1
- package/dist/types/types/alpaca-types.d.ts +17 -91
- package/dist/types/types/alpaca-types.d.ts.map +1 -1
- package/dist/types/types/logging-types.d.ts +1 -1
- package/dist/types/types/logging-types.d.ts.map +1 -1
- package/dist/types/types/metrics-types.d.ts +1 -1
- package/dist/types/types/metrics-types.d.ts.map +1 -1
- package/package.json +10 -25
- package/dist/types/__tests__/alpaca-functions.test.d.ts +0 -2
- package/dist/types/__tests__/alpaca-functions.test.d.ts.map +0 -1
- package/dist/types/__tests__/api-endpoints.test.d.ts +0 -2
- package/dist/types/__tests__/api-endpoints.test.d.ts.map +0 -1
- package/dist/types/__tests__/asset-allocation.test.d.ts +0 -2
- package/dist/types/__tests__/asset-allocation.test.d.ts.map +0 -1
- package/dist/types/__tests__/auth-validator.test.d.ts +0 -2
- package/dist/types/__tests__/auth-validator.test.d.ts.map +0 -1
- package/dist/types/__tests__/cache.test.d.ts +0 -2
- package/dist/types/__tests__/cache.test.d.ts.map +0 -1
- package/dist/types/__tests__/errors.test.d.ts +0 -2
- package/dist/types/__tests__/errors.test.d.ts.map +0 -1
- package/dist/types/__tests__/format-tools.test.d.ts +0 -2
- package/dist/types/__tests__/format-tools.test.d.ts.map +0 -1
- package/dist/types/__tests__/http-keep-alive.test.d.ts +0 -2
- package/dist/types/__tests__/http-keep-alive.test.d.ts.map +0 -1
- package/dist/types/__tests__/http-timeout.test.d.ts +0 -2
- package/dist/types/__tests__/http-timeout.test.d.ts.map +0 -1
- package/dist/types/__tests__/logger.test.d.ts +0 -2
- package/dist/types/__tests__/logger.test.d.ts.map +0 -1
- package/dist/types/__tests__/market-time.test.d.ts +0 -2
- package/dist/types/__tests__/market-time.test.d.ts.map +0 -1
- package/dist/types/__tests__/misc-utils.test.d.ts +0 -2
- package/dist/types/__tests__/misc-utils.test.d.ts.map +0 -1
- package/dist/types/__tests__/paginator.test.d.ts +0 -2
- package/dist/types/__tests__/paginator.test.d.ts.map +0 -1
- package/dist/types/__tests__/performance-metrics.test.d.ts +0 -2
- package/dist/types/__tests__/performance-metrics.test.d.ts.map +0 -1
- package/dist/types/__tests__/polygon.test.d.ts +0 -2
- package/dist/types/__tests__/polygon.test.d.ts.map +0 -1
- package/dist/types/__tests__/property-based-financial.test.d.ts +0 -2
- package/dist/types/__tests__/property-based-financial.test.d.ts.map +0 -1
- package/dist/types/__tests__/rate-limiter.test.d.ts +0 -2
- package/dist/types/__tests__/rate-limiter.test.d.ts.map +0 -1
- package/dist/types/__tests__/schema-validation.test.d.ts +0 -2
- package/dist/types/__tests__/schema-validation.test.d.ts.map +0 -1
- package/dist/types/__tests__/technical-analysis.test.d.ts +0 -2
- package/dist/types/__tests__/technical-analysis.test.d.ts.map +0 -1
- package/dist/types/__tests__/time-utils.test.d.ts +0 -2
- package/dist/types/__tests__/time-utils.test.d.ts.map +0 -1
- package/dist/types/alpaca/client.d.ts +0 -95
- package/dist/types/alpaca/client.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/data.d.ts +0 -281
- package/dist/types/alpaca/crypto/data.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/index.d.ts +0 -75
- package/dist/types/alpaca/crypto/index.d.ts.map +0 -1
- package/dist/types/alpaca/crypto/orders.d.ts +0 -221
- package/dist/types/alpaca/crypto/orders.d.ts.map +0 -1
- package/dist/types/alpaca/index.d.ts +0 -205
- package/dist/types/alpaca/index.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/account.d.ts +0 -34
- package/dist/types/alpaca/legacy/account.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/assets.d.ts +0 -13
- package/dist/types/alpaca/legacy/assets.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/auth.d.ts +0 -18
- package/dist/types/alpaca/legacy/auth.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/index.d.ts +0 -15
- package/dist/types/alpaca/legacy/index.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/market-data.d.ts +0 -32
- package/dist/types/alpaca/legacy/market-data.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/orders.d.ts +0 -84
- package/dist/types/alpaca/legacy/orders.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/positions.d.ts +0 -66
- package/dist/types/alpaca/legacy/positions.d.ts.map +0 -1
- package/dist/types/alpaca/legacy/utils.d.ts +0 -18
- package/dist/types/alpaca/legacy/utils.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/bars.d.ts +0 -142
- package/dist/types/alpaca/market-data/bars.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/index.d.ts +0 -13
- package/dist/types/alpaca/market-data/index.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/news.d.ts +0 -87
- package/dist/types/alpaca/market-data/news.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/quotes.d.ts +0 -85
- package/dist/types/alpaca/market-data/quotes.d.ts.map +0 -1
- package/dist/types/alpaca/market-data/trades.d.ts +0 -98
- package/dist/types/alpaca/market-data/trades.d.ts.map +0 -1
- package/dist/types/alpaca/options/contracts.d.ts +0 -279
- package/dist/types/alpaca/options/contracts.d.ts.map +0 -1
- package/dist/types/alpaca/options/data.d.ts +0 -126
- package/dist/types/alpaca/options/data.d.ts.map +0 -1
- package/dist/types/alpaca/options/index.d.ts +0 -17
- package/dist/types/alpaca/options/index.d.ts.map +0 -1
- package/dist/types/alpaca/options/orders.d.ts +0 -366
- package/dist/types/alpaca/options/orders.d.ts.map +0 -1
- package/dist/types/alpaca/options/strategies.d.ts +0 -224
- package/dist/types/alpaca/options/strategies.d.ts.map +0 -1
- package/dist/types/alpaca/streams/base-stream.d.ts +0 -143
- package/dist/types/alpaca/streams/base-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/crypto-stream.d.ts +0 -173
- package/dist/types/alpaca/streams/crypto-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/index.d.ts +0 -54
- package/dist/types/alpaca/streams/index.d.ts.map +0 -1
- package/dist/types/alpaca/streams/option-stream.d.ts +0 -167
- package/dist/types/alpaca/streams/option-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/stock-stream.d.ts +0 -176
- package/dist/types/alpaca/streams/stock-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams/stream-manager.d.ts +0 -277
- package/dist/types/alpaca/streams/stream-manager.d.ts.map +0 -1
- package/dist/types/alpaca/streams/trading-stream.d.ts +0 -186
- package/dist/types/alpaca/streams/trading-stream.d.ts.map +0 -1
- package/dist/types/alpaca/streams.d.ts +0 -88
- package/dist/types/alpaca/streams.d.ts.map +0 -1
- package/dist/types/alpaca/test-imports.d.ts +0 -7
- package/dist/types/alpaca/test-imports.d.ts.map +0 -1
- package/dist/types/alpaca/trading/account.d.ts +0 -198
- package/dist/types/alpaca/trading/account.d.ts.map +0 -1
- package/dist/types/alpaca/trading/bracket-orders.d.ts +0 -162
- package/dist/types/alpaca/trading/bracket-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/clock.d.ts +0 -99
- package/dist/types/alpaca/trading/clock.d.ts.map +0 -1
- package/dist/types/alpaca/trading/index.d.ts +0 -15
- package/dist/types/alpaca/trading/index.d.ts.map +0 -1
- package/dist/types/alpaca/trading/oco-orders.d.ts +0 -203
- package/dist/types/alpaca/trading/oco-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/order-utils.d.ts +0 -404
- package/dist/types/alpaca/trading/order-utils.d.ts.map +0 -1
- package/dist/types/alpaca/trading/orders.d.ts +0 -199
- package/dist/types/alpaca/trading/orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/oto-orders.d.ts +0 -282
- package/dist/types/alpaca/trading/oto-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/positions.d.ts +0 -389
- package/dist/types/alpaca/trading/positions.d.ts.map +0 -1
- package/dist/types/alpaca/trading/smart-orders.d.ts +0 -301
- package/dist/types/alpaca/trading/smart-orders.d.ts.map +0 -1
- package/dist/types/alpaca/trading/trailing-stops.d.ts +0 -240
- package/dist/types/alpaca/trading/trailing-stops.d.ts.map +0 -1
- package/dist/types/config/api-endpoints.d.ts +0 -94
- package/dist/types/config/api-endpoints.d.ts.map +0 -1
- package/dist/types/errors/index.d.ts +0 -130
- package/dist/types/errors/index.d.ts.map +0 -1
- package/dist/types/examples/rate-limiter-example.d.ts +0 -7
- package/dist/types/examples/rate-limiter-example.d.ts.map +0 -1
- package/dist/types/http-timeout.d.ts +0 -37
- package/dist/types/http-timeout.d.ts.map +0 -1
- package/dist/types/logger.d.ts +0 -56
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/rate-limiter.d.ts +0 -171
- package/dist/types/rate-limiter.d.ts.map +0 -1
- package/dist/types/schemas/alpaca-schemas.d.ts +0 -779
- package/dist/types/schemas/alpaca-schemas.d.ts.map +0 -1
- package/dist/types/schemas/alphavantage-schemas.d.ts +0 -255
- package/dist/types/schemas/alphavantage-schemas.d.ts.map +0 -1
- package/dist/types/schemas/index.d.ts +0 -21
- package/dist/types/schemas/index.d.ts.map +0 -1
- package/dist/types/schemas/polygon-schemas.d.ts +0 -551
- package/dist/types/schemas/polygon-schemas.d.ts.map +0 -1
- package/dist/types/schemas/validate-response.d.ts +0 -88
- package/dist/types/schemas/validate-response.d.ts.map +0 -1
- package/dist/types/utils/auth-validator.d.ts +0 -32
- package/dist/types/utils/auth-validator.d.ts.map +0 -1
- package/dist/types/utils/http-keep-alive.d.ts +0 -110
- package/dist/types/utils/http-keep-alive.d.ts.map +0 -1
- package/dist/types/utils/paginator.d.ts +0 -154
- package/dist/types/utils/paginator.d.ts.map +0 -1
- package/dist/types/utils/retry.d.ts +0 -78
- package/dist/types/utils/retry.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptic.d.ts","sourceRoot":"","sources":["../../src/adaptic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adaptic.d.ts","sourceRoot":"","sources":["../../src/adaptic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,SAAS,CAAC;AAC/D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,aAAa,EAAE,CAAC;AAG9B,KAAK,gBAAgB,GAAG,GAAG,CAAC;AAQ5B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,aAAa,KAAG,IAgBvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,gBAAgB,CAWtE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,KACb,OAAO,CAAC,qBAAqB,CAgE/B,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.BrokerageAccount;
|
|
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.BrokerageAccount} account - The Alpaca account to retrieve the configuration for.
|
|
214
|
+
* @returns {Promise<AccountConfiguration>} The account configuration.
|
|
215
|
+
*/
|
|
216
|
+
export declare function getConfiguration(account: types.BrokerageAccount): 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.BrokerageAccount} 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.BrokerageAccount, 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
|
+
//# sourceMappingURL=alpaca-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpaca-functions.d.ts","sourceRoot":"","sources":["../../src/alpaca-functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EACL,oBAAoB,EACpB,cAAc,EAEd,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAwDjC;;;;;GAKG;AAGH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CA+BtB;AACD;;;;;GAKG;AAEH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,WAAW,EAAE,CAAC,CAwDxB;AAED;;;;GAIG;AAEH,wBAAsB,eAAe,CACnC,IAAI,EAAE,UAAU,GACf,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CA6B3C;AAED;;;;;;GAMG;AAEH,wBAAsB,QAAQ,CAC5B,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,OAAO,CAAC,oBAAoB,CAAC,CAgC/B;AAED;;;;GAIG;AAEH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,KAAK,CAAC,gBAAgB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CA4G/B;AAED;;;;;;GAMG;AAEH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,OAAO,EAAE,KAAK,CAAC,gBAAgB,EAC/B,aAAa,EAAE,oBAAoB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAyQ/B;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsCxD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,UAAU,EAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAoCtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Bar, AlpacaQuote, TimeFrame, AlpacaAsset, OptionBar,
|
|
2
|
-
import { EventEmitter } from
|
|
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, CryptoStreamEventName, StockStreamEventMap, OptionStreamEventMap, CryptoStreamEventMap } from './types/alpaca-types';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for retrieving historical market data bars
|
|
5
5
|
* @see https://data.alpaca.markets/v2/stocks/bars
|
|
@@ -40,7 +40,7 @@ export interface HistoricalBarsParams {
|
|
|
40
40
|
* - asc: Oldest to newest (default)
|
|
41
41
|
* - desc: Newest to oldest
|
|
42
42
|
*/
|
|
43
|
-
sort?:
|
|
43
|
+
sort?: 'asc' | 'desc';
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Response from historical bars endpoint
|
|
@@ -115,8 +115,6 @@ export declare class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
115
115
|
private dataURL;
|
|
116
116
|
private apiURL;
|
|
117
117
|
private v1beta1url;
|
|
118
|
-
/** Whether API credentials are valid and available. False during build time when env vars are missing. */
|
|
119
|
-
private credentialsValid;
|
|
120
118
|
private stockStreamUrl;
|
|
121
119
|
private optionStreamUrl;
|
|
122
120
|
private cryptoStreamUrl;
|
|
@@ -126,8 +124,8 @@ export declare class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
126
124
|
private stockSubscriptions;
|
|
127
125
|
private optionSubscriptions;
|
|
128
126
|
private cryptoSubscriptions;
|
|
129
|
-
setMode(mode?:
|
|
130
|
-
getMode():
|
|
127
|
+
setMode(mode?: 'sandbox' | 'test' | 'production'): void;
|
|
128
|
+
getMode(): 'sandbox' | 'test' | 'production';
|
|
131
129
|
private constructor();
|
|
132
130
|
static getInstance(): AlpacaMarketDataAPI;
|
|
133
131
|
on<K extends StockStreamEventName>(event: K, listener: (data: StockStreamEventMap[K]) => void): this;
|
|
@@ -149,13 +147,13 @@ export declare class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
149
147
|
* @param streamType - The type of stream to check
|
|
150
148
|
* @returns True if the stream is connected
|
|
151
149
|
*/
|
|
152
|
-
isStreamConnected(streamType:
|
|
153
|
-
subscribe(streamType:
|
|
150
|
+
isStreamConnected(streamType: 'stock' | 'option' | 'crypto'): boolean;
|
|
151
|
+
subscribe(streamType: 'stock' | 'option' | 'crypto', subscriptions: {
|
|
154
152
|
trades?: string[];
|
|
155
153
|
quotes?: string[];
|
|
156
154
|
bars?: string[];
|
|
157
155
|
}): void;
|
|
158
|
-
unsubscribe(streamType:
|
|
156
|
+
unsubscribe(streamType: 'stock' | 'option' | 'crypto', subscriptions: {
|
|
159
157
|
trades?: string[];
|
|
160
158
|
quotes?: string[];
|
|
161
159
|
bars?: string[];
|
|
@@ -353,7 +351,7 @@ export declare class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
353
351
|
* @param greeks Option greeks object
|
|
354
352
|
* @returns Formatted string with greek values
|
|
355
353
|
*/
|
|
356
|
-
static formatOptionGreeks(greeks:
|
|
354
|
+
static formatOptionGreeks(greeks: any): string;
|
|
357
355
|
/**
|
|
358
356
|
* Interprets condition codes using the provided condition codes mapping
|
|
359
357
|
* @param conditionCodes Array of condition codes from trade or quote
|
|
@@ -378,7 +376,7 @@ export declare class AlpacaMarketDataAPI extends EventEmitter {
|
|
|
378
376
|
start?: Date | string;
|
|
379
377
|
end?: Date | string;
|
|
380
378
|
limit?: number;
|
|
381
|
-
sort?:
|
|
379
|
+
sort?: 'asc' | 'desc';
|
|
382
380
|
include_content?: boolean;
|
|
383
381
|
}): Promise<SimpleNews[]>;
|
|
384
382
|
}
|
|
@@ -1 +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,
|
|
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,6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AO,CAAC,wBAAwB,CAAC;IAM3F;;;;;;;OAOG;IACG,wBAAwB,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAIhG;;;;;;OAMG;IACG,uBAAuB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAItE;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM;IA0BnD;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM;IAe9C;;;;;OAKG;IACH,MAAM,CAAC,uBAAuB,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,6BAA6B,GAAG,MAAM;IAYlH;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,4BAA4B,GAAG,MAAM;IAIpG;;;;;OAKG;IACG,SAAS,CACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QACtB,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GACA,OAAO,CAAC,UAAU,EAAE,CAAC;CAwEzB;AAGD,eAAO,MAAM,aAAa,qBAAoC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlpacaAccountDetails, AlpacaCredentials, AlpacaPosition, AssetClass, GetOptionContractsParams, GetOrdersParams, OptionAccountActivity, OptionContract, OptionContractsResponse, AlpacaOrder, OrderLeg, TradeUpdate
|
|
1
|
+
import { AlpacaAccountDetails, AlpacaCredentials, AlpacaPosition, AssetClass, GetOptionContractsParams, GetOrdersParams, OptionAccountActivity, OptionContract, OptionContractsResponse, AlpacaOrder, OrderLeg, TradeUpdate } from "./types/alpaca-types";
|
|
2
2
|
/**
|
|
3
3
|
Websocket example
|
|
4
4
|
const alpacaAPI = createAlpacaTradingAPI(credentials); // type AlpacaCredentials
|
|
@@ -190,7 +190,7 @@ export declare class AlpacaTradingAPI {
|
|
|
190
190
|
* @param symbolOrContractId The symbol or ID of the option contract to exercise
|
|
191
191
|
* @returns Response from the exercise request
|
|
192
192
|
*/
|
|
193
|
-
exerciseOption(symbolOrContractId: string): Promise<
|
|
193
|
+
exerciseOption(symbolOrContractId: string): Promise<any>;
|
|
194
194
|
/**
|
|
195
195
|
* Get option positions
|
|
196
196
|
* @returns Array of option positions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpaca-trading-api.d.ts","sourceRoot":"","sources":["../../src/alpaca-trading-api.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACR,WAAW,
|
|
1
|
+
{"version":3,"file":"alpaca-trading-api.d.ts","sourceRoot":"","sources":["../../src/alpaca-trading-api.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACR,WAAW,EAGZ,MAAM,sBAAsB,CAAC;AAK9B;;;;;;;EAOE;AAEF,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,iBAAiB,GAAG,gBAAgB;IAI5D,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,iBAAiB,GAAG,gBAAgB;IAIpE,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,mBAA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IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB1C;;;;OAIG;IACG,uBAAuB,CAAC,YAAY,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkD1E;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC;IAkCvB;;;;;OAKG;IACG,mBAAmB,CACvB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,EACD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GACA,OAAO,CAAC,WAAW,CAAC;CA4LxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alphavantage.d.ts","sourceRoot":"","sources":["../../src/alphavantage.ts"],"names":[],"mappings":"AAAA;;oFAEoF;AAEpF,OAAO,EACL,yBAAyB,EAEzB,aAAa,EACd,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"alphavantage.d.ts","sourceRoot":"","sources":["../../src/alphavantage.ts"],"names":[],"mappings":"AAAA;;oFAEoF;AAEpF,OAAO,EACL,yBAAyB,EAEzB,aAAa,EACd,MAAM,SAAS,CAAC;AAqBjB;;;;;;GAMG;AAEH,eAAO,MAAM,UAAU,GACrB,QAAQ,MAAM,EACd,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,yBAAyB,CAcnC,CAAC;AAEF;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAU7D;AAED;;;;GAIG;AAEH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CASrE;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,UAAS;IACP,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;CAM5C,KACA,OAAO,CAAC,aAAa,EAAE,CA+DzB,CAAC"}
|
|
@@ -29,12 +29,6 @@ export declare class AssetAllocationEngine {
|
|
|
29
29
|
*/
|
|
30
30
|
private readonly defaultRiskProfiles;
|
|
31
31
|
constructor(config?: AllocationStrategyConfig);
|
|
32
|
-
/**
|
|
33
|
-
* Get default risk profile characteristics
|
|
34
|
-
* @param profile - The risk profile to retrieve
|
|
35
|
-
* @returns The default risk profile characteristics or undefined if not found
|
|
36
|
-
*/
|
|
37
|
-
getDefaultRiskProfile(profile: RiskProfile): DefaultRiskProfile | undefined;
|
|
38
32
|
/**
|
|
39
33
|
* Generate optimal asset allocation recommendation
|
|
40
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-allocation-algorithm.d.ts","sourceRoot":"","sources":["../../src/asset-allocation-algorithm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,WAAW,EAEX,eAAe,EACf,wBAAwB,EAMxB,wBAAwB,EA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O,CAAC,oBAAoB;IAQ5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyD/B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAmFjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA2F3B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA0GhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA4ClC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyD7B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAgDnC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAOpC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAmBjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgExB;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAKjC;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,eAAe,EACtB,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GACzC,OAAO,CAAC,wBAAwB,CAAC,CAGnC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GACnB,kBAAkB,GAAG,SAAS,CAGhC"}
|
package/dist/types/crypto.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare function fetchBars(params: CryptoBarsParams): Promise<{
|
|
|
17
17
|
[symbol: string]: CryptoBar[];
|
|
18
18
|
}>;
|
|
19
19
|
type AlpacaAuth = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
APIKey: string;
|
|
21
|
+
APISecret: string;
|
|
22
22
|
type?: "PAPER" | "LIVE";
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;
|
|
1
|
+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4
4
|
* Demonstrates practical usage of the asset allocation engine
|
|
5
5
|
* with real-world scenarios and best practices.
|
|
6
6
|
*/
|
|
7
|
-
import { type AllocationRecommendation } from "../index";
|
|
8
7
|
/**
|
|
9
8
|
* Example 1: Basic Conservative Portfolio for Retirement
|
|
10
9
|
*/
|
|
11
|
-
export declare function conservativeRetirementPortfolio(): Promise<AllocationRecommendation>;
|
|
10
|
+
export declare function conservativeRetirementPortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
12
11
|
/**
|
|
13
12
|
* Example 2: Aggressive Growth Portfolio for Young Investor
|
|
14
13
|
*/
|
|
15
|
-
export declare function aggressiveGrowthPortfolio(): Promise<AllocationRecommendation>;
|
|
14
|
+
export declare function aggressiveGrowthPortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
16
15
|
/**
|
|
17
16
|
* Example 3: Rebalancing an Existing Portfolio
|
|
18
17
|
*/
|
|
19
|
-
export declare function rebalancePortfolio(): Promise<AllocationRecommendation>;
|
|
18
|
+
export declare function rebalancePortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
20
19
|
/**
|
|
21
20
|
* Example 4: Crisis Mode Allocation
|
|
22
21
|
*/
|
|
23
|
-
export declare function crisisModePortfolio(): Promise<AllocationRecommendation>;
|
|
22
|
+
export declare function crisisModePortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
24
23
|
/**
|
|
25
24
|
* Example 5: Risk Parity Portfolio
|
|
26
25
|
*/
|
|
27
|
-
export declare function riskParityPortfolio(): Promise<AllocationRecommendation>;
|
|
26
|
+
export declare function riskParityPortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
28
27
|
/**
|
|
29
28
|
* Example 6: Small Account Allocation
|
|
30
29
|
*/
|
|
31
|
-
export declare function smallAccountPortfolio(): Promise<AllocationRecommendation>;
|
|
30
|
+
export declare function smallAccountPortfolio(): Promise<import("../index").AllocationRecommendation>;
|
|
32
31
|
/**
|
|
33
32
|
* Run all examples
|
|
34
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-allocation-example.d.ts","sourceRoot":"","sources":["../../../src/examples/asset-allocation-example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"asset-allocation-example.d.ts","sourceRoot":"","sources":["../../../src/examples/asset-allocation-example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;GAEG;AACH,wBAAsB,+BAA+B,yDAyKpD;AAED;;GAEG;AACH,wBAAsB,yBAAyB,yDA6C9C;AAED;;GAEG;AACH,wBAAsB,kBAAkB,yDAiFvC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,yDAyDxC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,yDAmDxC;AAED;;GAEG;AACH,wBAAsB,qBAAqB,yDAyC1C;AAkLD;;GAEG;AACH,wBAAsB,cAAc,kBAOnC"}
|