@adaptic/utils 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +153 -61
  2. package/dist/index.cjs +10383 -3818
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.mjs +10309 -3819
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/test.js +733 -383
  7. package/dist/test.js.map +1 -1
  8. package/dist/types/__tests__/alpaca-functions.test.d.ts +2 -0
  9. package/dist/types/__tests__/alpaca-functions.test.d.ts.map +1 -0
  10. package/dist/types/__tests__/api-endpoints.test.d.ts +2 -0
  11. package/dist/types/__tests__/api-endpoints.test.d.ts.map +1 -0
  12. package/dist/types/__tests__/asset-allocation.test.d.ts +2 -0
  13. package/dist/types/__tests__/asset-allocation.test.d.ts.map +1 -0
  14. package/dist/types/__tests__/auth-validator.test.d.ts +2 -0
  15. package/dist/types/__tests__/auth-validator.test.d.ts.map +1 -0
  16. package/dist/types/__tests__/cache.test.d.ts +2 -0
  17. package/dist/types/__tests__/cache.test.d.ts.map +1 -0
  18. package/dist/types/__tests__/errors.test.d.ts +2 -0
  19. package/dist/types/__tests__/errors.test.d.ts.map +1 -0
  20. package/dist/types/__tests__/financial-regression.test.d.ts +2 -0
  21. package/dist/types/__tests__/financial-regression.test.d.ts.map +1 -0
  22. package/dist/types/__tests__/format-tools.test.d.ts +2 -0
  23. package/dist/types/__tests__/format-tools.test.d.ts.map +1 -0
  24. package/dist/types/__tests__/http-keep-alive.test.d.ts +2 -0
  25. package/dist/types/__tests__/http-keep-alive.test.d.ts.map +1 -0
  26. package/dist/types/__tests__/http-timeout.test.d.ts +2 -0
  27. package/dist/types/__tests__/http-timeout.test.d.ts.map +1 -0
  28. package/dist/types/__tests__/logger.test.d.ts +2 -0
  29. package/dist/types/__tests__/logger.test.d.ts.map +1 -0
  30. package/dist/types/__tests__/market-time.test.d.ts +2 -0
  31. package/dist/types/__tests__/market-time.test.d.ts.map +1 -0
  32. package/dist/types/__tests__/misc-utils.test.d.ts +2 -0
  33. package/dist/types/__tests__/misc-utils.test.d.ts.map +1 -0
  34. package/dist/types/__tests__/paginator.test.d.ts +2 -0
  35. package/dist/types/__tests__/paginator.test.d.ts.map +1 -0
  36. package/dist/types/__tests__/performance-metrics.test.d.ts +2 -0
  37. package/dist/types/__tests__/performance-metrics.test.d.ts.map +1 -0
  38. package/dist/types/__tests__/polygon.test.d.ts +2 -0
  39. package/dist/types/__tests__/polygon.test.d.ts.map +1 -0
  40. package/dist/types/__tests__/price-utils.test.d.ts +2 -0
  41. package/dist/types/__tests__/price-utils.test.d.ts.map +1 -0
  42. package/dist/types/__tests__/property-based-financial.test.d.ts +2 -0
  43. package/dist/types/__tests__/property-based-financial.test.d.ts.map +1 -0
  44. package/dist/types/__tests__/rate-limiter.test.d.ts +2 -0
  45. package/dist/types/__tests__/rate-limiter.test.d.ts.map +1 -0
  46. package/dist/types/__tests__/schema-validation.test.d.ts +2 -0
  47. package/dist/types/__tests__/schema-validation.test.d.ts.map +1 -0
  48. package/dist/types/__tests__/technical-analysis.test.d.ts +2 -0
  49. package/dist/types/__tests__/technical-analysis.test.d.ts.map +1 -0
  50. package/dist/types/__tests__/time-utils.test.d.ts +2 -0
  51. package/dist/types/__tests__/time-utils.test.d.ts.map +1 -0
  52. package/dist/types/adaptic.d.ts +2 -2
  53. package/dist/types/adaptic.d.ts.map +1 -1
  54. package/dist/types/alpaca/client.d.ts +4 -4
  55. package/dist/types/alpaca/client.d.ts.map +1 -1
  56. package/dist/types/alpaca/crypto/data.d.ts +5 -5
  57. package/dist/types/alpaca/crypto/data.d.ts.map +1 -1
  58. package/dist/types/alpaca/crypto/index.d.ts +2 -2
  59. package/dist/types/alpaca/crypto/orders.d.ts +2 -2
  60. package/dist/types/alpaca/crypto/orders.d.ts.map +1 -1
  61. package/dist/types/alpaca/index.d.ts +36 -34
  62. package/dist/types/alpaca/index.d.ts.map +1 -1
  63. package/dist/types/alpaca/legacy/account.d.ts +34 -0
  64. package/dist/types/alpaca/legacy/account.d.ts.map +1 -0
  65. package/dist/types/alpaca/legacy/assets.d.ts +13 -0
  66. package/dist/types/alpaca/legacy/assets.d.ts.map +1 -0
  67. package/dist/types/alpaca/legacy/auth.d.ts +18 -0
  68. package/dist/types/alpaca/legacy/auth.d.ts.map +1 -0
  69. package/dist/types/alpaca/legacy/index.d.ts +15 -0
  70. package/dist/types/alpaca/legacy/index.d.ts.map +1 -0
  71. package/dist/types/alpaca/legacy/market-data.d.ts +32 -0
  72. package/dist/types/alpaca/legacy/market-data.d.ts.map +1 -0
  73. package/dist/types/alpaca/legacy/orders.d.ts +84 -0
  74. package/dist/types/alpaca/legacy/orders.d.ts.map +1 -0
  75. package/dist/types/alpaca/legacy/positions.d.ts +66 -0
  76. package/dist/types/alpaca/legacy/positions.d.ts.map +1 -0
  77. package/dist/types/alpaca/legacy/utils.d.ts +18 -0
  78. package/dist/types/alpaca/legacy/utils.d.ts.map +1 -0
  79. package/dist/types/alpaca/market-data/bars.d.ts +4 -4
  80. package/dist/types/alpaca/market-data/bars.d.ts.map +1 -1
  81. package/dist/types/alpaca/market-data/index.d.ts +8 -8
  82. package/dist/types/alpaca/market-data/news.d.ts +3 -3
  83. package/dist/types/alpaca/market-data/news.d.ts.map +1 -1
  84. package/dist/types/alpaca/market-data/quotes.d.ts +2 -2
  85. package/dist/types/alpaca/market-data/quotes.d.ts.map +1 -1
  86. package/dist/types/alpaca/market-data/trades.d.ts +2 -2
  87. package/dist/types/alpaca/market-data/trades.d.ts.map +1 -1
  88. package/dist/types/alpaca/options/contracts.d.ts +2 -2
  89. package/dist/types/alpaca/options/contracts.d.ts.map +1 -1
  90. package/dist/types/alpaca/options/data.d.ts +5 -5
  91. package/dist/types/alpaca/options/data.d.ts.map +1 -1
  92. package/dist/types/alpaca/options/index.d.ts +12 -12
  93. package/dist/types/alpaca/options/index.d.ts.map +1 -1
  94. package/dist/types/alpaca/options/orders.d.ts +4 -4
  95. package/dist/types/alpaca/options/orders.d.ts.map +1 -1
  96. package/dist/types/alpaca/options/strategies.d.ts +9 -9
  97. package/dist/types/alpaca/options/strategies.d.ts.map +1 -1
  98. package/dist/types/alpaca/streams/base-stream.d.ts +5 -5
  99. package/dist/types/alpaca/streams/base-stream.d.ts.map +1 -1
  100. package/dist/types/alpaca/streams/crypto-stream.d.ts +5 -5
  101. package/dist/types/alpaca/streams/crypto-stream.d.ts.map +1 -1
  102. package/dist/types/alpaca/streams/index.d.ts +6 -6
  103. package/dist/types/alpaca/streams/option-stream.d.ts +5 -5
  104. package/dist/types/alpaca/streams/option-stream.d.ts.map +1 -1
  105. package/dist/types/alpaca/streams/stock-stream.d.ts +5 -5
  106. package/dist/types/alpaca/streams/stock-stream.d.ts.map +1 -1
  107. package/dist/types/alpaca/streams/stream-manager.d.ts +16 -16
  108. package/dist/types/alpaca/streams/stream-manager.d.ts.map +1 -1
  109. package/dist/types/alpaca/streams/trading-stream.d.ts +28 -28
  110. package/dist/types/alpaca/streams/trading-stream.d.ts.map +1 -1
  111. package/dist/types/alpaca/streams.d.ts +2 -2
  112. package/dist/types/alpaca/streams.d.ts.map +1 -1
  113. package/dist/types/alpaca/trading/account.d.ts +2 -2
  114. package/dist/types/alpaca/trading/account.d.ts.map +1 -1
  115. package/dist/types/alpaca/trading/bracket-orders.d.ts +3 -3
  116. package/dist/types/alpaca/trading/bracket-orders.d.ts.map +1 -1
  117. package/dist/types/alpaca/trading/index.d.ts +12 -12
  118. package/dist/types/alpaca/trading/oco-orders.d.ts +2 -2
  119. package/dist/types/alpaca/trading/oco-orders.d.ts.map +1 -1
  120. package/dist/types/alpaca/trading/order-utils.d.ts +9 -9
  121. package/dist/types/alpaca/trading/order-utils.d.ts.map +1 -1
  122. package/dist/types/alpaca/trading/orders.d.ts +2 -2
  123. package/dist/types/alpaca/trading/orders.d.ts.map +1 -1
  124. package/dist/types/alpaca/trading/oto-orders.d.ts +3 -3
  125. package/dist/types/alpaca/trading/oto-orders.d.ts.map +1 -1
  126. package/dist/types/alpaca/trading/positions.d.ts +3 -3
  127. package/dist/types/alpaca/trading/positions.d.ts.map +1 -1
  128. package/dist/types/alpaca/trading/smart-orders.d.ts +12 -12
  129. package/dist/types/alpaca/trading/smart-orders.d.ts.map +1 -1
  130. package/dist/types/alpaca/trading/trailing-stops.d.ts +2 -2
  131. package/dist/types/alpaca/trading/trailing-stops.d.ts.map +1 -1
  132. package/dist/types/alpaca-market-data-api.d.ts +12 -10
  133. package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
  134. package/dist/types/alpaca-trading-api.d.ts +12 -12
  135. package/dist/types/alpaca-trading-api.d.ts.map +1 -1
  136. package/dist/types/alphavantage.d.ts +1 -1
  137. package/dist/types/alphavantage.d.ts.map +1 -1
  138. package/dist/types/asset-allocation-algorithm.d.ts +7 -1
  139. package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
  140. package/dist/types/cache/stampede-protected-cache.d.ts.map +1 -1
  141. package/dist/types/config/api-endpoints.d.ts +94 -0
  142. package/dist/types/config/api-endpoints.d.ts.map +1 -0
  143. package/dist/types/crypto.d.ts +2 -2
  144. package/dist/types/crypto.d.ts.map +1 -1
  145. package/dist/types/display-manager.d.ts +1 -1
  146. package/dist/types/display-manager.d.ts.map +1 -1
  147. package/dist/types/errors/index.d.ts +130 -0
  148. package/dist/types/errors/index.d.ts.map +1 -0
  149. package/dist/types/examples/asset-allocation-example.d.ts +7 -6
  150. package/dist/types/examples/asset-allocation-example.d.ts.map +1 -1
  151. package/dist/types/examples/rate-limiter-example.d.ts +7 -0
  152. package/dist/types/examples/rate-limiter-example.d.ts.map +1 -0
  153. package/dist/types/format-tools.d.ts.map +1 -1
  154. package/dist/types/http-timeout.d.ts +37 -0
  155. package/dist/types/http-timeout.d.ts.map +1 -0
  156. package/dist/types/index.d.ts +59 -72
  157. package/dist/types/index.d.ts.map +1 -1
  158. package/dist/types/logger.d.ts +56 -0
  159. package/dist/types/logger.d.ts.map +1 -0
  160. package/dist/types/logging.d.ts +1 -1
  161. package/dist/types/logging.d.ts.map +1 -1
  162. package/dist/types/market-hours.d.ts.map +1 -1
  163. package/dist/types/market-time.d.ts +75 -13
  164. package/dist/types/market-time.d.ts.map +1 -1
  165. package/dist/types/metrics-calcs.d.ts.map +1 -1
  166. package/dist/types/misc-utils.d.ts +4 -1
  167. package/dist/types/misc-utils.d.ts.map +1 -1
  168. package/dist/types/performance-metrics.d.ts +4 -4
  169. package/dist/types/performance-metrics.d.ts.map +1 -1
  170. package/dist/types/polygon-indices.d.ts +3 -3
  171. package/dist/types/polygon-indices.d.ts.map +1 -1
  172. package/dist/types/polygon.d.ts +1 -1
  173. package/dist/types/polygon.d.ts.map +1 -1
  174. package/dist/types/price-utils.d.ts.map +1 -1
  175. package/dist/types/rate-limiter.d.ts +171 -0
  176. package/dist/types/rate-limiter.d.ts.map +1 -0
  177. package/dist/types/schemas/alpaca-schemas.d.ts +779 -0
  178. package/dist/types/schemas/alpaca-schemas.d.ts.map +1 -0
  179. package/dist/types/schemas/alphavantage-schemas.d.ts +255 -0
  180. package/dist/types/schemas/alphavantage-schemas.d.ts.map +1 -0
  181. package/dist/types/schemas/index.d.ts +21 -0
  182. package/dist/types/schemas/index.d.ts.map +1 -0
  183. package/dist/types/schemas/polygon-schemas.d.ts +551 -0
  184. package/dist/types/schemas/polygon-schemas.d.ts.map +1 -0
  185. package/dist/types/schemas/validate-response.d.ts +88 -0
  186. package/dist/types/schemas/validate-response.d.ts.map +1 -0
  187. package/dist/types/technical-analysis.d.ts +9 -9
  188. package/dist/types/technical-analysis.d.ts.map +1 -1
  189. package/dist/types/time-utils.d.ts.map +1 -1
  190. package/dist/types/types/adaptic-types.d.ts +1 -1
  191. package/dist/types/types/adaptic-types.d.ts.map +1 -1
  192. package/dist/types/types/alpaca-types.d.ts +172 -98
  193. package/dist/types/types/alpaca-types.d.ts.map +1 -1
  194. package/dist/types/types/alphavantage-types.d.ts +2 -2
  195. package/dist/types/types/asset-allocation-types.d.ts +11 -11
  196. package/dist/types/types/index.d.ts +8 -8
  197. package/dist/types/types/index.d.ts.map +1 -1
  198. package/dist/types/types/logging-types.d.ts +2 -2
  199. package/dist/types/types/logging-types.d.ts.map +1 -1
  200. package/dist/types/types/market-time-types.d.ts +4 -4
  201. package/dist/types/types/market-time-types.d.ts.map +1 -1
  202. package/dist/types/types/metrics-types.d.ts +3 -3
  203. package/dist/types/types/metrics-types.d.ts.map +1 -1
  204. package/dist/types/types/polygon-indices-types.d.ts +6 -6
  205. package/dist/types/types/polygon-types.d.ts +3 -3
  206. package/dist/types/types/ta-types.d.ts +3 -3
  207. package/dist/types/utils/auth-validator.d.ts +32 -0
  208. package/dist/types/utils/auth-validator.d.ts.map +1 -0
  209. package/dist/types/utils/http-keep-alive.d.ts +110 -0
  210. package/dist/types/utils/http-keep-alive.d.ts.map +1 -0
  211. package/dist/types/utils/paginator.d.ts +154 -0
  212. package/dist/types/utils/paginator.d.ts.map +1 -0
  213. package/dist/types/utils/retry.d.ts +78 -0
  214. package/dist/types/utils/retry.d.ts.map +1 -0
  215. package/package.json +22 -5
  216. package/dist/types/alpaca-functions.d.ts +0 -233
  217. package/dist/types/alpaca-functions.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { CryptoBarsParams, CryptoBar, AlpacaNewsArticle, LatestTradesResponse, LatestQuotesResponse } from './types/alpaca-types.js';
