@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAChD,OAAO,K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CAAC;;kBACL,CAAC;;;;;kBAoHmsJ,CAAC;oBAAsB,CAAC;;;;;;kBA1TpuJ,CAAC;;;kBA+DW,CAAC;;;kBAqDhB,CAAC;;;kBA+BmD,CAAC;;;kBA8CvD,CAAC;gBAAkB,CAAC;iBAAmB,CAAC;iBAC7B,CAAC;gBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuHR,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configurable logger interface compatible with Pino and other logging libraries.
|
|
3
|
+
* Provides structured logging with context support.
|
|
4
|
+
*/
|
|
5
|
+
export interface Logger {
|
|
6
|
+
error(message: string, context?: unknown): void;
|
|
7
|
+
warn(message: string, context?: unknown): void;
|
|
8
|
+
info(message: string, context?: unknown): void;
|
|
9
|
+
debug(message: string, context?: unknown): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sets a custom logger implementation.
|
|
13
|
+
* Call this to integrate with Pino or other logging libraries.
|
|
14
|
+
*
|
|
15
|
+
* @param logger - The logger implementation to use
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import pino from 'pino';
|
|
20
|
+
* import { setLogger } from '@adaptic/utils';
|
|
21
|
+
*
|
|
22
|
+
* const pinoLogger = pino();
|
|
23
|
+
*
|
|
24
|
+
* setLogger({
|
|
25
|
+
* error: (msg, ctx) => pinoLogger.error(ctx, msg),
|
|
26
|
+
* warn: (msg, ctx) => pinoLogger.warn(ctx, msg),
|
|
27
|
+
* info: (msg, ctx) => pinoLogger.info(ctx, msg),
|
|
28
|
+
* debug: (msg, ctx) => pinoLogger.debug(ctx, msg),
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function setLogger(logger: Logger): void;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the current logger instance.
|
|
35
|
+
* Use this to log messages throughout the application.
|
|
36
|
+
*
|
|
37
|
+
* @returns The current logger instance
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getLogger } from '@adaptic/utils';
|
|
42
|
+
*
|
|
43
|
+
* const logger = getLogger();
|
|
44
|
+
* logger.error('Operation failed', { userId: 123, operation: 'createOrder' });
|
|
45
|
+
* logger.warn('Rate limit approaching', { remaining: 10 });
|
|
46
|
+
* logger.info('Order created', { orderId: 'abc123', symbol: 'AAPL' });
|
|
47
|
+
* logger.debug('Cache hit', { key: 'user:123' });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function getLogger(): Logger;
|
|
51
|
+
/**
|
|
52
|
+
* Resets the logger to the default console-based implementation.
|
|
53
|
+
* Useful for testing or cleanup.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resetLogger(): void;
|
|
56
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjD;AA8CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LogOptions } from "./types/logging-types";
|
|
2
|
+
/**
|
|
3
|
+
* Logs a message to the console.
|
|
4
|
+
* @param message The message to log.
|
|
5
|
+
* @param options Optional options.
|
|
6
|
+
* @param options.source The source of the message.
|
|
7
|
+
* @param options.type The type of message to log.
|
|
8
|
+
* @param options.symbol The trading symbol associated with this log.
|
|
9
|
+
* @param options.logToFile Force logging to a file even when no symbol is provided.
|
|
10
|
+
*/
|
|
11
|
+
export declare function log(message: string, options?: LogOptions): void;
|
|
12
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CACjB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,UAA+C,GACvD,IAAI,CAGN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface HolidayDetails {
|
|
2
|
+
date: string;
|
|
3
|
+
}
|
|
4
|
+
export interface MarketHolidaysForYear {
|
|
5
|
+
[holidayName: string]: HolidayDetails;
|
|
6
|
+
}
|
|
7
|
+
export interface MarketHolidays {
|
|
8
|
+
[year: number]: MarketHolidaysForYear;
|
|
9
|
+
}
|
|
10
|
+
export interface EarlyCloseDetails {
|
|
11
|
+
date: string;
|
|
12
|
+
time: string;
|
|
13
|
+
optionsTime: string;
|
|
14
|
+
notes: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EarlyClosesForYear {
|
|
17
|
+
[date: string]: EarlyCloseDetails;
|
|
18
|
+
}
|
|
19
|
+
export interface MarketEarlyCloses {
|
|
20
|
+
[year: number]: EarlyClosesForYear;
|
|
21
|
+
}
|
|
22
|
+
export declare const marketHolidays: MarketHolidays;
|
|
23
|
+
export declare const marketEarlyCloses: MarketEarlyCloses;
|
|
24
|
+
//# sourceMappingURL=market-hours.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market-hours.d.ts","sourceRoot":"","sources":["../../src/market-hours.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAAC;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACpC;AAED,eAAO,MAAM,cAAc,EAAE,cAkD5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBA+E/B,CAAC"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { IntradayReporting, PeriodDates, MarketTimeParams, MarketOpenCloseResult, MarketStatus, MarketTimesConfig } from "./types/market-time-types";
|
|
2
|
+
/**
|
|
3
|
+
* Market times for NYSE
|
|
4
|
+
* Regular market hours are 9:30am-4:00pm
|
|
5
|
+
* Early market hours are 9:30am-10:00am (first 30 minutes)
|
|
6
|
+
* Extended market hours are 4:00am to 9:30am and 4:00pm-8:00pm
|
|
7
|
+
* On days before some holidays, the market closes early at 1:00pm
|
|
8
|
+
* Early extended market hours are 1:00pm-5:00pm on early close days
|
|
9
|
+
*/
|
|
10
|
+
export declare const MARKET_TIMES: MarketTimesConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Utility class for handling market time-related operations
|
|
13
|
+
*/
|
|
14
|
+
export declare class MarketTimeUtil {
|
|
15
|
+
private timezone;
|
|
16
|
+
private intradayReporting;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new MarketTimeUtil instance
|
|
19
|
+
* @param {string} [timezone='America/New_York'] - The timezone to use for market time calculations
|
|
20
|
+
* @param {IntradayReporting} [intradayReporting='market_hours'] - The intraday reporting mode
|
|
21
|
+
*/
|
|
22
|
+
constructor(timezone?: string, intradayReporting?: IntradayReporting);
|
|
23
|
+
/**
|
|
24
|
+
* Validates the provided timezone
|
|
25
|
+
* @private
|
|
26
|
+
* @param {string} timezone - The timezone to validate
|
|
27
|
+
* @throws {Error} If the timezone is invalid
|
|
28
|
+
*/
|
|
29
|
+
private validateTimezone;
|
|
30
|
+
private formatDate;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a NY-zoned date falls on a weekend.
|
|
33
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
34
|
+
* @param nyDate - Date in market timezone representation
|
|
35
|
+
* @returns true if the date is Saturday or Sunday
|
|
36
|
+
*/
|
|
37
|
+
private isWeekendZoned;
|
|
38
|
+
/**
|
|
39
|
+
* Checks if a NY-zoned date falls on a market holiday.
|
|
40
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
41
|
+
* @param nyDate - Date in market timezone representation
|
|
42
|
+
* @returns true if the date is a holiday
|
|
43
|
+
*/
|
|
44
|
+
private isHolidayZoned;
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a NY-zoned date is an early close day.
|
|
47
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
48
|
+
* @param nyDate - Date in market timezone representation
|
|
49
|
+
* @returns true if the date is an early close day
|
|
50
|
+
*/
|
|
51
|
+
private isEarlyCloseDayZoned;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the early close time for a NY-zoned date.
|
|
54
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
55
|
+
* @param nyDate - Date in market timezone representation
|
|
56
|
+
* @returns The early close time in minutes from midnight, or null if not an early close day
|
|
57
|
+
*/
|
|
58
|
+
private getEarlyCloseTimeZoned;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if a NY-zoned date is a market day (not weekend, not holiday).
|
|
61
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
62
|
+
* @param nyDate - Date in market timezone representation
|
|
63
|
+
* @returns true if the date is a market day
|
|
64
|
+
*/
|
|
65
|
+
private isMarketDayZoned;
|
|
66
|
+
/**
|
|
67
|
+
* Check if a given date is an early close day.
|
|
68
|
+
* Handles timezone conversion from any input date.
|
|
69
|
+
* @param date - The date to check (any timezone)
|
|
70
|
+
* @returns true if the date is an early close day
|
|
71
|
+
*/
|
|
72
|
+
isEarlyCloseDay(date: Date): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Get the early close time for a given date.
|
|
75
|
+
* Handles timezone conversion from any input date.
|
|
76
|
+
* @param date - The date to check (any timezone)
|
|
77
|
+
* @returns The early close time in minutes from midnight, or null if there is no early close
|
|
78
|
+
*/
|
|
79
|
+
getEarlyCloseTime(date: Date): number | null;
|
|
80
|
+
/**
|
|
81
|
+
* Check if a given date is a market day.
|
|
82
|
+
* Handles timezone conversion from any input date.
|
|
83
|
+
* @param date - The date to check (any timezone)
|
|
84
|
+
* @returns true if the date is a market day, false otherwise
|
|
85
|
+
*/
|
|
86
|
+
isMarketDay(date: Date): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check if a given date is within market hours.
|
|
89
|
+
* Handles timezone conversion from any input date.
|
|
90
|
+
* @param date - The date to check (any timezone)
|
|
91
|
+
* @returns true if the date is within market hours, false otherwise
|
|
92
|
+
*/
|
|
93
|
+
isWithinMarketHours(date: Date): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Check if a NY-zoned date is within market hours.
|
|
96
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
97
|
+
* @param nyDate - Date in market timezone representation
|
|
98
|
+
* @returns true if the date is within market hours, false otherwise
|
|
99
|
+
*/
|
|
100
|
+
private isWithinMarketHoursZoned;
|
|
101
|
+
/**
|
|
102
|
+
* Check if a NY-zoned date is before market hours.
|
|
103
|
+
* Expects a date already converted to market timezone via toZonedTime.
|
|
104
|
+
* @param nyDate - Date in market timezone representation
|
|
105
|
+
* @returns true if the date is before market hours, false otherwise
|
|
106
|
+
*/
|
|
107
|
+
private isBeforeMarketHoursZoned;
|
|
108
|
+
/**
|
|
109
|
+
* Get the last trading date, i.e. the last date that was a market day
|
|
110
|
+
* @param currentDate - The current date
|
|
111
|
+
* @returns The last trading date
|
|
112
|
+
*/
|
|
113
|
+
getLastTradingDate(currentDate?: Date): Date;
|
|
114
|
+
private getLastMarketDay;
|
|
115
|
+
getLastFullTradingDate(currentDate?: Date): Date;
|
|
116
|
+
/**
|
|
117
|
+
* Gets the next market day from a reference date
|
|
118
|
+
* @param {Object} [options] - Options object
|
|
119
|
+
* @param {Date} [options.referenceDate] - The reference date (defaults to current date)
|
|
120
|
+
* @returns {Object} The next market day information
|
|
121
|
+
* @property {Date} date - The date object (start of day in NY time)
|
|
122
|
+
* @property {string} yyyymmdd - The date in YYYY-MM-DD format
|
|
123
|
+
* @property {string} dateISOString - Full ISO date string
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* Gets the next market day from a date already in market timezone.
|
|
127
|
+
* @param nyDate - Date in market timezone representation
|
|
128
|
+
* @returns The next market day in market timezone representation
|
|
129
|
+
*/
|
|
130
|
+
private getNextMarketDayZoned;
|
|
131
|
+
/**
|
|
132
|
+
* Gets the next market day from a reference date.
|
|
133
|
+
* Handles timezone conversion from any input date.
|
|
134
|
+
* @param date - The reference date (any timezone)
|
|
135
|
+
* @returns The next market day as a Date (note: internally represented in market timezone)
|
|
136
|
+
*/
|
|
137
|
+
getNextMarketDay(date: Date): Date;
|
|
138
|
+
private getDayBoundaries;
|
|
139
|
+
private calculatePeriodStartDate;
|
|
140
|
+
getMarketTimePeriod({ period, end, intraday_reporting, outputFormat, }: MarketTimeParams): PeriodDates;
|
|
141
|
+
getMarketOpenClose(options?: {
|
|
142
|
+
date?: Date;
|
|
143
|
+
}): MarketOpenCloseResult;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new MarketTimeUtil instance
|
|
147
|
+
* @param {string} [timezone] - The timezone to use for market time calculations
|
|
148
|
+
* @param {IntradayReporting} [intraday_reporting] - The intraday reporting mode
|
|
149
|
+
* @returns {MarketTimeUtil} A new MarketTimeUtil instance
|
|
150
|
+
*/
|
|
151
|
+
export declare function createMarketTimeUtil(timezone?: string, intraday_reporting?: IntradayReporting): MarketTimeUtil;
|
|
152
|
+
/**
|
|
153
|
+
* Gets start and end timestamps for a given market time period
|
|
154
|
+
* @param {MarketTimeParams} [params] - The market time parameters
|
|
155
|
+
* @returns {PeriodDates} The start and end timestamps
|
|
156
|
+
*/
|
|
157
|
+
export declare function getStartAndEndTimestamps(params?: MarketTimeParams): PeriodDates;
|
|
158
|
+
/**
|
|
159
|
+
* Gets the market open/close times for a given date
|
|
160
|
+
* @param {Object} [options] - Options object
|
|
161
|
+
* @param {Date} [options.date] - The date to check (defaults to current date)
|
|
162
|
+
* @returns {MarketOpenCloseResult} The market open/close times
|
|
163
|
+
*/
|
|
164
|
+
export declare function getMarketOpenClose(options?: {
|
|
165
|
+
date?: Date;
|
|
166
|
+
}): MarketOpenCloseResult;
|
|
167
|
+
/**
|
|
168
|
+
* Gets the start and end dates for a given market time period
|
|
169
|
+
* @param {MarketTimeParams} [params] - The market time parameters
|
|
170
|
+
* @returns {Object} The start and end dates
|
|
171
|
+
* @property {Date} start - The start date
|
|
172
|
+
* @property {Date} end - The end date
|
|
173
|
+
*/
|
|
174
|
+
export declare function getStartAndEndDates(params?: MarketTimeParams): {
|
|
175
|
+
start: Date;
|
|
176
|
+
end: Date;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Gets the last trading date in YYYY-MM-DD format
|
|
180
|
+
* @returns {string} The last trading date in YYYY-MM-DD format
|
|
181
|
+
*/
|
|
182
|
+
export declare function getLastTradingDateYYYYMMDD(): string;
|
|
183
|
+
/**
|
|
184
|
+
* Gets the last full trading date
|
|
185
|
+
* @param {Date} [currentDate] - The current date (defaults to now)
|
|
186
|
+
* @returns {Object} The last full trading date
|
|
187
|
+
* @property {Date} date - The date object
|
|
188
|
+
* @property {string} YYYYMMDD - The date in YYYY-MM-DD format
|
|
189
|
+
*/
|
|
190
|
+
export declare function getLastFullTradingDate(currentDate?: Date): {
|
|
191
|
+
date: Date;
|
|
192
|
+
YYYYMMDD: string;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Gets the next market day from a reference date
|
|
196
|
+
* @param {Object} [options] - Options object
|
|
197
|
+
* @param {Date} [options.referenceDate] - The reference date (defaults to current date)
|
|
198
|
+
* @returns {Object} The next market day information
|
|
199
|
+
* @property {Date} date - The date object (start of day in NY time)
|
|
200
|
+
* @property {string} yyyymmdd - The date in YYYY-MM-DD format
|
|
201
|
+
* @property {string} dateISOString - Full ISO date string
|
|
202
|
+
*/
|
|
203
|
+
export declare function getNextMarketDay({ referenceDate, }?: {
|
|
204
|
+
referenceDate?: Date;
|
|
205
|
+
}): {
|
|
206
|
+
date: Date;
|
|
207
|
+
yyyymmdd: string;
|
|
208
|
+
dateISOString: string;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Gets the current time in Eastern Time
|
|
212
|
+
* @returns {Date} The current time in Eastern Time
|
|
213
|
+
*/
|
|
214
|
+
export declare const currentTimeET: () => Date;
|
|
215
|
+
/**
|
|
216
|
+
* Gets a date in New York timezone, rezoned using date-fns-tz
|
|
217
|
+
* @param {number|string|Date} time - The time to convert
|
|
218
|
+
* @returns {Date} The date in New York timezone
|
|
219
|
+
*/
|
|
220
|
+
export declare function getDateInNY(time: number | string | {
|
|
221
|
+
year: number;
|
|
222
|
+
month: number;
|
|
223
|
+
day: number;
|
|
224
|
+
}): Date;
|
|
225
|
+
/**
|
|
226
|
+
* Gets the trading date in YYYY-MM-DD format for New York timezone, for grouping of data
|
|
227
|
+
* @param {string|number|Date} time - The time to convert (string, unix timestamp in ms, or Date object)
|
|
228
|
+
* @returns {string} The trading date in YYYY-MM-DD format
|
|
229
|
+
*/
|
|
230
|
+
export declare function getTradingDate(time: string | number | Date): string;
|
|
231
|
+
/**
|
|
232
|
+
* Returns the New York timezone offset based on whether daylight savings is active
|
|
233
|
+
* @param dateString - The date string to check
|
|
234
|
+
* @returns "-04:00" during daylight savings (EDT) or "-05:00" during standard time (EST)
|
|
235
|
+
*/
|
|
236
|
+
export declare const getNYTimeZone: (date?: Date) => "-04:00" | "-05:00";
|
|
237
|
+
/**
|
|
238
|
+
* Gets the current market status
|
|
239
|
+
* @param {Object} [options] - Options object
|
|
240
|
+
* @param {Date} [options.date] - The date to check (defaults to current date)
|
|
241
|
+
* @returns {MarketStatus} The current market status
|
|
242
|
+
*/
|
|
243
|
+
export declare function getMarketStatus(options?: {
|
|
244
|
+
date?: Date;
|
|
245
|
+
}): MarketStatus;
|
|
246
|
+
//# sourceMappingURL=market-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market-time.d.ts","sourceRoot":"","sources":["../../src/market-time.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,iBA0B1B,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,iBAAiB,CAAoB;IAE7C;;;;OAIG;gBAED,QAAQ,GAAE,MAA8B,EACxC,iBAAiB,GAAE,iBAAkC;IAOvD;;;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I,KAAG,QAAQ,GAAG,QAyCtD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAO,GAAG,YAAY,CAoH3E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Bar, BenchmarkBar } from "./types/alpaca-types";
|
|
2
|
+
import { types } from "@adaptic/backend-legacy";
|
|
3
|
+
import { CalculateBetaResult, TradeMetrics } from "./types";
|
|
4
|
+
export declare function calculateBetaFromReturns(portfolioReturns: number[], benchmarkReturns: number[]): CalculateBetaResult;
|
|
5
|
+
export default function fetchTradeMetrics(trade: types.Trade, tradeBars: Bar[], benchmarkBars: BenchmarkBar[]): Promise<TradeMetrics>;
|
|
6
|
+
//# sourceMappingURL=metrics-calcs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-calcs.d.ts","sourceRoot":"","sources":["../../src/metrics-calcs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqJ5D,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,gBAAgB,EAAE,MAAM,EAAE,GACzB,mBAAmB,CA0FrB;AA0SD,wBAA8B,iBAAiB,CAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,GAAG,EAAE,EAChB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,YAAY,CAAC,CA+BvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare const LOG_TYPES: readonly ["info", "warn", "error", "debug", "trace"];
|
|
2
|
+
type LogType = (typeof LOG_TYPES)[number];
|
|
3
|
+
/**
|
|
4
|
+
* Debug logging utility that respects environment debug flags.
|
|
5
|
+
* Logs messages to the console based on the specified log level.
|
|
6
|
+
*
|
|
7
|
+
* @param message - The message to log.
|
|
8
|
+
* @param data - Optional data to log alongside the message. This can be any type of data.
|
|
9
|
+
* @param type - Log level. One of: 'info' | 'warn' | 'error' | 'debug' | 'trace'. Defaults to 'info'.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* logIfDebug("User login failed", { userId: 123 }, "error");
|
|
13
|
+
* logIfDebug("Cache miss", undefined, "warn");
|
|
14
|
+
* logIfDebug("Processing request", { requestId: "abc" }, "debug");
|
|
15
|
+
*/
|
|
16
|
+
export declare const logIfDebug: (message: string, data?: unknown, type?: LogType) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Hides (masks) the value of any query parameter that is "apiKey" (case-insensitive),
|
|
19
|
+
* replacing the middle part with **** and keeping only the first 2 and last 2 characters.
|
|
20
|
+
*
|
|
21
|
+
* @param url - The URL containing the query parameters.
|
|
22
|
+
* @returns The URL with the masked API key.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* hideApiKeyFromurl("https://xxx.com/s/23/fdsa/?apiKey=12341239856677");
|
|
26
|
+
* // Returns "https://xxx.com/s/23/fdsa/?apiKey=12****77"
|
|
27
|
+
*/
|
|
28
|
+
export declare function hideApiKeyFromurl(url: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches a resource with intelligent retry logic for handling transient errors.
|
|
31
|
+
* Features enhanced error logging, rate limit detection, and adaptive backoff.
|
|
32
|
+
*
|
|
33
|
+
* This is a wrapper around the new retry utility for backward compatibility.
|
|
34
|
+
* It wraps fetch calls with retry logic using exponential backoff.
|
|
35
|
+
*
|
|
36
|
+
* @param url - The URL to fetch.
|
|
37
|
+
* @param options - Optional fetch options.
|
|
38
|
+
* @param retries - The number of retry attempts. Defaults to 3.
|
|
39
|
+
* @param initialBackoff - The initial backoff time in milliseconds. Defaults to 1000.
|
|
40
|
+
* @returns A promise that resolves to the response.
|
|
41
|
+
*
|
|
42
|
+
* @throws Will throw an error if the fetch fails after the specified number of retries.
|
|
43
|
+
*/
|
|
44
|
+
export declare function fetchWithRetry(url: string, options?: RequestInit, retries?: number, initialBackoff?: number): Promise<Response>;
|
|
45
|
+
/**
|
|
46
|
+
* Validates a Polygon.io API key by making a test request.
|
|
47
|
+
* @param apiKey - The API key to validate.
|
|
48
|
+
* @returns Promise that resolves to true if valid, false otherwise.
|
|
49
|
+
*/
|
|
50
|
+
export declare function validatePolygonApiKey(apiKey: string): Promise<boolean>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=misc-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc-utils.d.ts","sourceRoot":"","sources":["../../src/misc-utils.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,SAAS,sDAAuD,CAAC;AAEvE,KAAK,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GACrB,SAAS,MAAM,EACf,OAAO,OAAO,EACd,OAAM,OAAgB,SAsCvB,CAAC;AAqBF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBrD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,OAAO,GAAE,MAAU,EACnB,cAAc,GAAE,MAAa,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAoDnB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB5E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { PortfolioHistory, PortfolioHistoryResponse, BenchmarkBar, CalculateBetaResult } from "./types/alpaca-types";
|
|
2
|
+
import { PerformanceMetrics, FetchPerformanceMetricsProps } from "./types/metrics-types";
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the alpha, beta, and annualized Alpha of the portfolio compared to a benchmark.
|
|
5
|
+
* @param portfolioHistory - The portfolio history data.
|
|
6
|
+
* @param benchmarkBars - The historical price data of the benchmark.
|
|
7
|
+
* @returns An object containing alpha, beta, and annualized alpha.
|
|
8
|
+
*/
|
|
9
|
+
export declare function calculateAlphaAndBeta(portfolioHistory: PortfolioHistoryResponse, benchmarkBars: BenchmarkBar[]): Promise<{
|
|
10
|
+
alpha: string;
|
|
11
|
+
alphaAnnualized: string;
|
|
12
|
+
beta: string;
|
|
13
|
+
}>;
|
|
14
|
+
interface DrawdownResult {
|
|
15
|
+
maxDrawdownPercentage: string;
|
|
16
|
+
maxDrawdownValue: number;
|
|
17
|
+
peakValue: number;
|
|
18
|
+
troughValue: number;
|
|
19
|
+
peakIndex: number;
|
|
20
|
+
troughIndex: number;
|
|
21
|
+
drawdownPeriod: number;
|
|
22
|
+
recoveryIndex?: number;
|
|
23
|
+
recoveryPeriod?: number;
|
|
24
|
+
currentDrawdownPercentage: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the Maximum Drawdown (MDD) and related metrics from an array of equity values.
|
|
28
|
+
*
|
|
29
|
+
* @param equity - An array of equity values (must contain at least one positive number)
|
|
30
|
+
* @param options - Configuration options for the calculation
|
|
31
|
+
* @returns Object containing drawdown metrics
|
|
32
|
+
* @throws Will throw an error if the input is invalid
|
|
33
|
+
*/
|
|
34
|
+
export declare function calculateDrawdownMetrics(equity: number[], options?: {
|
|
35
|
+
decimals?: number;
|
|
36
|
+
minimumDrawdown?: number;
|
|
37
|
+
}): DrawdownResult;
|
|
38
|
+
/**
|
|
39
|
+
* Simplified version that returns only the maximum drawdown percentage
|
|
40
|
+
* For backward compatibility
|
|
41
|
+
* @param equity - An array of equity values.
|
|
42
|
+
* @param decimals - Number of decimal places for the percentage value.
|
|
43
|
+
* @returns The maximum drawdown percentage as a string.
|
|
44
|
+
*/
|
|
45
|
+
export declare function calculateMaxDrawdown(equity: number[], decimals?: number): string;
|
|
46
|
+
/**
|
|
47
|
+
* Calculates daily log returns for an array of prices.
|
|
48
|
+
* Log returns are preferred for statistical properties.
|
|
49
|
+
* @param prices - Array of prices.
|
|
50
|
+
* @returns Array of daily log returns.
|
|
51
|
+
*/
|
|
52
|
+
export declare function calculateDailyReturns(prices: number[]): number[];
|
|
53
|
+
/**
|
|
54
|
+
* Aligns portfolio and benchmark returns based on matching dates.
|
|
55
|
+
* @param portfolioHistory - The portfolio history data.
|
|
56
|
+
* @param benchmarkBars - The historical price data of the benchmark.
|
|
57
|
+
* @returns An object containing aligned returns arrays.
|
|
58
|
+
*/
|
|
59
|
+
export declare function alignReturnsByDate(portfolioHistory: PortfolioHistory, benchmarkBars: BenchmarkBar[]): {
|
|
60
|
+
alignedPortfolioReturns: number[];
|
|
61
|
+
alignedBenchmarkReturns: number[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Calculates the beta of the portfolio compared to a benchmark.
|
|
65
|
+
* @param portfolioReturns - Array of portfolio returns.
|
|
66
|
+
* @param benchmarkReturns - Array of benchmark returns.
|
|
67
|
+
* @returns An object containing beta and intermediate calculations.
|
|
68
|
+
*/
|
|
69
|
+
export declare function calculateBetaFromReturns(portfolioReturns: number[], benchmarkReturns: number[]): CalculateBetaResult;
|
|
70
|
+
/**
|
|
71
|
+
* Calculates the information ratio of the portfolio compared to a benchmark.
|
|
72
|
+
* @param portfolioHistory - The portfolio history data.
|
|
73
|
+
* @param benchmarkBars - The historical price data of the benchmark.
|
|
74
|
+
* @returns Information ratio as a formatted string.
|
|
75
|
+
*/
|
|
76
|
+
export declare function calculateInformationRatio(portfolioHistory: PortfolioHistoryResponse, benchmarkBars: BenchmarkBar[]): Promise<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Fetches performance metrics for a given Alpaca account.
|
|
79
|
+
* @param params - The parameters for fetching performance metrics.
|
|
80
|
+
* @param client - The Apollo client instance.
|
|
81
|
+
* @param accountId - The ID of the Alpaca account.
|
|
82
|
+
* @param alpacaAccount - The Alpaca account object.
|
|
83
|
+
* @returns A promise that resolves to an object containing various performance metrics.
|
|
84
|
+
* @throws Will throw an error if required parameters are missing or if fetching fails.
|
|
85
|
+
*/
|
|
86
|
+
export declare function fetchPerformanceMetrics({ params, client, accountId, alpacaAccount, }: FetchPerformanceMetricsProps): Promise<PerformanceMetrics>;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=performance-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-metrics.d.ts","sourceRoot":"","sources":["../../src/performance-metrics.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,gBAAgB,EAChB,wBAAwB,EACxB,YAAY,EACZ,mBAAmB,EAKpB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAiU/B;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,wBAAwB,EAC1C,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CA0ND;AAkCD,UAAU,cAAc;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CACrB,GACL,cAAc,CAuHhB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,GAAE,MAAU,GACnB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAchE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,YAAY,EAAE,GAC5B;IAAE,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAAC,uBAAuB,EAAE,MAAM,EAAE,CAAA;CAAE,CA4E1E;AAkFD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,gBAAgB,EAAE,MAAM,EAAE,GACzB,mBAAmB,CAsDrB;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,gBAAgB,EAAE,wBAAwB,EAC1C,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,CA8GjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,MAAM,EACN,MAAM,EACN,SAAS,EACT,aAAa,GACd,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwK5D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polygon Indices API Implementation
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions to interact with the Polygon.io Indices API.
|
|
5
|
+
*/
|
|
6
|
+
import { PolygonIndicesAggregatesParams, PolygonIndicesAggregatesResponse, PolygonIndicesPrevCloseResponse, PolygonIndicesDailyOpenCloseResponse, PolygonIndicesSnapshotParams, PolygonIndicesSnapshotResponse } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Fetches aggregate bars for an index over a given date range in custom time window sizes.
|
|
9
|
+
*
|
|
10
|
+
* @param {PolygonIndicesAggregatesParams} params - Parameters for the aggregates request
|
|
11
|
+
* @param {Object} [options] - Optional parameters
|
|
12
|
+
* @param {string} [options.apiKey] - API key to use for the request
|
|
13
|
+
* @returns {Promise<PolygonIndicesAggregatesResponse>} The aggregates response
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchIndicesAggregates: (params: PolygonIndicesAggregatesParams, options?: {
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
}) => Promise<PolygonIndicesAggregatesResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the previous day's open, high, low, and close (OHLC) for the specified index.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} indicesTicker - The ticker symbol of the index
|
|
22
|
+
* @param {Object} [options] - Optional parameters
|
|
23
|
+
* @param {string} [options.apiKey] - API key to use for the request
|
|
24
|
+
* @returns {Promise<PolygonIndicesPrevCloseResponse>} The previous close response
|
|
25
|
+
*/
|
|
26
|
+
export declare const fetchIndicesPreviousClose: (indicesTicker: string, options?: {
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
}) => Promise<PolygonIndicesPrevCloseResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the open, close and afterhours values of an index symbol on a certain date.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} indicesTicker - The ticker symbol of the index
|
|
33
|
+
* @param {string} date - The date in YYYY-MM-DD format
|
|
34
|
+
* @param {Object} [options] - Optional parameters
|
|
35
|
+
* @param {string} [options.apiKey] - API key to use for the request
|
|
36
|
+
* @returns {Promise<PolygonIndicesDailyOpenCloseResponse>} The daily open/close response
|
|
37
|
+
*/
|
|
38
|
+
export declare const fetchIndicesDailyOpenClose: (indicesTicker: string, date: string, options?: {
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
}) => Promise<PolygonIndicesDailyOpenCloseResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets a snapshot of indices data for specified tickers.
|
|
43
|
+
*
|
|
44
|
+
* @param {PolygonIndicesSnapshotParams} [params] - Parameters for the snapshot request
|
|
45
|
+
* @param {Object} [options] - Optional parameters
|
|
46
|
+
* @param {string} [options.apiKey] - API key to use for the request
|
|
47
|
+
* @returns {Promise<PolygonIndicesSnapshotResponse>} The indices snapshot response
|
|
48
|
+
*/
|
|
49
|
+
export declare const fetchIndicesSnapshot: (params?: PolygonIndicesSnapshotParams, options?: {
|
|
50
|
+
apiKey?: string;
|
|
51
|
+
}) => Promise<PolygonIndicesSnapshotResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets snapshots for assets of all types, including indices.
|
|
54
|
+
*
|
|
55
|
+
* @param {string[]} tickers - Array of tickers to fetch snapshots for
|
|
56
|
+
* @param {Object} [options] - Optional parameters
|
|
57
|
+
* @param {string} [options.apiKey] - API key to use for the request
|
|
58
|
+
* @param {string} [options.type] - Filter by asset type
|
|
59
|
+
* @param {string} [options.order] - Order results
|
|
60
|
+
* @param {number} [options.limit] - Limit the number of results
|
|
61
|
+
* @param {string} [options.sort] - Sort field
|
|
62
|
+
* @returns {Promise<PolygonIndicesSnapshotResponse>} The universal snapshot response
|
|
63
|
+
*/
|
|
64
|
+
export declare const fetchUniversalSnapshot: (tickers: string[], options?: {
|
|
65
|
+
apiKey?: string;
|
|
66
|
+
type?: string;
|
|
67
|
+
order?: string;
|
|
68
|
+
limit?: number;
|
|
69
|
+
sort?: string;
|
|
70
|
+
}) => Promise<PolygonIndicesSnapshotResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Converts Polygon Indices bar data to a more standardized format
|
|
73
|
+
*
|
|
74
|
+
* @param {PolygonIndicesAggregatesResponse} data - The raw aggregates response
|
|
75
|
+
* @returns {Array<{date: string, open: number, high: number, low: number, close: number, timestamp: number}>} Formatted bar data
|
|
76
|
+
*/
|
|
77
|
+
export declare const formatIndicesBarData: (data: PolygonIndicesAggregatesResponse) => Array<{
|
|
78
|
+
date: string;
|
|
79
|
+
open: number;
|
|
80
|
+
high: number;
|
|
81
|
+
low: number;
|
|
82
|
+
close: number;
|
|
83
|
+
timestamp: number;
|
|
84
|
+
}>;
|
|
85
|
+
//# sourceMappingURL=polygon-indices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon-indices.d.ts","sourceRoot":"","sources":["../../src/polygon-indices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,+BAA+B,EAC/B,oCAAoC,EACpC,4BAA4B,EAC5B,8BAA8B,EAE/B,MAAM,SAAS,CAAC;AAyBjB;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,8BAA8B,EACtC,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,gCAAgC,CA6C1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,eAAe,MAAM,EACrB,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,+BAA+B,CA2BzC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACrC,eAAe,MAAM,EACrB,MAAM,MAAM,EACZ,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,oCAAoC,CA2B9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,4BAA4B,EACrC,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,8BAA8B,CAyCxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EAAE,EACjB,UAAU;IACR,MAAM,CAAC,EAAE,MA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