@adaptic/utils 0.0.99
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/README.md +916 -0
- package/dist/index.cjs +71971 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +71677 -0
- package/dist/index.mjs.map +1 -0
- package/dist/test.js +7799 -0
- package/dist/test.js.map +1 -0
- package/dist/types/__tests__/alpaca-functions.test.d.ts +2 -0
- package/dist/types/__tests__/alpaca-functions.test.d.ts.map +1 -0
- package/dist/types/__tests__/api-endpoints.test.d.ts +2 -0
- package/dist/types/__tests__/api-endpoints.test.d.ts.map +1 -0
- package/dist/types/__tests__/asset-allocation.test.d.ts +2 -0
- package/dist/types/__tests__/asset-allocation.test.d.ts.map +1 -0
- package/dist/types/__tests__/auth-validator.test.d.ts +2 -0
- package/dist/types/__tests__/auth-validator.test.d.ts.map +1 -0
- package/dist/types/__tests__/cache.test.d.ts +2 -0
- package/dist/types/__tests__/cache.test.d.ts.map +1 -0
- package/dist/types/__tests__/errors.test.d.ts +2 -0
- package/dist/types/__tests__/errors.test.d.ts.map +1 -0
- package/dist/types/__tests__/financial-regression.test.d.ts +2 -0
- package/dist/types/__tests__/financial-regression.test.d.ts.map +1 -0
- package/dist/types/__tests__/format-tools.test.d.ts +2 -0
- package/dist/types/__tests__/format-tools.test.d.ts.map +1 -0
- package/dist/types/__tests__/http-keep-alive.test.d.ts +2 -0
- package/dist/types/__tests__/http-keep-alive.test.d.ts.map +1 -0
- package/dist/types/__tests__/http-timeout.test.d.ts +2 -0
- package/dist/types/__tests__/http-timeout.test.d.ts.map +1 -0
- package/dist/types/__tests__/logger.test.d.ts +2 -0
- package/dist/types/__tests__/logger.test.d.ts.map +1 -0
- package/dist/types/__tests__/market-time.test.d.ts +2 -0
- package/dist/types/__tests__/market-time.test.d.ts.map +1 -0
- package/dist/types/__tests__/misc-utils.test.d.ts +2 -0
- package/dist/types/__tests__/misc-utils.test.d.ts.map +1 -0
- package/dist/types/__tests__/paginator.test.d.ts +2 -0
- package/dist/types/__tests__/paginator.test.d.ts.map +1 -0
- package/dist/types/__tests__/performance-metrics.test.d.ts +2 -0
- package/dist/types/__tests__/performance-metrics.test.d.ts.map +1 -0
- package/dist/types/__tests__/polygon.test.d.ts +2 -0
- package/dist/types/__tests__/polygon.test.d.ts.map +1 -0
- package/dist/types/__tests__/price-utils.test.d.ts +2 -0
- package/dist/types/__tests__/price-utils.test.d.ts.map +1 -0
- package/dist/types/__tests__/property-based-financial.test.d.ts +2 -0
- package/dist/types/__tests__/property-based-financial.test.d.ts.map +1 -0
- package/dist/types/__tests__/rate-limiter.test.d.ts +2 -0
- package/dist/types/__tests__/rate-limiter.test.d.ts.map +1 -0
- package/dist/types/__tests__/schema-validation.test.d.ts +2 -0
- package/dist/types/__tests__/schema-validation.test.d.ts.map +1 -0
- package/dist/types/__tests__/technical-analysis.test.d.ts +2 -0
- package/dist/types/__tests__/technical-analysis.test.d.ts.map +1 -0
- package/dist/types/__tests__/time-utils.test.d.ts +2 -0
- package/dist/types/__tests__/time-utils.test.d.ts.map +1 -0
- package/dist/types/adaptic.d.ts +52 -0
- package/dist/types/adaptic.d.ts.map +1 -0
- package/dist/types/alpaca/client.d.ts +95 -0
- package/dist/types/alpaca/client.d.ts.map +1 -0
- package/dist/types/alpaca/crypto/data.d.ts +281 -0
- package/dist/types/alpaca/crypto/data.d.ts.map +1 -0
- package/dist/types/alpaca/crypto/index.d.ts +75 -0
- package/dist/types/alpaca/crypto/index.d.ts.map +1 -0
- package/dist/types/alpaca/crypto/orders.d.ts +221 -0
- package/dist/types/alpaca/crypto/orders.d.ts.map +1 -0
- package/dist/types/alpaca/index.d.ts +205 -0
- package/dist/types/alpaca/index.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/account.d.ts +34 -0
- package/dist/types/alpaca/legacy/account.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/assets.d.ts +13 -0
- package/dist/types/alpaca/legacy/assets.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/auth.d.ts +18 -0
- package/dist/types/alpaca/legacy/auth.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/index.d.ts +15 -0
- package/dist/types/alpaca/legacy/index.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/market-data.d.ts +32 -0
- package/dist/types/alpaca/legacy/market-data.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/orders.d.ts +84 -0
- package/dist/types/alpaca/legacy/orders.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/positions.d.ts +66 -0
- package/dist/types/alpaca/legacy/positions.d.ts.map +1 -0
- package/dist/types/alpaca/legacy/utils.d.ts +18 -0
- package/dist/types/alpaca/legacy/utils.d.ts.map +1 -0
- package/dist/types/alpaca/market-data/bars.d.ts +142 -0
- package/dist/types/alpaca/market-data/bars.d.ts.map +1 -0
- package/dist/types/alpaca/market-data/index.d.ts +13 -0
- package/dist/types/alpaca/market-data/index.d.ts.map +1 -0
- package/dist/types/alpaca/market-data/news.d.ts +87 -0
- package/dist/types/alpaca/market-data/news.d.ts.map +1 -0
- package/dist/types/alpaca/market-data/quotes.d.ts +85 -0
- package/dist/types/alpaca/market-data/quotes.d.ts.map +1 -0
- package/dist/types/alpaca/market-data/trades.d.ts +98 -0
- package/dist/types/alpaca/market-data/trades.d.ts.map +1 -0
- package/dist/types/alpaca/options/contracts.d.ts +279 -0
- package/dist/types/alpaca/options/contracts.d.ts.map +1 -0
- package/dist/types/alpaca/options/data.d.ts +126 -0
- package/dist/types/alpaca/options/data.d.ts.map +1 -0
- package/dist/types/alpaca/options/index.d.ts +17 -0
- package/dist/types/alpaca/options/index.d.ts.map +1 -0
- package/dist/types/alpaca/options/orders.d.ts +366 -0
- package/dist/types/alpaca/options/orders.d.ts.map +1 -0
- package/dist/types/alpaca/options/strategies.d.ts +224 -0
- package/dist/types/alpaca/options/strategies.d.ts.map +1 -0
- package/dist/types/alpaca/streams/base-stream.d.ts +143 -0
- package/dist/types/alpaca/streams/base-stream.d.ts.map +1 -0
- package/dist/types/alpaca/streams/crypto-stream.d.ts +173 -0
- package/dist/types/alpaca/streams/crypto-stream.d.ts.map +1 -0
- package/dist/types/alpaca/streams/index.d.ts +54 -0
- package/dist/types/alpaca/streams/index.d.ts.map +1 -0
- package/dist/types/alpaca/streams/option-stream.d.ts +167 -0
- package/dist/types/alpaca/streams/option-stream.d.ts.map +1 -0
- package/dist/types/alpaca/streams/stock-stream.d.ts +176 -0
- package/dist/types/alpaca/streams/stock-stream.d.ts.map +1 -0
- package/dist/types/alpaca/streams/stream-manager.d.ts +277 -0
- package/dist/types/alpaca/streams/stream-manager.d.ts.map +1 -0
- package/dist/types/alpaca/streams/trading-stream.d.ts +186 -0
- package/dist/types/alpaca/streams/trading-stream.d.ts.map +1 -0
- package/dist/types/alpaca/streams.d.ts +88 -0
- package/dist/types/alpaca/streams.d.ts.map +1 -0
- package/dist/types/alpaca/test-imports.d.ts +7 -0
- package/dist/types/alpaca/test-imports.d.ts.map +1 -0
- package/dist/types/alpaca/trading/account.d.ts +198 -0
- package/dist/types/alpaca/trading/account.d.ts.map +1 -0
- package/dist/types/alpaca/trading/bracket-orders.d.ts +162 -0
- package/dist/types/alpaca/trading/bracket-orders.d.ts.map +1 -0
- package/dist/types/alpaca/trading/clock.d.ts +99 -0
- package/dist/types/alpaca/trading/clock.d.ts.map +1 -0
- package/dist/types/alpaca/trading/index.d.ts +15 -0
- package/dist/types/alpaca/trading/index.d.ts.map +1 -0
- package/dist/types/alpaca/trading/oco-orders.d.ts +203 -0
- package/dist/types/alpaca/trading/oco-orders.d.ts.map +1 -0
- package/dist/types/alpaca/trading/order-utils.d.ts +404 -0
- package/dist/types/alpaca/trading/order-utils.d.ts.map +1 -0
- package/dist/types/alpaca/trading/orders.d.ts +199 -0
- package/dist/types/alpaca/trading/orders.d.ts.map +1 -0
- package/dist/types/alpaca/trading/oto-orders.d.ts +282 -0
- package/dist/types/alpaca/trading/oto-orders.d.ts.map +1 -0
- package/dist/types/alpaca/trading/positions.d.ts +389 -0
- package/dist/types/alpaca/trading/positions.d.ts.map +1 -0
- package/dist/types/alpaca/trading/smart-orders.d.ts +301 -0
- package/dist/types/alpaca/trading/smart-orders.d.ts.map +1 -0
- package/dist/types/alpaca/trading/trailing-stops.d.ts +240 -0
- package/dist/types/alpaca/trading/trailing-stops.d.ts.map +1 -0
- package/dist/types/alpaca-market-data-api.d.ts +386 -0
- package/dist/types/alpaca-market-data-api.d.ts.map +1 -0
- package/dist/types/alpaca-trading-api.d.ts +315 -0
- package/dist/types/alpaca-trading-api.d.ts.map +1 -0
- package/dist/types/alphavantage.d.ts +44 -0
- package/dist/types/alphavantage.d.ts.map +1 -0
- package/dist/types/asset-allocation-algorithm.d.ts +143 -0
- package/dist/types/asset-allocation-algorithm.d.ts.map +1 -0
- package/dist/types/cache/stampede-protected-cache.d.ts +565 -0
- package/dist/types/cache/stampede-protected-cache.d.ts.map +1 -0
- package/dist/types/config/api-endpoints.d.ts +94 -0
- package/dist/types/config/api-endpoints.d.ts.map +1 -0
- package/dist/types/crypto.d.ts +76 -0
- package/dist/types/crypto.d.ts.map +1 -0
- package/dist/types/display-manager.d.ts +24 -0
- package/dist/types/display-manager.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +130 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/examples/asset-allocation-example.d.ts +36 -0
- package/dist/types/examples/asset-allocation-example.d.ts.map +1 -0
- package/dist/types/examples/rate-limiter-example.d.ts +7 -0
- package/dist/types/examples/rate-limiter-example.d.ts.map +1 -0
- package/dist/types/format-tools.d.ts +54 -0
- package/dist/types/format-tools.d.ts.map +1 -0
- package/dist/types/http-timeout.d.ts +37 -0
- package/dist/types/http-timeout.d.ts.map +1 -0
- package/dist/types/index.d.ts +766 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logger.d.ts +56 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/logging.d.ts +12 -0
- package/dist/types/logging.d.ts.map +1 -0
- package/dist/types/market-hours.d.ts +24 -0
- package/dist/types/market-hours.d.ts.map +1 -0
- package/dist/types/market-time.d.ts +246 -0
- package/dist/types/market-time.d.ts.map +1 -0
- package/dist/types/metrics-calcs.d.ts +6 -0
- package/dist/types/metrics-calcs.d.ts.map +1 -0
- package/dist/types/misc-utils.d.ts +52 -0
- package/dist/types/misc-utils.d.ts.map +1 -0
- package/dist/types/performance-metrics.d.ts +88 -0
- package/dist/types/performance-metrics.d.ts.map +1 -0
- package/dist/types/polygon-indices.d.ts +85 -0
- package/dist/types/polygon-indices.d.ts.map +1 -0
- package/dist/types/polygon.d.ts +126 -0
- package/dist/types/polygon.d.ts.map +1 -0
- package/dist/types/price-utils.d.ts +26 -0
- package/dist/types/price-utils.d.ts.map +1 -0
- package/dist/types/rate-limiter.d.ts +171 -0
- package/dist/types/rate-limiter.d.ts.map +1 -0
- package/dist/types/schemas/alpaca-schemas.d.ts +779 -0
- package/dist/types/schemas/alpaca-schemas.d.ts.map +1 -0
- package/dist/types/schemas/alphavantage-schemas.d.ts +255 -0
- package/dist/types/schemas/alphavantage-schemas.d.ts.map +1 -0
- package/dist/types/schemas/index.d.ts +21 -0
- package/dist/types/schemas/index.d.ts.map +1 -0
- package/dist/types/schemas/polygon-schemas.d.ts +551 -0
- package/dist/types/schemas/polygon-schemas.d.ts.map +1 -0
- package/dist/types/schemas/validate-response.d.ts +88 -0
- package/dist/types/schemas/validate-response.d.ts.map +1 -0
- package/dist/types/technical-analysis.d.ts +90 -0
- package/dist/types/technical-analysis.d.ts.map +1 -0
- package/dist/types/test.d.ts +2 -0
- package/dist/types/test.d.ts.map +1 -0
- package/dist/types/testing/options-ws.d.ts +2 -0
- package/dist/types/testing/options-ws.d.ts.map +1 -0
- package/dist/types/time-utils.d.ts +17 -0
- package/dist/types/time-utils.d.ts.map +1 -0
- package/dist/types/types/adaptic-types.d.ts +11 -0
- package/dist/types/types/adaptic-types.d.ts.map +1 -0
- package/dist/types/types/alpaca-types.d.ts +1165 -0
- package/dist/types/types/alpaca-types.d.ts.map +1 -0
- package/dist/types/types/alphavantage-types.d.ts +66 -0
- package/dist/types/types/alphavantage-types.d.ts.map +1 -0
- package/dist/types/types/asset-allocation-types.d.ts +328 -0
- package/dist/types/types/asset-allocation-types.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +21 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/logging-types.d.ts +10 -0
- package/dist/types/types/logging-types.d.ts.map +1 -0
- package/dist/types/types/market-time-types.d.ts +59 -0
- package/dist/types/types/market-time-types.d.ts.map +1 -0
- package/dist/types/types/metrics-types.d.ts +33 -0
- package/dist/types/types/metrics-types.d.ts.map +1 -0
- package/dist/types/types/polygon-indices-types.d.ts +190 -0
- package/dist/types/types/polygon-indices-types.d.ts.map +1 -0
- package/dist/types/types/polygon-types.d.ts +204 -0
- package/dist/types/types/polygon-types.d.ts.map +1 -0
- package/dist/types/types/ta-types.d.ts +89 -0
- package/dist/types/types/ta-types.d.ts.map +1 -0
- package/dist/types/utils/auth-validator.d.ts +32 -0
- package/dist/types/utils/auth-validator.d.ts.map +1 -0
- package/dist/types/utils/http-keep-alive.d.ts +110 -0
- package/dist/types/utils/http-keep-alive.d.ts.map +1 -0
- package/dist/types/utils/paginator.d.ts +154 -0
- package/dist/types/utils/paginator.d.ts.map +1 -0
- package/dist/types/utils/retry.d.ts +78 -0
- package/dist/types/utils/retry.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import * as Alpaca from "./alpaca/legacy";
|
|
2
|
+
import * as pm from "./performance-metrics";
|
|
3
|
+
import * as tu from "./time-utils";
|
|
4
|
+
import * as mt from "./market-time";
|
|
5
|
+
import fetchTradeMetrics from "./metrics-calcs";
|
|
6
|
+
import * as pu from "./price-utils";
|
|
7
|
+
import * as ft from "./format-tools";
|
|
8
|
+
import * as Types from "./types";
|
|
9
|
+
import * as misc from "./misc-utils";
|
|
10
|
+
import * as polygon from "./polygon";
|
|
11
|
+
import * as av from "./alphavantage";
|
|
12
|
+
import * as backend from "./adaptic";
|
|
13
|
+
import * as crypto from "./crypto";
|
|
14
|
+
import * as ta from "./technical-analysis";
|
|
15
|
+
import { TokenBucketRateLimiter } from "./rate-limiter";
|
|
16
|
+
export { type Logger, setLogger, getLogger, resetLogger } from "./logger";
|
|
17
|
+
export { AdapticUtilsError, AlpacaApiError, PolygonApiError, AlphaVantageError, TimeoutError, ValidationError, AuthenticationError, HttpClientError, HttpServerError, RateLimitError, WebSocketError, NetworkError, DataFormatError, } from "./errors";
|
|
18
|
+
export { validateAlpacaCredentials, validatePolygonApiKey, validateAlphaVantageApiKey, } from "./utils/auth-validator";
|
|
19
|
+
export { TRADING_API, MARKET_DATA_API, WEBSOCKET_STREAMS, getTradingApiUrl, getTradingWebSocketUrl, getStockStreamUrl, getOptionsStreamUrl, getCryptoStreamUrl, type AccountType, } from "./config/api-endpoints";
|
|
20
|
+
export { StampedeProtectedCache, createStampedeProtectedCache, DEFAULT_CACHE_OPTIONS, type StampedeProtectedCacheOptions, type CacheEntry, type CacheStats, type CacheLoader, } from "./cache/stampede-protected-cache";
|
|
21
|
+
export { TokenBucketRateLimiter, rateLimiters, type RateLimiterConfig, } from "./rate-limiter";
|
|
22
|
+
export { withRetry, API_RETRY_CONFIGS, type RetryConfig } from "./utils/retry";
|
|
23
|
+
export { DEFAULT_TIMEOUTS, withTimeout, createTimeoutSignal, getTimeout, } from "./http-timeout";
|
|
24
|
+
export { AssetAllocationEngine, generateOptimalAllocation, getDefaultRiskProfile, } from "./asset-allocation-algorithm";
|
|
25
|
+
export * from "./types/asset-allocation-types";
|
|
26
|
+
export { validateResponse, safeValidateResponse, ValidationResponseError, type ValidationResult, type ValidateResponseOptions, AlpacaAccountDetailsSchema, AlpacaPositionSchema, AlpacaPositionsArraySchema, AlpacaOrderSchema, AlpacaOrdersArraySchema, AlpacaBarSchema, AlpacaHistoricalBarsResponseSchema, AlpacaLatestBarsResponseSchema, AlpacaQuoteSchema, AlpacaLatestQuotesResponseSchema, AlpacaTradeSchema, AlpacaLatestTradesResponseSchema, AlpacaNewsArticleSchema, AlpacaNewsResponseSchema, AlpacaPortfolioHistoryResponseSchema, AlpacaCryptoBarsResponseSchema, RawPolygonPriceDataSchema, PolygonTickerInfoSchema, PolygonTickerDetailsResponseSchema, PolygonGroupedDailyResponseSchema, PolygonDailyOpenCloseSchema, PolygonTradeSchema as PolygonTradeZodSchema, PolygonTradesResponseSchema, PolygonLastTradeResponseSchema, PolygonAggregatesResponseSchema, PolygonErrorResponseSchema, AlphaVantageQuoteResponseSchema, AVNewsArticleSchema, AVNewsResponseSchema, } from "./schemas";
|
|
27
|
+
export { paginate, paginateAll, type CursorPaginationConfig, type UrlPaginationConfig, type OffsetPaginationConfig, type PaginationConfig, } from "./utils/paginator";
|
|
28
|
+
export { KEEP_ALIVE_DEFAULTS, httpAgent, httpsAgent, getAgentPoolStatus, verifyFetchKeepAlive, type ConnectionPoolStatus, } from "./utils/http-keep-alive";
|
|
29
|
+
export * from "./types";
|
|
30
|
+
export { AlpacaTradingAPI } from "./alpaca-trading-api";
|
|
31
|
+
export { AlpacaMarketDataAPI } from "./alpaca-market-data-api";
|
|
32
|
+
export declare const createAlpacaTradingAPI: (credentials: Types.AlpacaCredentials) => Types.AlpacaTradingAPI;
|
|
33
|
+
export declare const createAlpacaMarketDataAPI: () => Types.AlpacaMarketDataAPI;
|
|
34
|
+
export * from "./alpaca";
|
|
35
|
+
export type { TokenProvider } from "./adaptic";
|
|
36
|
+
export declare const adaptic: {
|
|
37
|
+
types: typeof Types;
|
|
38
|
+
backend: {
|
|
39
|
+
fetchAssetOverview: (symbol: string) => Promise<Types.AssetOverviewResponse>;
|
|
40
|
+
getApolloClient: () => Promise<any>;
|
|
41
|
+
configureAuth: (provider: backend.TokenProvider) => void;
|
|
42
|
+
isAuthConfigured: () => boolean;
|
|
43
|
+
};
|
|
44
|
+
alpaca: {
|
|
45
|
+
createClient: typeof import("./alpaca").createAlpacaClient;
|
|
46
|
+
createClientFromEnv: typeof import("./alpaca").createClientFromEnv;
|
|
47
|
+
clearClientCache: typeof import("./alpaca").clearClientCache;
|
|
48
|
+
/** @description Smart orders: brackets, OCO, OTO, trailing stops */
|
|
49
|
+
smartOrders: {
|
|
50
|
+
bracket: typeof import("./alpaca/trading/bracket-orders");
|
|
51
|
+
oco: typeof import("./alpaca/trading/oco-orders");
|
|
52
|
+
oto: typeof import("./alpaca/trading/oto-orders");
|
|
53
|
+
trailingStops: typeof import("./alpaca/trading/trailing-stops");
|
|
54
|
+
determineOrderType(params: import("./alpaca/trading/smart-orders").SmartOrderParams): import("./alpaca/trading/smart-orders").SmartOrderType;
|
|
55
|
+
createSmartOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").SmartOrderParams): Promise<import("./alpaca/trading/smart-orders").SmartOrderResult>;
|
|
56
|
+
createPercentageBracket(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").PercentageBracketParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
57
|
+
createRiskManagedPosition(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").RiskManagedPositionParams): Promise<import("./alpaca").BracketOrderResult | import("./alpaca").OTOOrderResult>;
|
|
58
|
+
calculateRewardRiskRatio(entryPrice: number, takeProfitPrice: number, stopLossPrice: number, side: Types.OrderSide): number;
|
|
59
|
+
calculatePositionSize(accountValue: number, riskPercent: number, entryPrice: number, stopPrice: number): number;
|
|
60
|
+
default: {
|
|
61
|
+
createSmartOrder: typeof import("./alpaca/trading/smart-orders").createSmartOrder;
|
|
62
|
+
determineOrderType: typeof import("./alpaca/trading/smart-orders").determineOrderType;
|
|
63
|
+
createPercentageBracket: typeof import("./alpaca/trading/smart-orders").createPercentageBracket;
|
|
64
|
+
createRiskManagedPosition: typeof import("./alpaca/trading/smart-orders").createRiskManagedPosition;
|
|
65
|
+
calculateRewardRiskRatio: typeof import("./alpaca/trading/smart-orders").calculateRewardRiskRatio;
|
|
66
|
+
calculatePositionSize: typeof import("./alpaca/trading/smart-orders").calculatePositionSize;
|
|
67
|
+
createBracketOrder: typeof import("./alpaca").createBracketOrder;
|
|
68
|
+
createProtectiveBracket: typeof import("./alpaca").createProtectiveBracket;
|
|
69
|
+
createExecutorFromTradingAPI: typeof import("./alpaca").createExecutorFromTradingAPI;
|
|
70
|
+
createOCOOrder: typeof import("./alpaca").createOCOOrder;
|
|
71
|
+
createOTOOrder: typeof import("./alpaca").createOTOOrder;
|
|
72
|
+
createTrailingStop: typeof import("./alpaca").createTrailingStop;
|
|
73
|
+
updateTrailingStop: typeof import("./alpaca").updateTrailingStop;
|
|
74
|
+
};
|
|
75
|
+
createBracketOrder(executor: import("./alpaca").BracketOrderExecutor, params: import("./alpaca").BracketOrderParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
76
|
+
createProtectiveBracket(executor: import("./alpaca").BracketOrderExecutor, params: import("./alpaca").ProtectiveBracketParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
77
|
+
createExecutorFromTradingAPI(api: {
|
|
78
|
+
makeRequest: (endpoint: string, method: string, body?: unknown) => Promise<Types.AlpacaOrder>;
|
|
79
|
+
}): import("./alpaca").BracketOrderExecutor;
|
|
80
|
+
createOCOOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca").OCOOrderParams): Promise<import("./alpaca").OCOOrderResult>;
|
|
81
|
+
cancelOCOOrder(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<void>;
|
|
82
|
+
getOCOOrderStatus(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<Types.AlpacaOrder>;
|
|
83
|
+
protectLongPosition(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OCOOrderResult>;
|
|
84
|
+
protectShortPosition(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OCOOrderResult>;
|
|
85
|
+
createOTOOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca").OTOOrderParams): Promise<import("./alpaca").OTOOrderResult>;
|
|
86
|
+
cancelOTOOrder(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<void>;
|
|
87
|
+
getOTOOrderStatus(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<Types.AlpacaOrder>;
|
|
88
|
+
buyWithStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
89
|
+
buyWithTrailingStop(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, trailPercent: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
90
|
+
limitBuyWithTakeProfit(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number, takeProfitPrice: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
91
|
+
shortWithStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number, stopLossPrice: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
92
|
+
entryWithPercentStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number | null, stopLossPercent: number, side?: Types.OrderSide): Promise<import("./alpaca").OTOOrderResult>;
|
|
93
|
+
createTrailingStop(client: import("./alpaca").AlpacaClient, params: import("./alpaca").TrailingStopParams): Promise<Types.AlpacaOrder>;
|
|
94
|
+
updateTrailingStop(client: import("./alpaca").AlpacaClient, orderId: string, updates: {
|
|
95
|
+
trailPercent?: number;
|
|
96
|
+
trailPrice?: number;
|
|
97
|
+
}): Promise<Types.AlpacaOrder>;
|
|
98
|
+
getTrailingStopHWM(client: import("./alpaca").AlpacaClient, orderId: string): Promise<import("./alpaca").TrailingStopHWMResult>;
|
|
99
|
+
cancelTrailingStop(client: import("./alpaca").AlpacaClient, orderId: string): Promise<void>;
|
|
100
|
+
createPortfolioTrailingStops(client: import("./alpaca").AlpacaClient, params: import("./alpaca").PortfolioTrailingStopParams): Promise<Map<string, Types.AlpacaOrder>>;
|
|
101
|
+
getOpenTrailingStops(client: import("./alpaca").AlpacaClient, symbol?: string): Promise<Types.AlpacaOrder[]>;
|
|
102
|
+
hasActiveTrailingStop(client: import("./alpaca").AlpacaClient, symbol: string): Promise<boolean>;
|
|
103
|
+
cancelTrailingStopsForSymbol(client: import("./alpaca").AlpacaClient, symbol: string): Promise<number>;
|
|
104
|
+
TrailingStopValidationError: typeof import("./alpaca").TrailingStopValidationError;
|
|
105
|
+
};
|
|
106
|
+
/** @description Standard order operations - SDK-based (requires AlpacaClient) */
|
|
107
|
+
sdkOrders: {
|
|
108
|
+
getOrdersBySymbol(client: import("./alpaca").AlpacaClient, symbol: string, params?: Omit<Types.GetOrdersParams, "symbols">): Promise<Types.AlpacaOrder[]>;
|
|
109
|
+
getOpenOrders(client: import("./alpaca").AlpacaClient, params?: Omit<Types.GetOrdersParams, "status">): Promise<Types.AlpacaOrder[]>;
|
|
110
|
+
getFilledOrders(client: import("./alpaca").AlpacaClient, params: import("./alpaca").GetFilledOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
111
|
+
getOrderHistory(client: import("./alpaca").AlpacaClient, params?: import("./alpaca").GetOrderHistoryParams): Promise<import("./alpaca").OrderHistoryResult>;
|
|
112
|
+
getAllOrders(client: import("./alpaca").AlpacaClient, params?: import("./alpaca").GetAllOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
113
|
+
waitForOrderFill(client: import("./alpaca").AlpacaClient, params: import("./alpaca").WaitForOrderFillParams): Promise<import("./alpaca").WaitForOrderFillResult>;
|
|
114
|
+
isOrderFillable(order: Types.AlpacaOrder): boolean;
|
|
115
|
+
isOrderFilled(order: Types.AlpacaOrder): boolean;
|
|
116
|
+
isOrderTerminal(order: Types.AlpacaOrder): boolean;
|
|
117
|
+
isOrderOpen(order: Types.AlpacaOrder): boolean;
|
|
118
|
+
calculateOrderValue(order: Types.AlpacaOrder): number | null;
|
|
119
|
+
formatOrderSummary(order: Types.AlpacaOrder): import("./alpaca").OrderSummary;
|
|
120
|
+
formatOrderForLog(order: Types.AlpacaOrder): string;
|
|
121
|
+
roundPriceForAlpaca(price: number): string;
|
|
122
|
+
roundPriceForAlpacaNumber(price: number): number;
|
|
123
|
+
groupOrdersBySymbol(orders: Types.AlpacaOrder[]): Map<string, Types.AlpacaOrder[]>;
|
|
124
|
+
groupOrdersByStatus(orders: Types.AlpacaOrder[]): Map<string, Types.AlpacaOrder[]>;
|
|
125
|
+
calculateTotalFilledValue(orders: Types.AlpacaOrder[]): number;
|
|
126
|
+
filterOrdersByDateRange(orders: Types.AlpacaOrder[], startDate: Date, endDate: Date): Types.AlpacaOrder[];
|
|
127
|
+
sortOrdersByDate(orders: Types.AlpacaOrder[], direction?: "asc" | "desc"): Types.AlpacaOrder[];
|
|
128
|
+
default: {
|
|
129
|
+
getOrdersBySymbol: typeof import("./alpaca").getOrdersBySymbol;
|
|
130
|
+
getOpenOrders: typeof import("./alpaca").getOpenOrdersQuery;
|
|
131
|
+
getFilledOrders: typeof import("./alpaca").getFilledOrders;
|
|
132
|
+
getOrderHistory: typeof import("./alpaca").getOrderHistory;
|
|
133
|
+
getAllOrders: typeof import("./alpaca").getAllOrders;
|
|
134
|
+
waitForOrderFill: typeof import("./alpaca").waitForOrderFill;
|
|
135
|
+
isOrderFillable: typeof import("./alpaca").isOrderFillable;
|
|
136
|
+
isOrderFilled: typeof import("./alpaca").isOrderFilled;
|
|
137
|
+
isOrderTerminal: typeof import("./alpaca").isOrderTerminalStatus;
|
|
138
|
+
isOrderOpen: typeof import("./alpaca").isOrderOpen;
|
|
139
|
+
calculateOrderValue: typeof import("./alpaca").calculateOrderValue;
|
|
140
|
+
calculateTotalFilledValue: typeof import("./alpaca").calculateTotalFilledValue;
|
|
141
|
+
formatOrderSummary: typeof import("./alpaca").formatOrderSummary;
|
|
142
|
+
formatOrderForLog: typeof import("./alpaca").formatOrderForLog;
|
|
143
|
+
roundPriceForAlpaca: typeof import("./alpaca").roundPriceForAlpaca;
|
|
144
|
+
roundPriceForAlpacaNumber: typeof import("./alpaca").roundPriceForAlpacaNumber;
|
|
145
|
+
groupOrdersBySymbol: typeof import("./alpaca").groupOrdersBySymbol;
|
|
146
|
+
groupOrdersByStatus: typeof import("./alpaca").groupOrdersByStatus;
|
|
147
|
+
filterOrdersByDateRange: typeof import("./alpaca").filterOrdersByDateRange;
|
|
148
|
+
sortOrdersByDate: typeof import("./alpaca").sortOrdersByDate;
|
|
149
|
+
};
|
|
150
|
+
createOrder(client: import("./alpaca").AlpacaClient, params: Types.CreateOrderParams): Promise<Types.AlpacaOrder>;
|
|
151
|
+
getOrder(client: import("./alpaca").AlpacaClient, orderId: string): Promise<Types.AlpacaOrder>;
|
|
152
|
+
getOrders(client: import("./alpaca").AlpacaClient, params?: Types.GetOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
153
|
+
cancelOrder(client: import("./alpaca").AlpacaClient, orderId: string): Promise<void>;
|
|
154
|
+
cancelAllOrders(client: import("./alpaca").AlpacaClient): Promise<import("./alpaca/trading/orders").CancelAllOrdersResponse>;
|
|
155
|
+
replaceOrder(client: import("./alpaca").AlpacaClient, orderId: string, params: Types.ReplaceOrderParams): Promise<Types.AlpacaOrder>;
|
|
156
|
+
isOrderCancelable(status: Types.OrderStatus): boolean;
|
|
157
|
+
getOrderByClientId(client: import("./alpaca").AlpacaClient, clientOrderId: string): Promise<Types.AlpacaOrder>;
|
|
158
|
+
};
|
|
159
|
+
/** @description Position management - SDK-based (requires AlpacaClient) */
|
|
160
|
+
sdkPositions: typeof import("./alpaca/trading/positions");
|
|
161
|
+
/** @description Account information and configuration - SDK-based (requires AlpacaClient) */
|
|
162
|
+
sdkAccount: typeof import("./alpaca/trading/account");
|
|
163
|
+
/** @description Market clock and trading calendar - SDK-based (requires AlpacaClient) */
|
|
164
|
+
sdkClock: typeof import("./alpaca/trading/clock");
|
|
165
|
+
/** @description Standard order operations - Legacy API (uses AlpacaAuth) */
|
|
166
|
+
orders: {
|
|
167
|
+
create: typeof Alpaca.createOrder;
|
|
168
|
+
createLimitOrder: typeof Alpaca.createLimitOrder;
|
|
169
|
+
get: typeof Alpaca.getOrder;
|
|
170
|
+
getAll: typeof Alpaca.getOrders;
|
|
171
|
+
replace: typeof Alpaca.replaceOrder;
|
|
172
|
+
cancel: typeof Alpaca.cancelOrder;
|
|
173
|
+
cancelAll: typeof Alpaca.cancelAllOrders;
|
|
174
|
+
};
|
|
175
|
+
/** @description Position management - Legacy API (uses AlpacaAuth) */
|
|
176
|
+
positions: {
|
|
177
|
+
fetch: typeof Alpaca.fetchPosition;
|
|
178
|
+
close: typeof Alpaca.closePosition;
|
|
179
|
+
fetchAll: typeof Alpaca.fetchAllPositions;
|
|
180
|
+
closeAll: typeof Alpaca.closeAllPositions;
|
|
181
|
+
closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
|
|
182
|
+
};
|
|
183
|
+
/** @description Account information - Legacy API (uses AlpacaAuth) */
|
|
184
|
+
account: typeof Alpaca.fetchAccountDetails;
|
|
185
|
+
/** @description Real-time and historical quotes */
|
|
186
|
+
quotes: typeof import("./alpaca/market-data/quotes");
|
|
187
|
+
/** @description Historical price bars (OHLCV) */
|
|
188
|
+
bars: typeof import("./alpaca/market-data/bars");
|
|
189
|
+
/** @description Trade data */
|
|
190
|
+
trades: typeof import("./alpaca/market-data/trades");
|
|
191
|
+
/** @description Market news */
|
|
192
|
+
news: typeof import("./alpaca/market-data/news");
|
|
193
|
+
/** @description Options trading and data */
|
|
194
|
+
options: {
|
|
195
|
+
contracts: typeof import("./alpaca/options/contracts");
|
|
196
|
+
orders: typeof import("./alpaca/options/orders");
|
|
197
|
+
strategies: typeof import("./alpaca/options/strategies");
|
|
198
|
+
data: typeof import("./alpaca/options/data");
|
|
199
|
+
};
|
|
200
|
+
/** @description Cryptocurrency trading and data */
|
|
201
|
+
crypto: {
|
|
202
|
+
orders: typeof import("./alpaca/crypto/orders");
|
|
203
|
+
data: typeof import("./alpaca/crypto/data");
|
|
204
|
+
};
|
|
205
|
+
/** @description Real-time WebSocket streams */
|
|
206
|
+
streams: typeof import("./alpaca/streams");
|
|
207
|
+
/** @deprecated Use positions module instead */
|
|
208
|
+
position: {
|
|
209
|
+
fetch: typeof Alpaca.fetchPosition;
|
|
210
|
+
close: typeof Alpaca.closePosition;
|
|
211
|
+
fetchAll: typeof Alpaca.fetchAllPositions;
|
|
212
|
+
closeAll: typeof Alpaca.closeAllPositions;
|
|
213
|
+
closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
|
|
214
|
+
};
|
|
215
|
+
/** @deprecated Use account() instead */
|
|
216
|
+
accountDetails: typeof Alpaca.fetchAccountDetails;
|
|
217
|
+
/** @deprecated Use sdkAccount.getPortfolioHistory() instead */
|
|
218
|
+
portfolioHistory: typeof Alpaca.fetchPortfolioHistory;
|
|
219
|
+
/** @deprecated Use sdkAccount.getAccountConfiguration() instead */
|
|
220
|
+
getConfig: typeof Alpaca.getConfiguration;
|
|
221
|
+
/** @deprecated Use sdkAccount.updateAccountConfiguration() instead */
|
|
222
|
+
updateConfig: typeof Alpaca.updateConfiguration;
|
|
223
|
+
/** @deprecated Use SDK asset functions instead */
|
|
224
|
+
asset: {
|
|
225
|
+
get: typeof Alpaca.getAsset;
|
|
226
|
+
};
|
|
227
|
+
/** @deprecated Use quotes module instead */
|
|
228
|
+
quote: {
|
|
229
|
+
getLatest: typeof Alpaca.getLatestQuotes;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
av: {
|
|
233
|
+
fetchQuote: (ticker: string, options?: {
|
|
234
|
+
apiKey?: string;
|
|
235
|
+
}) => Promise<Types.AlphaVantageQuoteResponse>;
|
|
236
|
+
fetchTickerNews: (ticker: string, options?: {
|
|
237
|
+
start?: Date;
|
|
238
|
+
end?: Date;
|
|
239
|
+
limit?: number;
|
|
240
|
+
apiKey?: string;
|
|
241
|
+
sort?: "LATEST" | "EARLIEST" | "RELEVANCE";
|
|
242
|
+
}) => Promise<Types.AVNewsArticle[]>;
|
|
243
|
+
convertDateToYYYYMMDDTHHMM: typeof av.convertDateToYYYYMMDDTHHMM;
|
|
244
|
+
convertYYYYMMDDTHHMMSSToDate: typeof av.convertYYYYMMDDTHHMMSSToDate;
|
|
245
|
+
};
|
|
246
|
+
crypto: {
|
|
247
|
+
fetchBars: typeof crypto.fetchBars;
|
|
248
|
+
fetchNews: typeof crypto.fetchNews;
|
|
249
|
+
fetchLatestTrades: typeof crypto.fetchLatestTrades;
|
|
250
|
+
fetchLatestQuotes: typeof crypto.fetchLatestQuotes;
|
|
251
|
+
};
|
|
252
|
+
format: {
|
|
253
|
+
capitalize: typeof ft.capitalize;
|
|
254
|
+
enum: typeof ft.formatEnum;
|
|
255
|
+
currency: typeof ft.formatCurrency;
|
|
256
|
+
number: typeof ft.formatNumber;
|
|
257
|
+
percentage: typeof ft.formatPercentage;
|
|
258
|
+
date: (dateString: string, updateDate?: boolean) => string;
|
|
259
|
+
dateToString: (date: Date) => string;
|
|
260
|
+
dateTimeForGS: typeof ft.dateTimeForGS;
|
|
261
|
+
};
|
|
262
|
+
metrics: {
|
|
263
|
+
trade: typeof fetchTradeMetrics;
|
|
264
|
+
alphaAndBeta: typeof pm.calculateAlphaAndBeta;
|
|
265
|
+
maxDrawdown: typeof pm.calculateMaxDrawdown;
|
|
266
|
+
dailyReturns: typeof pm.calculateDailyReturns;
|
|
267
|
+
returnsByDate: typeof pm.alignReturnsByDate;
|
|
268
|
+
beta: typeof pm.calculateBetaFromReturns;
|
|
269
|
+
infoRatio: typeof pm.calculateInformationRatio;
|
|
270
|
+
allpm: typeof pm.fetchPerformanceMetrics;
|
|
271
|
+
};
|
|
272
|
+
polygon: {
|
|
273
|
+
fetchTickerInfo: (symbol: string, options?: {
|
|
274
|
+
apiKey?: string;
|
|
275
|
+
}) => Promise<Types.PolygonTickerInfo | null>;
|
|
276
|
+
fetchGroupedDaily: (date: string, options?: {
|
|
277
|
+
apiKey?: string;
|
|
278
|
+
adjusted?: boolean;
|
|
279
|
+
includeOTC?: boolean;
|
|
280
|
+
}) => Promise<Types.PolygonGroupedDailyResponse>;
|
|
281
|
+
fetchLastTrade: (symbol: string, options?: {
|
|
282
|
+
apiKey?: string;
|
|
283
|
+
}) => Promise<Types.PolygonQuote>;
|
|
284
|
+
fetchTrades: (symbol: string, options?: {
|
|
285
|
+
apiKey?: string;
|
|
286
|
+
timestamp?: string | number;
|
|
287
|
+
timestampgt?: string | number;
|
|
288
|
+
timestampgte?: string | number;
|
|
289
|
+
timestamplt?: string | number;
|
|
290
|
+
timestamplte?: string | number;
|
|
291
|
+
order?: "asc" | "desc";
|
|
292
|
+
limit?: number;
|
|
293
|
+
sort?: string;
|
|
294
|
+
}) => Promise<Types.PolygonTradesResponse>;
|
|
295
|
+
fetchPrices: (params: {
|
|
296
|
+
ticker: string;
|
|
297
|
+
start: number;
|
|
298
|
+
end?: number;
|
|
299
|
+
multiplier: number;
|
|
300
|
+
timespan: string;
|
|
301
|
+
limit?: number;
|
|
302
|
+
}, options?: {
|
|
303
|
+
apiKey?: string;
|
|
304
|
+
}) => Promise<Types.PolygonPriceData[]>;
|
|
305
|
+
analysePolygonPriceData: typeof polygon.analysePolygonPriceData;
|
|
306
|
+
formatPriceData: typeof polygon.formatPriceData;
|
|
307
|
+
fetchDailyOpenClose: (symbol: string, date?: Date, options?: {
|
|
308
|
+
apiKey?: string;
|
|
309
|
+
adjusted?: boolean;
|
|
310
|
+
}) => Promise<Types.PolygonDailyOpenClose>;
|
|
311
|
+
getPreviousClose: typeof polygon.getPreviousClose;
|
|
312
|
+
};
|
|
313
|
+
indices: {
|
|
314
|
+
fetchAggregates: (params: Types.PolygonIndicesAggregatesParams, options?: {
|
|
315
|
+
apiKey?: string;
|
|
316
|
+
}) => Promise<Types.PolygonIndicesAggregatesResponse>;
|
|
317
|
+
fetchPreviousClose: (indicesTicker: string, options?: {
|
|
318
|
+
apiKey?: string;
|
|
319
|
+
}) => Promise<Types.PolygonIndicesPrevCloseResponse>;
|
|
320
|
+
fetchDailyOpenClose: (indicesTicker: string, date: string, options?: {
|
|
321
|
+
apiKey?: string;
|
|
322
|
+
}) => Promise<Types.PolygonIndicesDailyOpenCloseResponse>;
|
|
323
|
+
fetchSnapshot: (params?: Types.PolygonIndicesSnapshotParams, options?: {
|
|
324
|
+
apiKey?: string;
|
|
325
|
+
}) => Promise<Types.PolygonIndicesSnapshotResponse>;
|
|
326
|
+
fetchUniversalSnapshot: (tickers: string[], options?: {
|
|
327
|
+
apiKey?: string;
|
|
328
|
+
type?: string;
|
|
329
|
+
order?: string;
|
|
330
|
+
limit?: number;
|
|
331
|
+
sort?: string;
|
|
332
|
+
}) => Promise<Types.PolygonIndicesSnapshotResponse>;
|
|
333
|
+
formatBarData: (data: Types.PolygonIndicesAggregatesResponse) => Array<{
|
|
334
|
+
date: string;
|
|
335
|
+
open: number;
|
|
336
|
+
high: number;
|
|
337
|
+
low: number;
|
|
338
|
+
close: number;
|
|
339
|
+
timestamp: number;
|
|
340
|
+
}>;
|
|
341
|
+
};
|
|
342
|
+
price: {
|
|
343
|
+
roundUp: typeof pu.roundStockPrice;
|
|
344
|
+
equityValues: typeof pu.getEquityValues;
|
|
345
|
+
totalFees: (trade: import("@adaptic/backend-legacy/generated/typegraphql-prisma/models").Trade) => Promise<number>;
|
|
346
|
+
};
|
|
347
|
+
ta: {
|
|
348
|
+
calculateEMA: typeof ta.calculateEMA;
|
|
349
|
+
calculateMACD: typeof ta.calculateMACD;
|
|
350
|
+
calculateRSI: typeof ta.calculateRSI;
|
|
351
|
+
calculateStochasticOscillator: typeof ta.calculateStochasticOscillator;
|
|
352
|
+
calculateBollingerBands: typeof ta.calculateBollingerBands;
|
|
353
|
+
calculateSupportAndResistance: typeof ta.calculateSupportAndResistance;
|
|
354
|
+
calculateFibonacciLevels: typeof ta.calculateFibonacciLevels;
|
|
355
|
+
};
|
|
356
|
+
time: {
|
|
357
|
+
toUnixTimestamp: (ts: string) => number;
|
|
358
|
+
getTimeAgo: typeof tu.getTimeAgo;
|
|
359
|
+
timeAgo: (timestamp?: Date) => string;
|
|
360
|
+
normalizeDate: typeof tu.normalizeDate;
|
|
361
|
+
getDateInNY: typeof mt.getDateInNY;
|
|
362
|
+
createMarketTimeUtil: typeof mt.createMarketTimeUtil;
|
|
363
|
+
getStartAndEndTimestamps: typeof mt.getStartAndEndTimestamps;
|
|
364
|
+
getStartAndEndDates: typeof mt.getStartAndEndDates;
|
|
365
|
+
getMarketOpenClose: typeof mt.getMarketOpenClose;
|
|
366
|
+
calculateTimeRange: typeof tu.calculateTimeRange;
|
|
367
|
+
calculateDaysLeft: (accountCreationDate: Date) => number;
|
|
368
|
+
formatDate: (dateString: string, updateDate?: boolean) => string;
|
|
369
|
+
currentTimeET: () => Date;
|
|
370
|
+
MarketTimeUtil: typeof mt.MarketTimeUtil;
|
|
371
|
+
MARKET_TIMES: Types.MarketTimesConfig;
|
|
372
|
+
getLastTradingDateYYYYMMDD: typeof mt.getLastTradingDateYYYYMMDD;
|
|
373
|
+
getLastFullTradingDate: typeof mt.getLastFullTradingDate;
|
|
374
|
+
getNextMarketDay: typeof mt.getNextMarketDay;
|
|
375
|
+
parseETDateFromAV: (dateString: string) => Date;
|
|
376
|
+
formatToUSEastern: (date: Date, justDate?: boolean) => string;
|
|
377
|
+
unixTimetoUSEastern: (timestamp: number) => {
|
|
378
|
+
date: Date;
|
|
379
|
+
timeString: string;
|
|
380
|
+
dateString: string;
|
|
381
|
+
};
|
|
382
|
+
getMarketStatus: typeof mt.getMarketStatus;
|
|
383
|
+
timeDiffString: (milliseconds: number) => string;
|
|
384
|
+
getNYTimeZone: (date?: Date) => "-04:00" | "-05:00";
|
|
385
|
+
getTradingDate: typeof mt.getTradingDate;
|
|
386
|
+
};
|
|
387
|
+
utils: {
|
|
388
|
+
logIfDebug: (message: string, data?: unknown, type?: "error" | "info" | "warn" | "debug" | "trace") => void;
|
|
389
|
+
fetchWithRetry: typeof misc.fetchWithRetry;
|
|
390
|
+
validatePolygonApiKey: typeof misc.validatePolygonApiKey;
|
|
391
|
+
};
|
|
392
|
+
rateLimiter: {
|
|
393
|
+
TokenBucketRateLimiter: typeof TokenBucketRateLimiter;
|
|
394
|
+
limiters: {
|
|
395
|
+
alpaca: TokenBucketRateLimiter;
|
|
396
|
+
polygon: TokenBucketRateLimiter;
|
|
397
|
+
alphaVantage: TokenBucketRateLimiter;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
export declare const adptc: {
|
|
402
|
+
types: typeof Types;
|
|
403
|
+
backend: {
|
|
404
|
+
fetchAssetOverview: (symbol: string) => Promise<Types.AssetOverviewResponse>;
|
|
405
|
+
getApolloClient: () => Promise<any>;
|
|
406
|
+
configureAuth: (provider: backend.TokenProvider) => void;
|
|
407
|
+
isAuthConfigured: () => boolean;
|
|
408
|
+
};
|
|
409
|
+
alpaca: {
|
|
410
|
+
createClient: typeof import("./alpaca").createAlpacaClient;
|
|
411
|
+
createClientFromEnv: typeof import("./alpaca").createClientFromEnv;
|
|
412
|
+
clearClientCache: typeof import("./alpaca").clearClientCache;
|
|
413
|
+
/** @description Smart orders: brackets, OCO, OTO, trailing stops */
|
|
414
|
+
smartOrders: {
|
|
415
|
+
bracket: typeof import("./alpaca/trading/bracket-orders");
|
|
416
|
+
oco: typeof import("./alpaca/trading/oco-orders");
|
|
417
|
+
oto: typeof import("./alpaca/trading/oto-orders");
|
|
418
|
+
trailingStops: typeof import("./alpaca/trading/trailing-stops");
|
|
419
|
+
determineOrderType(params: import("./alpaca/trading/smart-orders").SmartOrderParams): import("./alpaca/trading/smart-orders").SmartOrderType;
|
|
420
|
+
createSmartOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").SmartOrderParams): Promise<import("./alpaca/trading/smart-orders").SmartOrderResult>;
|
|
421
|
+
createPercentageBracket(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").PercentageBracketParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
422
|
+
createRiskManagedPosition(client: import("./alpaca").AlpacaClient, params: import("./alpaca/trading/smart-orders").RiskManagedPositionParams): Promise<import("./alpaca").BracketOrderResult | import("./alpaca").OTOOrderResult>;
|
|
423
|
+
calculateRewardRiskRatio(entryPrice: number, takeProfitPrice: number, stopLossPrice: number, side: Types.OrderSide): number;
|
|
424
|
+
calculatePositionSize(accountValue: number, riskPercent: number, entryPrice: number, stopPrice: number): number;
|
|
425
|
+
default: {
|
|
426
|
+
createSmartOrder: typeof import("./alpaca/trading/smart-orders").createSmartOrder;
|
|
427
|
+
determineOrderType: typeof import("./alpaca/trading/smart-orders").determineOrderType;
|
|
428
|
+
createPercentageBracket: typeof import("./alpaca/trading/smart-orders").createPercentageBracket;
|
|
429
|
+
createRiskManagedPosition: typeof import("./alpaca/trading/smart-orders").createRiskManagedPosition;
|
|
430
|
+
calculateRewardRiskRatio: typeof import("./alpaca/trading/smart-orders").calculateRewardRiskRatio;
|
|
431
|
+
calculatePositionSize: typeof import("./alpaca/trading/smart-orders").calculatePositionSize;
|
|
432
|
+
createBracketOrder: typeof import("./alpaca").createBracketOrder;
|
|
433
|
+
createProtectiveBracket: typeof import("./alpaca").createProtectiveBracket;
|
|
434
|
+
createExecutorFromTradingAPI: typeof import("./alpaca").createExecutorFromTradingAPI;
|
|
435
|
+
createOCOOrder: typeof import("./alpaca").createOCOOrder;
|
|
436
|
+
createOTOOrder: typeof import("./alpaca").createOTOOrder;
|
|
437
|
+
createTrailingStop: typeof import("./alpaca").createTrailingStop;
|
|
438
|
+
updateTrailingStop: typeof import("./alpaca").updateTrailingStop;
|
|
439
|
+
};
|
|
440
|
+
createBracketOrder(executor: import("./alpaca").BracketOrderExecutor, params: import("./alpaca").BracketOrderParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
441
|
+
createProtectiveBracket(executor: import("./alpaca").BracketOrderExecutor, params: import("./alpaca").ProtectiveBracketParams): Promise<import("./alpaca").BracketOrderResult>;
|
|
442
|
+
createExecutorFromTradingAPI(api: {
|
|
443
|
+
makeRequest: (endpoint: string, method: string, body?: unknown) => Promise<Types.AlpacaOrder>;
|
|
444
|
+
}): import("./alpaca").BracketOrderExecutor;
|
|
445
|
+
createOCOOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca").OCOOrderParams): Promise<import("./alpaca").OCOOrderResult>;
|
|
446
|
+
cancelOCOOrder(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<void>;
|
|
447
|
+
getOCOOrderStatus(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<Types.AlpacaOrder>;
|
|
448
|
+
protectLongPosition(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OCOOrderResult>;
|
|
449
|
+
protectShortPosition(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OCOOrderResult>;
|
|
450
|
+
createOTOOrder(client: import("./alpaca").AlpacaClient, params: import("./alpaca").OTOOrderParams): Promise<import("./alpaca").OTOOrderResult>;
|
|
451
|
+
cancelOTOOrder(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<void>;
|
|
452
|
+
getOTOOrderStatus(client: import("./alpaca").AlpacaClient, parentOrderId: string): Promise<Types.AlpacaOrder>;
|
|
453
|
+
buyWithStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, stopLossPrice: number, stopLimitPrice?: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
454
|
+
buyWithTrailingStop(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, trailPercent: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
455
|
+
limitBuyWithTakeProfit(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number, takeProfitPrice: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
456
|
+
shortWithStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number, stopLossPrice: number): Promise<import("./alpaca").OTOOrderResult>;
|
|
457
|
+
entryWithPercentStopLoss(client: import("./alpaca").AlpacaClient, symbol: string, qty: number, entryPrice: number | null, stopLossPercent: number, side?: Types.OrderSide): Promise<import("./alpaca").OTOOrderResult>;
|
|
458
|
+
createTrailingStop(client: import("./alpaca").AlpacaClient, params: import("./alpaca").TrailingStopParams): Promise<Types.AlpacaOrder>;
|
|
459
|
+
updateTrailingStop(client: import("./alpaca").AlpacaClient, orderId: string, updates: {
|
|
460
|
+
trailPercent?: number;
|
|
461
|
+
trailPrice?: number;
|
|
462
|
+
}): Promise<Types.AlpacaOrder>;
|
|
463
|
+
getTrailingStopHWM(client: import("./alpaca").AlpacaClient, orderId: string): Promise<import("./alpaca").TrailingStopHWMResult>;
|
|
464
|
+
cancelTrailingStop(client: import("./alpaca").AlpacaClient, orderId: string): Promise<void>;
|
|
465
|
+
createPortfolioTrailingStops(client: import("./alpaca").AlpacaClient, params: import("./alpaca").PortfolioTrailingStopParams): Promise<Map<string, Types.AlpacaOrder>>;
|
|
466
|
+
getOpenTrailingStops(client: import("./alpaca").AlpacaClient, symbol?: string): Promise<Types.AlpacaOrder[]>;
|
|
467
|
+
hasActiveTrailingStop(client: import("./alpaca").AlpacaClient, symbol: string): Promise<boolean>;
|
|
468
|
+
cancelTrailingStopsForSymbol(client: import("./alpaca").AlpacaClient, symbol: string): Promise<number>;
|
|
469
|
+
TrailingStopValidationError: typeof import("./alpaca").TrailingStopValidationError;
|
|
470
|
+
};
|
|
471
|
+
/** @description Standard order operations - SDK-based (requires AlpacaClient) */
|
|
472
|
+
sdkOrders: {
|
|
473
|
+
getOrdersBySymbol(client: import("./alpaca").AlpacaClient, symbol: string, params?: Omit<Types.GetOrdersParams, "symbols">): Promise<Types.AlpacaOrder[]>;
|
|
474
|
+
getOpenOrders(client: import("./alpaca").AlpacaClient, params?: Omit<Types.GetOrdersParams, "status">): Promise<Types.AlpacaOrder[]>;
|
|
475
|
+
getFilledOrders(client: import("./alpaca").AlpacaClient, params: import("./alpaca").GetFilledOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
476
|
+
getOrderHistory(client: import("./alpaca").AlpacaClient, params?: import("./alpaca").GetOrderHistoryParams): Promise<import("./alpaca").OrderHistoryResult>;
|
|
477
|
+
getAllOrders(client: import("./alpaca").AlpacaClient, params?: import("./alpaca").GetAllOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
478
|
+
waitForOrderFill(client: import("./alpaca").AlpacaClient, params: import("./alpaca").WaitForOrderFillParams): Promise<import("./alpaca").WaitForOrderFillResult>;
|
|
479
|
+
isOrderFillable(order: Types.AlpacaOrder): boolean;
|
|
480
|
+
isOrderFilled(order: Types.AlpacaOrder): boolean;
|
|
481
|
+
isOrderTerminal(order: Types.AlpacaOrder): boolean;
|
|
482
|
+
isOrderOpen(order: Types.AlpacaOrder): boolean;
|
|
483
|
+
calculateOrderValue(order: Types.AlpacaOrder): number | null;
|
|
484
|
+
formatOrderSummary(order: Types.AlpacaOrder): import("./alpaca").OrderSummary;
|
|
485
|
+
formatOrderForLog(order: Types.AlpacaOrder): string;
|
|
486
|
+
roundPriceForAlpaca(price: number): string;
|
|
487
|
+
roundPriceForAlpacaNumber(price: number): number;
|
|
488
|
+
groupOrdersBySymbol(orders: Types.AlpacaOrder[]): Map<string, Types.AlpacaOrder[]>;
|
|
489
|
+
groupOrdersByStatus(orders: Types.AlpacaOrder[]): Map<string, Types.AlpacaOrder[]>;
|
|
490
|
+
calculateTotalFilledValue(orders: Types.AlpacaOrder[]): number;
|
|
491
|
+
filterOrdersByDateRange(orders: Types.AlpacaOrder[], startDate: Date, endDate: Date): Types.AlpacaOrder[];
|
|
492
|
+
sortOrdersByDate(orders: Types.AlpacaOrder[], direction?: "asc" | "desc"): Types.AlpacaOrder[];
|
|
493
|
+
default: {
|
|
494
|
+
getOrdersBySymbol: typeof import("./alpaca").getOrdersBySymbol;
|
|
495
|
+
getOpenOrders: typeof import("./alpaca").getOpenOrdersQuery;
|
|
496
|
+
getFilledOrders: typeof import("./alpaca").getFilledOrders;
|
|
497
|
+
getOrderHistory: typeof import("./alpaca").getOrderHistory;
|
|
498
|
+
getAllOrders: typeof import("./alpaca").getAllOrders;
|
|
499
|
+
waitForOrderFill: typeof import("./alpaca").waitForOrderFill;
|
|
500
|
+
isOrderFillable: typeof import("./alpaca").isOrderFillable;
|
|
501
|
+
isOrderFilled: typeof import("./alpaca").isOrderFilled;
|
|
502
|
+
isOrderTerminal: typeof import("./alpaca").isOrderTerminalStatus;
|
|
503
|
+
isOrderOpen: typeof import("./alpaca").isOrderOpen;
|
|
504
|
+
calculateOrderValue: typeof import("./alpaca").calculateOrderValue;
|
|
505
|
+
calculateTotalFilledValue: typeof import("./alpaca").calculateTotalFilledValue;
|
|
506
|
+
formatOrderSummary: typeof import("./alpaca").formatOrderSummary;
|
|
507
|
+
formatOrderForLog: typeof import("./alpaca").formatOrderForLog;
|
|
508
|
+
roundPriceForAlpaca: typeof import("./alpaca").roundPriceForAlpaca;
|
|
509
|
+
roundPriceForAlpacaNumber: typeof import("./alpaca").roundPriceForAlpacaNumber;
|
|
510
|
+
groupOrdersBySymbol: typeof import("./alpaca").groupOrdersBySymbol;
|
|
511
|
+
groupOrdersByStatus: typeof import("./alpaca").groupOrdersByStatus;
|
|
512
|
+
filterOrdersByDateRange: typeof import("./alpaca").filterOrdersByDateRange;
|
|
513
|
+
sortOrdersByDate: typeof import("./alpaca").sortOrdersByDate;
|
|
514
|
+
};
|
|
515
|
+
createOrder(client: import("./alpaca").AlpacaClient, params: Types.CreateOrderParams): Promise<Types.AlpacaOrder>;
|
|
516
|
+
getOrder(client: import("./alpaca").AlpacaClient, orderId: string): Promise<Types.AlpacaOrder>;
|
|
517
|
+
getOrders(client: import("./alpaca").AlpacaClient, params?: Types.GetOrdersParams): Promise<Types.AlpacaOrder[]>;
|
|
518
|
+
cancelOrder(client: import("./alpaca").AlpacaClient, orderId: string): Promise<void>;
|
|
519
|
+
cancelAllOrders(client: import("./alpaca").AlpacaClient): Promise<import("./alpaca/trading/orders").CancelAllOrdersResponse>;
|
|
520
|
+
replaceOrder(client: import("./alpaca").AlpacaClient, orderId: string, params: Types.ReplaceOrderParams): Promise<Types.AlpacaOrder>;
|
|
521
|
+
isOrderCancelable(status: Types.OrderStatus): boolean;
|
|
522
|
+
getOrderByClientId(client: import("./alpaca").AlpacaClient, clientOrderId: string): Promise<Types.AlpacaOrder>;
|
|
523
|
+
};
|
|
524
|
+
/** @description Position management - SDK-based (requires AlpacaClient) */
|
|
525
|
+
sdkPositions: typeof import("./alpaca/trading/positions");
|
|
526
|
+
/** @description Account information and configuration - SDK-based (requires AlpacaClient) */
|
|
527
|
+
sdkAccount: typeof import("./alpaca/trading/account");
|
|
528
|
+
/** @description Market clock and trading calendar - SDK-based (requires AlpacaClient) */
|
|
529
|
+
sdkClock: typeof import("./alpaca/trading/clock");
|
|
530
|
+
/** @description Standard order operations - Legacy API (uses AlpacaAuth) */
|
|
531
|
+
orders: {
|
|
532
|
+
create: typeof Alpaca.createOrder;
|
|
533
|
+
createLimitOrder: typeof Alpaca.createLimitOrder;
|
|
534
|
+
get: typeof Alpaca.getOrder;
|
|
535
|
+
getAll: typeof Alpaca.getOrders;
|
|
536
|
+
replace: typeof Alpaca.replaceOrder;
|
|
537
|
+
cancel: typeof Alpaca.cancelOrder;
|
|
538
|
+
cancelAll: typeof Alpaca.cancelAllOrders;
|
|
539
|
+
};
|
|
540
|
+
/** @description Position management - Legacy API (uses AlpacaAuth) */
|
|
541
|
+
positions: {
|
|
542
|
+
fetch: typeof Alpaca.fetchPosition;
|
|
543
|
+
close: typeof Alpaca.closePosition;
|
|
544
|
+
fetchAll: typeof Alpaca.fetchAllPositions;
|
|
545
|
+
closeAll: typeof Alpaca.closeAllPositions;
|
|
546
|
+
closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
|
|
547
|
+
};
|
|
548
|
+
/** @description Account information - Legacy API (uses AlpacaAuth) */
|
|
549
|
+
account: typeof Alpaca.fetchAccountDetails;
|
|
550
|
+
/** @description Real-time and historical quotes */
|
|
551
|
+
quotes: typeof import("./alpaca/market-data/quotes");
|
|
552
|
+
/** @description Historical price bars (OHLCV) */
|
|
553
|
+
bars: typeof import("./alpaca/market-data/bars");
|
|
554
|
+
/** @description Trade data */
|
|
555
|
+
trades: typeof import("./alpaca/market-data/trades");
|
|
556
|
+
/** @description Market news */
|
|
557
|
+
news: typeof import("./alpaca/market-data/news");
|
|
558
|
+
/** @description Options trading and data */
|
|
559
|
+
options: {
|
|
560
|
+
contracts: typeof import("./alpaca/options/contracts");
|
|
561
|
+
orders: typeof import("./alpaca/options/orders");
|
|
562
|
+
strategies: typeof import("./alpaca/options/strategies");
|
|
563
|
+
data: typeof import("./alpaca/options/data");
|
|
564
|
+
};
|
|
565
|
+
/** @description Cryptocurrency trading and data */
|
|
566
|
+
crypto: {
|
|
567
|
+
orders: typeof import("./alpaca/crypto/orders");
|
|
568
|
+
data: typeof import("./alpaca/crypto/data");
|
|
569
|
+
};
|
|
570
|
+
/** @description Real-time WebSocket streams */
|
|
571
|
+
streams: typeof import("./alpaca/streams");
|
|
572
|
+
/** @deprecated Use positions module instead */
|
|
573
|
+
position: {
|
|
574
|
+
fetch: typeof Alpaca.fetchPosition;
|
|
575
|
+
close: typeof Alpaca.closePosition;
|
|
576
|
+
fetchAll: typeof Alpaca.fetchAllPositions;
|
|
577
|
+
closeAll: typeof Alpaca.closeAllPositions;
|
|
578
|
+
closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
|
|
579
|
+
};
|
|
580
|
+
/** @deprecated Use account() instead */
|
|
581
|
+
accountDetails: typeof Alpaca.fetchAccountDetails;
|
|
582
|
+
/** @deprecated Use sdkAccount.getPortfolioHistory() instead */
|
|
583
|
+
portfolioHistory: typeof Alpaca.fetchPortfolioHistory;
|
|
584
|
+
/** @deprecated Use sdkAccount.getAccountConfiguration() instead */
|
|
585
|
+
getConfig: typeof Alpaca.getConfiguration;
|
|
586
|
+
/** @deprecated Use sdkAccount.updateAccountConfiguration() instead */
|
|
587
|
+
updateConfig: typeof Alpaca.updateConfiguration;
|
|
588
|
+
/** @deprecated Use SDK asset functions instead */
|
|
589
|
+
asset: {
|
|
590
|
+
get: typeof Alpaca.getAsset;
|
|
591
|
+
};
|
|
592
|
+
/** @deprecated Use quotes module instead */
|
|
593
|
+
quote: {
|
|
594
|
+
getLatest: typeof Alpaca.getLatestQuotes;
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
av: {
|
|
598
|
+
fetchQuote: (ticker: string, options?: {
|
|
599
|
+
apiKey?: string;
|
|
600
|
+
}) => Promise<Types.AlphaVantageQuoteResponse>;
|
|
601
|
+
fetchTickerNews: (ticker: string, options?: {
|
|
602
|
+
start?: Date;
|
|
603
|
+
end?: Date;
|
|
604
|
+
limit?: number;
|
|
605
|
+
apiKey?: string;
|
|
606
|
+
sort?: "LATEST" | "EARLIEST" | "RELEVANCE";
|
|
607
|
+
}) => Promise<Types.AVNewsArticle[]>;
|
|
608
|
+
convertDateToYYYYMMDDTHHMM: typeof av.convertDateToYYYYMMDDTHHMM;
|
|
609
|
+
convertYYYYMMDDTHHMMSSToDate: typeof av.convertYYYYMMDDTHHMMSSToDate;
|
|
610
|
+
};
|
|
611
|
+
crypto: {
|
|
612
|
+
fetchBars: typeof crypto.fetchBars;
|
|
613
|
+
fetchNews: typeof crypto.fetchNews;
|
|
614
|
+
fetchLatestTrades: typeof crypto.fetchLatestTrades;
|
|
615
|
+
fetchLatestQuotes: typeof crypto.fetchLatestQuotes;
|
|
616
|
+
};
|
|
617
|
+
format: {
|
|
618
|
+
capitalize: typeof ft.capitalize;
|
|
619
|
+
enum: typeof ft.formatEnum;
|
|
620
|
+
currency: typeof ft.formatCurrency;
|
|
621
|
+
number: typeof ft.formatNumber;
|
|
622
|
+
percentage: typeof ft.formatPercentage;
|
|
623
|
+
date: (dateString: string, updateDate?: boolean) => string;
|
|
624
|
+
dateToString: (date: Date) => string;
|
|
625
|
+
dateTimeForGS: typeof ft.dateTimeForGS;
|
|
626
|
+
};
|
|
627
|
+
metrics: {
|
|
628
|
+
trade: typeof fetchTradeMetrics;
|
|
629
|
+
alphaAndBeta: typeof pm.calculateAlphaAndBeta;
|
|
630
|
+
maxDrawdown: typeof pm.calculateMaxDrawdown;
|
|
631
|
+
dailyReturns: typeof pm.calculateDailyReturns;
|
|
632
|
+
returnsByDate: typeof pm.alignReturnsByDate;
|
|
633
|
+
beta: typeof pm.calculateBetaFromReturns;
|
|
634
|
+
infoRatio: typeof pm.calculateInformationRatio;
|
|
635
|
+
allpm: typeof pm.fetchPerformanceMetrics;
|
|
636
|
+
};
|
|
637
|
+
polygon: {
|
|
638
|
+
fetchTickerInfo: (symbol: string, options?: {
|
|
639
|
+
apiKey?: string;
|
|
640
|
+
}) => Promise<Types.PolygonTickerInfo | null>;
|
|
641
|
+
fetchGroupedDaily: (date: string, options?: {
|
|
642
|
+
apiKey?: string;
|
|
643
|
+
adjusted?: boolean;
|
|
644
|
+
includeOTC?: boolean;
|
|
645
|
+
}) => Promise<Types.PolygonGroupedDailyResponse>;
|
|
646
|
+
fetchLastTrade: (symbol: string, options?: {
|
|
647
|
+
apiKey?: string;
|
|
648
|
+
}) => Promise<Types.PolygonQuote>;
|
|
649
|
+
fetchTrades: (symbol: string, options?: {
|
|
650
|
+
apiKey?: string;
|
|
651
|
+
timestamp?: string | number;
|
|
652
|
+
timestampgt?: string | number;
|
|
653
|
+
timestampgte?: string | number;
|
|
654
|
+
timestamplt?: string | number;
|
|
655
|
+
timestamplte?: string | number;
|
|
656
|
+
order?: "asc" | "desc";
|
|
657
|
+
limit?: number;
|
|
658
|
+
sort?: string;
|
|
659
|
+
}) => Promise<Types.PolygonTradesResponse>;
|
|
660
|
+
fetchPrices: (params: {
|
|
661
|
+
ticker: string;
|
|
662
|
+
start: number;
|
|
663
|
+
end?: number;
|
|
664
|
+
multiplier: number;
|
|
665
|
+
timespan: string;
|
|
666
|
+
limit?: number;
|
|
667
|
+
}, options?: {
|
|
668
|
+
apiKey?: string;
|
|
669
|
+
}) => Promise<Types.PolygonPriceData[]>;
|
|
670
|
+
analysePolygonPriceData: typeof polygon.analysePolygonPriceData;
|
|
671
|
+
formatPriceData: typeof polygon.formatPriceData;
|
|
672
|
+
fetchDailyOpenClose: (symbol: string, date?: Date, options?: {
|
|
673
|
+
apiKey?: string;
|
|
674
|
+
adjusted?: boolean;
|
|
675
|
+
}) => Promise<Types.PolygonDailyOpenClose>;
|
|
676
|
+
getPreviousClose: typeof polygon.getPreviousClose;
|
|
677
|
+
};
|
|
678
|
+
indices: {
|
|
679
|
+
fetchAggregates: (params: Types.PolygonIndicesAggregatesParams, options?: {
|
|
680
|
+
apiKey?: string;
|
|
681
|
+
}) => Promise<Types.PolygonIndicesAggregatesResponse>;
|
|
682
|
+
fetchPreviousClose: (indicesTicker: string, options?: {
|
|
683
|
+
apiKey?: string;
|
|
684
|
+
}) => Promise<Types.PolygonIndicesPrevCloseResponse>;
|
|
685
|
+
fetchDailyOpenClose: (indicesTicker: string, date: string, options?: {
|
|
686
|
+
apiKey?: string;
|
|
687
|
+
}) => Promise<Types.PolygonIndicesDailyOpenCloseResponse>;
|
|
688
|
+
fetchSnapshot: (params?: Types.PolygonIndicesSnapshotParams, options?: {
|
|
689
|
+
apiKey?: string;
|
|
690
|
+
}) => Promise<Types.PolygonIndicesSnapshotResponse>;
|
|
691
|
+
fetchUniversalSnapshot: (tickers: string[], options?: {
|
|
692
|
+
apiKey?: string;
|
|
693
|
+
type?: string;
|
|
694
|
+
order?: string;
|
|
695
|
+
limit?: number;
|
|
696
|
+
sort?: string;
|
|
697
|
+
}) => Promise<Types.PolygonIndicesSnapshotResponse>;
|
|
698
|
+
formatBarData: (data: Types.PolygonIndicesAggregatesResponse) => Array<{
|
|
699
|
+
date: string;
|
|
700
|
+
open: number;
|
|
701
|
+
high: number;
|
|
702
|
+
low: number;
|
|
703
|
+
close: number;
|
|
704
|
+
timestamp: number;
|
|
705
|
+
}>;
|
|
706
|
+
};
|
|
707
|
+
price: {
|
|
708
|
+
roundUp: typeof pu.roundStockPrice;
|
|
709
|
+
equityValues: typeof pu.getEquityValues;
|
|
710
|
+
totalFees: (trade: import("@adaptic/backend-legacy/generated/typegraphql-prisma/models").Trade) => Promise<number>;
|
|
711
|
+
};
|
|
712
|
+
ta: {
|
|
713
|
+
calculateEMA: typeof ta.calculateEMA;
|
|
714
|
+
calculateMACD: typeof ta.calculateMACD;
|
|
715
|
+
calculateRSI: typeof ta.calculateRSI;
|
|
716
|
+
calculateStochasticOscillator: typeof ta.calculateStochasticOscillator;
|
|
717
|
+
calculateBollingerBands: typeof ta.calculateBollingerBands;
|
|
718
|
+
calculateSupportAndResistance: typeof ta.calculateSupportAndResistance;
|
|
719
|
+
calculateFibonacciLevels: typeof ta.calculateFibonacciLevels;
|
|
720
|
+
};
|
|
721
|
+
time: {
|
|
722
|
+
toUnixTimestamp: (ts: string) => number;
|
|
723
|
+
getTimeAgo: typeof tu.getTimeAgo;
|
|
724
|
+
timeAgo: (timestamp?: Date) => string;
|
|
725
|
+
normalizeDate: typeof tu.normalizeDate;
|
|
726
|
+
getDateInNY: typeof mt.getDateInNY;
|
|
727
|
+
createMarketTimeUtil: typeof mt.createMarketTimeUtil;
|
|
728
|
+
getStartAndEndTimestamps: typeof mt.getStartAndEndTimestamps;
|
|
729
|
+
getStartAndEndDates: typeof mt.getStartAndEndDates;
|
|
730
|
+
getMarketOpenClose: typeof mt.getMarketOpenClose;
|
|
731
|
+
calculateTimeRange: typeof tu.calculateTimeRange;
|
|
732
|
+
calculateDaysLeft: (accountCreationDate: Date) => number;
|
|
733
|
+
formatDate: (dateString: string, updateDate?: boolean) => string;
|
|
734
|
+
currentTimeET: () => Date;
|
|
735
|
+
MarketTimeUtil: typeof mt.MarketTimeUtil;
|
|
736
|
+
MARKET_TIMES: Types.MarketTimesConfig;
|
|
737
|
+
getLastTradingDateYYYYMMDD: typeof mt.getLastTradingDateYYYYMMDD;
|
|
738
|
+
getLastFullTradingDate: typeof mt.getLastFullTradingDate;
|
|
739
|
+
getNextMarketDay: typeof mt.getNextMarketDay;
|
|
740
|
+
parseETDateFromAV: (dateString: string) => Date;
|
|
741
|
+
formatToUSEastern: (date: Date, justDate?: boolean) => string;
|
|
742
|
+
unixTimetoUSEastern: (timestamp: number) => {
|
|
743
|
+
date: Date;
|
|
744
|
+
timeString: string;
|
|
745
|
+
dateString: string;
|
|
746
|
+
};
|
|
747
|
+
getMarketStatus: typeof mt.getMarketStatus;
|
|
748
|
+
timeDiffString: (milliseconds: number) => string;
|
|
749
|
+
getNYTimeZone: (date?: Date) => "-04:00" | "-05:00";
|
|
750
|
+
getTradingDate: typeof mt.getTradingDate;
|
|
751
|
+
};
|
|
752
|
+
utils: {
|
|
753
|
+
logIfDebug: (message: string, data?: unknown, type?: "error" | "info" | "warn" | "debug" | "trace") => void;
|
|
754
|
+
fetchWithRetry: typeof misc.fetchWithRetry;
|
|
755
|
+
validatePolygonApiKey: typeof misc.validatePolygonApiKey;
|
|
756
|
+
};
|
|
757
|
+
rateLimiter: {
|
|
758
|
+
TokenBucketRateLimiter: typeof TokenBucketRateLimiter;
|
|
759
|
+
limiters: {
|
|
760
|
+
alpaca: TokenBucketRateLimiter;
|
|
761
|
+
polygon: TokenBucketRateLimiter;
|
|
762
|
+
alphaVantage: TokenBucketRateLimiter;
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
//# sourceMappingURL=index.d.ts.map
|