1
+ import type { CryptoBarsParams, CryptoBar, AlpacaNewsArticle, LatestTradesResponse, LatestQuotesResponse } from "./types/alpaca-types.js";
2
2
  /**
3
3
  * Fetches cryptocurrency bars for the specified parameters.
4
4
  * This function retrieves historical price data for multiple cryptocurrencies.
@@ -19,7 +19,7 @@ export declare function fetchBars(params: CryptoBarsParams): Promise<{
19
19
  type AlpacaAuth = {
20
20
  APIKey: string;
21
21
  APISecret: string;
22
- type?: 'PAPER' | 'LIVE';
22
+ type?: "PAPER" | "LIVE";
23
23
  };
24
24
  /**
25
25
  * Fetches news articles related to a specific cryptocurrency sym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,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAQjC;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CAAA;CAAE,CAAC,CA8E5C;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAqG9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,EACD,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,oBAAoB,CAAC,CA+C/B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,EACD,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,oBAAoB,CAAC,CA+C/B"}
@@ -1,4 +1,4 @@
1
- import { LogOptions } from './types/logging-types';
1
+ import { LogOptions } from "./types/logging-types";
2
2
  export declare class DisplayManager {
3
3
  private static instance;
4
4
  private promptText;
@@ -1 +1 @@
1
- {"version":3,"file":"display-manager.d.ts","sourceRoot":"","sources":["../../src/display-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACxC,OAAO,CAAC,UAAU,CAAc;IAEhC,OAAO;WAEO,WAAW,IAAI,cAAc;IAOpC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAItC;;OAEG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAqCvD;;OAEG;IACH,OAAO,CAAC,cAAc;IA2BtB;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,WAAW;IAIZ,WAAW,IAAI,IAAI;IAKnB,aAAa,IAAI,IAAI;CAG7B"}
1
+ {"version":3,"file":"display-manager.d.ts","sourceRoot":"","sources":["../../src/display-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACxC,OAAO,CAAC,UAAU,CAAc;IAEhC,OAAO;WAEO,WAAW,IAAI,cAAc;IAOpC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAItC;;OAEG;IACI,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAuCvD;;OAEG;IACH,OAAO,CAAC,cAAc;IAgCtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAiCvB,OAAO,CAAC,WAAW;IAIZ,WAAW,IAAI,IAAI;IAKnB,aAAa,IAAI,IAAI;CAG7B"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Structured error type hierarchy for all API integrations
3
+ *
4
+ * This module provides a comprehensive error handling system for external API integrations,
5
+ * including Alpaca, Polygon, and AlphaVantage services.
6
+ */
7
+ /**
8
+ * Base error class for all @adaptic/utils errors
9
+ * Extends Error with additional context about service, error code, and retry capability
10
+ */
11
+ export declare class AdapticUtilsError extends Error {
12
+ readonly code: string;
13
+ readonly service: string;
14
+ readonly isRetryable: boolean;
15
+ readonly cause?: unknown | undefined;
16
+ readonly name: string;
17
+ constructor(message: string, code: string, service: string, isRetryable?: boolean, cause?: unknown | undefined);
18
+ }
19
+ /**
20
+ * Alpaca API specific errors
21
+ * Handles all errors from Alpaca trading and market data APIs
22
+ */
23
+ export declare class AlpacaApiError extends AdapticUtilsError {
24
+ readonly statusCode?: number | undefined;
25
+ constructor(message: string, code: string, statusCode?: number | undefined, cause?: unknown);
26
+ }
27
+ /**
28
+ * Polygon.io API specific errors
29
+ * Handles all errors from Polygon market data API
30
+ */
31
+ export declare class PolygonApiError extends AdapticUtilsError {
32
+ readonly statusCode?: number | undefined;
33
+ constructor(message: string, code: string, statusCode?: number | undefined, cause?: unknown);
34
+ }
35
+ /**
36
+ * AlphaVantage API specific errors
37
+ * Handles all errors from AlphaVantage financial data API
38
+ */
39
+ export declare class AlphaVantageError extends AdapticUtilsError {
40
+ readonly statusCode?: number | undefined;
41
+ constructor(message: string, code: string, statusCode?: number | undefined, cause?: unknown);
42
+ }
43
+ /**
44
+ * Network timeout errors
45
+ * Used when API requests exceed configured timeout limits
46
+ * Always retryable as timeouts are often transient
47
+ */
48
+ export declare class TimeoutError extends AdapticUtilsError {
49
+ readonly service: string;
50
+ readonly timeoutMs: number;
51
+ constructor(message: string, service: string, timeoutMs: number, cause?: unknown);
52
+ }
53
+ /**
54
+ * Input validation errors
55
+ * Used when function inputs fail validation checks
56
+ * Never retryable as the inputs need to be corrected
57
+ */
58
+ export declare class ValidationError extends AdapticUtilsError {
59
+ readonly service: string;
60
+ readonly invalidField?: string | undefined;
61
+ constructor(message: string, service: string, invalidField?: string | undefined, cause?: unknown);
62
+ }
63
+ /**
64
+ * Authentication and authorization errors
65
+ * Used when API credentials are invalid, expired, or lack permissions
66
+ * Never retryable as credentials need to be updated
67
+ */
68
+ export declare class AuthenticationError extends AdapticUtilsError {
69
+ readonly service: string;
70
+ readonly statusCode?: number | undefined;
71
+ constructor(message: string, service: string, statusCode?: number | undefined, cause?: unknown);
72
+ }
73
+ /**
74
+ * HTTP client errors (4xx)
75
+ * Used for client-side errors that are not authentication or validation related
76
+ * Generally not retryable unless specific status codes indicate otherwise
77
+ */
78
+ export declare class HttpClientError extends AdapticUtilsError {
79
+ readonly service: string;
80
+ readonly statusCode: number;
81
+ constructor(message: string, service: string, statusCode: number, cause?: unknown);
82
+ }
83
+ /**
84
+ * HTTP server errors (5xx)
85
+ * Used for server-side errors from external APIs
86
+ * Always retryable as server issues are often transient
87
+ */
88
+ export declare class HttpServerError extends AdapticUtilsError {
89
+ readonly service: string;
90
+ readonly statusCode: number;
91
+ constructor(message: string, service: string, statusCode: number, cause?: unknown);
92
+ }
93
+ /**
94
+ * Rate limit errors (429)
95
+ * Used when API rate limits are exceeded
96
+ * Always retryable, often with retry-after header information
97
+ */
98
+ export declare class RateLimitError extends AdapticUtilsError {
99
+ readonly service: string;
100
+ readonly retryAfterMs?: number | undefined;
101
+ constructor(message: string, service: string, retryAfterMs?: number | undefined, cause?: unknown);
102
+ }
103
+ /**
104
+ * WebSocket connection errors
105
+ * Used for WebSocket-specific connection and communication failures
106
+ * Retryability depends on the specific error condition
107
+ */
108
+ export declare class WebSocketError extends AdapticUtilsError {
109
+ readonly service: string;
110
+ constructor(message: string, service: string, isRetryable?: boolean, cause?: unknown);
111
+ }
112
+ /**
113
+ * Network errors (connection failures, DNS issues, etc.)
114
+ * Used for low-level network failures
115
+ * Always retryable as network issues are often transient
116
+ */
117
+ export declare class NetworkError extends AdapticUtilsError {
118
+ readonly service: string;
119
+ constructor(message: string, service: string, cause?: unknown);
120
+ }
121
+ /**
122
+ * Data parsing and format errors
123
+ * Used when API responses cannot be parsed or are in unexpected format
124
+ * Not retryable as the data format issue needs investigation
125
+ */
126
+ export declare class DataFormatError extends AdapticUtilsError {
127
+ readonly service: string;
128
+ constructor(message: string, service: string, cause?: unknown);
129
+ }
130
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;aAKxB,IAAI,EAAE,MAAM;aACZ,OAAO,EAAE,MAAM;aACf,WAAW,EAAE,OAAO;aACpB,KAAK,CAAC,EAAE,OAAO;IAPjC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,OAAe,EAC5B,KAAK,CAAC,EAAE,OAAO,YAAA;CAUlC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;aAIjC,UAAU,CAAC,EAAE,MAAM;gBAFnC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACI,UAAU,CAAC,EAAE,MAAM,YAAA,EACnC,KAAK,CAAC,EAAE,OAAO;CAOlB;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;aAIlC,UAAU,CAAC,EAAE,MAAM;gBAFnC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACI,UAAU,CAAC,EAAE,MAAM,YAAA,EACnC,KAAK,CAAC,EAAE,OAAO;CAOlB;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,iBAAiB;aAIpC,UAAU,CAAC,EAAE,MAAM;gBAFnC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACI,UAAU,CAAC,EAAE,MAAM,YAAA,EACnC,KAAK,CAAC,EAA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MAAM,EACf,YAAY,CAAC,EAAE,MAAM,YAAA,EACrC,KAAK,CAAC,EAAE,OAAO;CAUlB;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;aAGjC,OAAO,EAAE,MAAM;gBAD/B,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,MAAM,EAC/B,WAAW,GAAE,OAAc,EAC3B,KAAK,CAAC,EAAE,OAAO;CAIlB;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,iBAAiB;aAG/B,OAAO,EAAE,MAAM;gBAD/B,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,MAAM,EAC/B,KAAK,CAAC,EAAE,OAAO;CAUlB;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;aAGlC,OAAO,EAAE,MAAM;gBAD/B,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,MAAM,EAC/B,KAAK,CAAC,EAAE,OAAO;CAUlB"}
@@ -4,30 +4,31 @@
4
4
  * Demonstrates practical usage of the asset allocation engine
5
5
  * with real-world scenarios and best practices.
6
6
  */
7
+ import { type AllocationRecommendation } from "../index";
7
8
  /**
8
9
  * Example 1: Basic Conservative Portfolio for Retirement
9
10
  */
10
- export declare function conservativeRetirementPortfolio(): Promise<import("../index").AllocationRecommendation>;
11
+ export declare function conservativeRetirementPortfolio(): Promise<AllocationRecommendation>;
11
12
  /**
12
13
  * Example 2: Aggressive Growth Portfolio for Young Investor
13
14
  */
14
- export declare function aggressiveGrowthPortfolio(): Promise<import("../index").AllocationRecommendation>;
15
+ export declare function aggressiveGrowthPortfolio(): Promise<AllocationRecommendation>;
15
16
  /**
16
17
  * Example 3: Rebalancing an Existing Portfolio
17
18
  */
18
- export declare function rebalancePortfolio(): Promise<import("../index").AllocationRecommendation>;
19
+ export declare function rebalancePortfolio(): Promise<AllocationRecommendation>;
19
20
  /**
20
21
  * Example 4: Crisis Mode Allocation
21
22
  */
22
- export declare function crisisModePortfolio(): Promise<import("../index").AllocationRecommendation>;
23
+ export declare function crisisModePortfolio(): Promise<AllocationRecommendation>;
23
24
  /**
24
25
  * Example 5: Risk Parity Portfolio
25
26
  */
26
- export declare function riskParityPortfolio(): Promise<import("../index").AllocationRecommendation>;
27
+ export declare function riskParityPortfolio(): Promise<AllocationRecommendation>;
27
28
  /**
28
29
  * Example 6: Small Account Allocation
29
30
  */
30
- export declare function smallAccountPortfolio(): Promise<import("../index").AllocationRecommendation>;
31
+ export declare function smallAccountPortfolio(): Promise<AllocationRecommendation>;
31
32
  /**
32
33
  * Run all examples
33
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"asset-allocation-example.d.ts","sourceRoot":"","sources":["../../../src/examples/asset-allocation-example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;GAEG;AACH,wBAAsB,+BAA+B,yDAiKpD;AAED;;GAEG;AACH,wBAAsB,yBAAyB,yDA4C9C;AAED;;GAEG;AACH,wBAAsB,kBAAkB,yDAsEvC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,yDAwDxC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,yDAgDxC;AAED;;GAEG;AACH,wBAAsB,qBAAqB,yDAwC1C;AAwJD;;GAEG;AACH,wBAAsB,cAAc,kBAOnC"}
1
+ {"version":3,"file":"asset-allocation-example.d.ts","sourceRoot":"","sources":["../../../src/examples/asset-allocation-example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAWL,KAAK,wBAAwB,EAC9B,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAsB,+BAA+B,sCAyKpD;AAED;;GAEG;AACH,wBAAsB,yBAAyB,sCA6C9C;AAED;;GAEG;AACH,wBAAsB,kBAAkB,sCAiFvC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,sCAyDxC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,sCAmDxC;AAED;;GAEG;AACH,wBAAsB,qBAAqB,sCAyC1C;AAkLD;;GAEG;AACH,wBAAsB,cAAc,kBAOnC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Rate Limiter Usage Examples
3
+ *
4
+ * Demonstrates how to use the TokenBucketRateLimiter for various API integrations
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=rate-limiter-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limiter-example.d.ts","sourceRoot":"","sources":["../../../src/examples/rate-limiter-example.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-tools.d.ts","sourceRoot":"","sources":["../../src/format-tools.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,MAAU,GAAG,MAAM,CAQjF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAYhD"}
1
+ {"version":3,"file":"format-tools.d.ts","sourceRoot":"","sources":["../../src/format-tools.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,aAAa,GAAE,MAAU,GACxB,MAAM,CAQR;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAYhD"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * HTTP request timeout utilities
3
+ * Provides configurable timeout handling for external API calls
4
+ */
5
+ /**
6
+ * Default timeout values for different external APIs (in milliseconds)
7
+ * Can be overridden via environment variables
8
+ */
9
+ export declare const DEFAULT_TIMEOUTS: {
10
+ readonly ALPACA_API: number;
11
+ readonly POLYGON_API: number;
12
+ readonly ALPHA_VANTAGE: number;
13
+ readonly GENERAL: number;
14
+ };
15
+ /**
16
+ * Wraps a promise with a timeout
17
+ * @param promise - The promise to wrap with timeout
18
+ * @param ms - Timeout duration in milliseconds
19
+ * @param label - Label for error messages to identify the request
20
+ * @returns Promise that rejects if timeout is exceeded
21
+ * @throws Error if the promise takes longer than the specified timeout
22
+ */
23
+ export declare function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T>;
24
+ /**
25
+ * Creates an AbortSignal that times out after the specified duration
26
+ * Compatible with fetch API
27
+ * @param ms - Timeout duration in milliseconds
28
+ * @returns AbortSignal that will abort after the specified duration
29
+ */
30
+ export declare function createTimeoutSignal(ms: number): AbortSignal;
31
+ /**
32
+ * Get the appropriate timeout value for a given API
33
+ * @param api - The API type to get timeout for
34
+ * @returns Timeout value in milliseconds
35
+ */
36
+ export declare function getTimeout(api: keyof typeof DEFAULT_TIMEOUTS): number;
37
+ //# sourceMappingURL=http-timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-timeout.d.ts","sourceRoot":"","sources":["../../src/http-timeout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,OAAO,gBAAgB,GAAG,MAAM,CAErE"}
@@ -1,27 +1,38 @@
1
- import * as Alpaca from './alpaca-functions';
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
- export { StampedeProtectedCache, createStampedeProtectedCache, DEFAULT_CACHE_OPTIONS, type StampedeProtectedCacheOptions, type CacheEntry, type CacheStats, type CacheLoader, } from './cache/stampede-protected-cache';
16
- export { AssetAllocationEngine, generateOptimalAllocation, getDefaultRiskProfile } from './asset-allocation-algorithm';
17
- export * from './types/asset-allocation-types';
18
- export * from './types';
19
- export { AlpacaTradingAPI } from './alpaca-trading-api';
20
- export { AlpacaMarketDataAPI } from './alpaca-market-data-api';
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";
21
32
  export declare const createAlpacaTradingAPI: (credentials: Types.AlpacaCredentials) => Types.AlpacaTradingAPI;
22
33
  export declare const createAlpacaMarketDataAPI: () => Types.AlpacaMarketDataAPI;
23
- export * from './alpaca';
24
- export type { TokenProvider } from './adaptic';
34
+ export * from "./alpaca";
35
+ export type { TokenProvider } from "./adaptic";
25
36
  export declare const adaptic: {
26
37
  types: typeof Types;
27
38
  backend: {
@@ -191,16 +202,6 @@ export declare const adaptic: {
191
202
  };
192
203
  /** @description Real-time WebSocket streams */
193
204
  streams: typeof import("./alpaca/streams");
194
- /** @deprecated Use sdkAccount module instead */
195
- TradingAPI: typeof Types.AlpacaTradingAPI;
196
- /** @deprecated Use new createClient() instead */
197
- MarketDataAPI: typeof Types.AlpacaMarketDataAPI;
198
- /** @deprecated Use new SDK modules instead */
199
- makeRequest: typeof Alpaca.makeRequest;
200
- /** @deprecated Use account() instead */
201
- accountDetails: typeof Alpaca.fetchAccountDetails;
202
- /** @deprecated Use positions.fetchAll() instead */
203
- legacyPositions: typeof Alpaca.fetchAllPositions;
204
205
  /** @deprecated Use positions module instead */
205
206
  position: {
206
207
  fetch: typeof Alpaca.fetchPosition;
@@ -209,24 +210,14 @@ export declare const adaptic: {
209
210
  closeAll: typeof Alpaca.closeAllPositions;
210
211
  closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
211
212
  };
213
+ /** @deprecated Use account() instead */
214
+ accountDetails: typeof Alpaca.fetchAccountDetails;
212
215
  /** @deprecated Use sdkAccount.getPortfolioHistory() instead */
213
216
  portfolioHistory: typeof Alpaca.fetchPortfolioHistory;
214
217
  /** @deprecated Use sdkAccount.getAccountConfiguration() instead */
215
218
  getConfig: typeof Alpaca.getConfiguration;
216
219
  /** @deprecated Use sdkAccount.updateAccountConfiguration() instead */
217
220
  updateConfig: typeof Alpaca.updateConfiguration;
218
- /** @deprecated Use news.getNews() instead */
219
- legacyNews: typeof Alpaca.fetchNews;
220
- /** @deprecated Use orders module instead */
221
- legacyOrders: {
222
- create: typeof Alpaca.createOrder;
223
- createLimitOrder: typeof Alpaca.createLimitOrder;
224
- get: typeof Alpaca.getOrder;
225
- getAll: typeof Alpaca.getOrders;
226
- replace: typeof Alpaca.replaceOrder;
227
- cancel: typeof Alpaca.cancelOrder;
228
- cancelAll: typeof Alpaca.cancelAllOrders;
229
- };
230
221
  /** @deprecated Use SDK asset functions instead */
231
222
  asset: {
232
223
  get: typeof Alpaca.getAsset;
@@ -333,10 +324,10 @@ export declare const adaptic: {
333
324
  fetchUniversalSnapshot: (tickers: string[], options?: {
334
325
  apiKey?: string;
335
326
  type?: string;
336
- order?: string;
327
+ order? /** @deprecated Use sdkAccount.getAccountConfiguration() instead */: string;
337
328
  limit?: number;
338
329
  sort?: string;
339
- }) => Promise<any>;
330
+ }) => Promise<Types.PolygonIndicesSnapshotResponse>;
340
331
  formatBarData: (data: Types.PolygonIndicesAggregatesResponse) => Array<{
341
332
  date: string;
342
333
  open: number;
@@ -392,10 +383,18 @@ export declare const adaptic: {
392
383
  getTradingDate: typeof mt.getTradingDate;
393
384
  };
394
385
  utils: {
395
- logIfDebug: (message: string, data?: unknown, type?: "info" | "warn" | "error" | "debug" | "trace") => void;
386
+ logIfDebug: (message: string, data?: unknown, type?: "error" | "info" | "warn" | "debug" | "trace") => void;
396
387
  fetchWithRetry: typeof misc.fetchWithRetry;
397
388
  validatePolygonApiKey: typeof misc.validatePolygonApiKey;
398
389
  };
390
+ rateLimiter: {
391
+ TokenBucketRateLimiter: typeof TokenBucketRateLimiter;
392
+ limiters: {
393
+ alpaca: TokenBucketRateLimiter;
394
+ polygon: TokenBucketRateLimiter;
395
+ alphaVantage: TokenBucketRateLimiter;
396
+ };
397
+ };
399
398
  };
400
399
  export declare const adptc: {
401
400
  types: typeof Types;
@@ -566,16 +565,6 @@ export declare const adptc: {
566
565
  };
567
566
  /** @description Real-time WebSocket streams */
568
567
  streams: typeof import("./alpaca/streams");
569
- /** @deprecated Use sdkAccount module instead */
570
- TradingAPI: typeof Types.AlpacaTradingAPI;
571
- /** @deprecated Use new createClient() instead */
572
- MarketDataAPI: typeof Types.AlpacaMarketDataAPI;
573
- /** @deprecated Use new SDK modules instead */
574
- makeRequest: typeof Alpaca.makeRequest;
575
- /** @deprecated Use account() instead */
576
- accountDetails: typeof Alpaca.fetchAccountDetails;
577
- /** @deprecated Use positions.fetchAll() instead */
578
- legacyPositions: typeof Alpaca.fetchAllPositions;
579
568
  /** @deprecated Use positions module instead */
580
569
  position: {
581
570
  fetch: typeof Alpaca.fetchPosition;
@@ -584,24 +573,14 @@ export declare const adptc: {
584
573
  closeAll: typeof Alpaca.closeAllPositions;
585
574
  closeAllAfterHours: typeof Alpaca.closeAllPositionsAfterHours;
586
575
  };
576
+ /** @deprecated Use account() instead */
577
+ accountDetails: typeof Alpaca.fetchAccountDetails;
587
578
  /** @deprecated Use sdkAccount.getPortfolioHistory() instead */
588
579
  portfolioHistory: typeof Alpaca.fetchPortfolioHistory;
589
580
  /** @deprecated Use sdkAccount.getAccountConfiguration() instead */
590
581
  getConfig: typeof Alpaca.getConfiguration;
591
582
  /** @deprecated Use sdkAccount.updateAccountConfiguration() instead */
592
583
  updateConfig: typeof Alpaca.updateConfiguration;
593
- /** @deprecated Use news.getNews() instead */
594
- legacyNews: typeof Alpaca.fetchNews;
595
- /** @deprecated Use orders module instead */
596
- legacyOrders: {
597
- create: typeof Alpaca.createOrder;
598
- createLimitOrder: typeof Alpaca.createLimitOrder;
599
- get: typeof Alpaca.getOrder;
600
- getAll: typeof Alpaca.getOrders;
601
- replace: typeof Alpaca.replaceOrder;
602
- cancel: typeof Alpaca.cancelOrder;
603
- cancelAll: typeof Alpaca.cancelAllOrders;
604
- };
605
584
  /** @deprecated Use SDK asset functions instead */
606
585
  asset: {
607
586
  get: typeof Alpaca.getAsset;
@@ -708,10 +687,10 @@ export declare const adptc: {
708
687
  fetchUniversalSnapshot: (tickers: string[], options?: {
709
688
  apiKey?: string;
710
689
  type?: string;
711
- order?: string;
690
+ order? /** @deprecated Use sdkAccount.getAccountConfiguration() instead */: string;
712
691
  limit?: number;
713
692
  sort?: string;
714
- }) => Promise<any>;
693
+ }) => Promise<Types.PolygonIndicesSnapshotResponse>;
715
694
  formatBarData: (data: Types.PolygonIndicesAggregatesResponse) => Array<{
716
695
  date: string;
717
696
  open: number;
@@ -767,9 +746,17 @@ export declare const adptc: {
767
746
  getTradingDate: typeof mt.getTradingDate;
768
747
  };
769
748
  utils: {
770
- logIfDebug: (message: string, data?: unknown, type?: "info" | "warn" | "error" | "debug" | "trace") => void;
749
+ logIfDebug: (message: string, data?: unknown, type?: "error" | "info" | "warn" | "debug" | "trace") => void;
771
750
  fetchWithRetry: typeof misc.fetchWithRetry;
772
751
  validatePolygonApiKey: typeof misc.validatePolygonApiKey;
773
752
  };
753
+ rateLimiter: {
754
+ TokenBucketRateLimiter: typeof TokenBucketRateLimiter;
755
+ limiters: {
756
+ alpaca: TokenBucketRateLimiter;
757
+ polygon: TokenBucketRateLimiter;
758
+ alphaVantage: TokenBucketRateLimiter;
759
+ };
760
+ };
774
761
  };
775
762
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tE,mDAAmD;;QAEnD,iDAAiD;;QAEjD,8BAA8B;;QAE9B,+BAA+B;;QAE/B,4CAA4C;;;;;;;QAE5C,mDAAmD;;;;;QAEnD,+CAA+C;;QAI/C,+CAA+C;;;;;;;;QAQ/C,wCAAwC;;QAExC,+DAA+D;;QAE/D,mEAAmE;;QAEnE,sEAAsE;;QAEtE,kDAAkD;;;;QAIlD,4CAA4C;;;;;;;kBAnNvC,CAAC;;;iBAmHmB,CAAC;eACzB,CAAC;iBACU,CAAC;kBAAoB,CAAC;gBAG9B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAnIF,CAAC;;;kBA4UipC,CAAC;oBAAsB,CAAC;sBAAyB,CAAC;;;kBA5LtrC,CAAC;;;kBA4L0oP,CAAC;qBAAuB,CAAC;uBAAkC,CAAC;wBAAmC,CAAC;uBAAkC,CAAC;wBAAmC,CAAC;iBAA4B,CAAC;iBAA2B,CAAC;gBAAkB,CAAC;;;;;eApH12P,CAAC;;;iBACV,CAAC;;kBACX,CAAC;;;;;kBAkH4zJ,CAAC;oBAAsB,CAAC;;;;;;kBAxTj2J,CAAC;;;kBA+DW,CAAC;;;kBAqDhB,CAAC;;;kBAgCS,CAAC;;;kBA6CJ,CAAC;gBAAkB,CAAC;iBAE9B,CADF,CAAE,mEAAmE;iBAAlD,CAAC;gBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHb,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"}
@@ -1,4 +1,4 @@
1
- import { LogOptions } from './types/logging-types';
1
+ import { LogOptions } from "./types/logging-types";
2
2
  /**
3
3
  * Logs a message to the console.
4
4
  * @param message The message to log.
@@ -1 +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,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAA+C,GAAG,IAAI,CAGnG"}
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"}
@@ -1 +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,CAA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