@adaptic/utils 0.0.383 → 0.0.901

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 (225) hide show
  1. package/README.md +153 -61
  2. package/dist/index.cjs +60090 -5244
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.mjs +59829 -5244
  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 +95 -0
  55. package/dist/types/alpaca/client.d.ts.map +1 -0
  56. package/dist/types/alpaca/crypto/data.d.ts +281 -0
  57. package/dist/types/alpaca/crypto/data.d.ts.map +1 -0
  58. package/dist/types/alpaca/crypto/index.d.ts +75 -0
  59. package/dist/types/alpaca/crypto/index.d.ts.map +1 -0
  60. package/dist/types/alpaca/crypto/orders.d.ts +221 -0
  61. package/dist/types/alpaca/crypto/orders.d.ts.map +1 -0
  62. package/dist/types/alpaca/index.d.ts +205 -0
  63. package/dist/types/alpaca/index.d.ts.map +1 -0
  64. package/dist/types/alpaca/legacy/account.d.ts +34 -0
  65. package/dist/types/alpaca/legacy/account.d.ts.map +1 -0
  66. package/dist/types/alpaca/legacy/assets.d.ts +13 -0
  67. package/dist/types/alpaca/legacy/assets.d.ts.map +1 -0
  68. package/dist/types/alpaca/legacy/auth.d.ts +18 -0
  69. package/dist/types/alpaca/legacy/auth.d.ts.map +1 -0
  70. package/dist/types/alpaca/legacy/index.d.ts +15 -0
  71. package/dist/types/alpaca/legacy/index.d.ts.map +1 -0
  72. package/dist/types/alpaca/legacy/market-data.d.ts +32 -0
  73. package/dist/types/alpaca/legacy/market-data.d.ts.map +1 -0
  74. package/dist/types/alpaca/legacy/orders.d.ts +84 -0
  75. package/dist/types/alpaca/legacy/orders.d.ts.map +1 -0
  76. package/dist/types/alpaca/legacy/positions.d.ts +66 -0
  77. package/dist/types/alpaca/legacy/positions.d.ts.map +1 -0
  78. package/dist/types/alpaca/legacy/utils.d.ts +18 -0
  79. package/dist/types/alpaca/legacy/utils.d.ts.map +1 -0
  80. package/dist/types/alpaca/market-data/bars.d.ts +142 -0
  81. package/dist/types/alpaca/market-data/bars.d.ts.map +1 -0
  82. package/dist/types/alpaca/market-data/index.d.ts +13 -0
  83. package/dist/types/alpaca/market-data/index.d.ts.map +1 -0
  84. package/dist/types/alpaca/market-data/news.d.ts +87 -0
  85. package/dist/types/alpaca/market-data/news.d.ts.map +1 -0
  86. package/dist/types/alpaca/market-data/quotes.d.ts +85 -0
  87. package/dist/types/alpaca/market-data/quotes.d.ts.map +1 -0
  88. package/dist/types/alpaca/market-data/trades.d.ts +98 -0
  89. package/dist/types/alpaca/market-data/trades.d.ts.map +1 -0
  90. package/dist/types/alpaca/options/contracts.d.ts +279 -0
  91. package/dist/types/alpaca/options/contracts.d.ts.map +1 -0
  92. package/dist/types/alpaca/options/data.d.ts +126 -0
  93. package/dist/types/alpaca/options/data.d.ts.map +1 -0
  94. package/dist/types/alpaca/options/index.d.ts +17 -0
  95. package/dist/types/alpaca/options/index.d.ts.map +1 -0
  96. package/dist/types/alpaca/options/orders.d.ts +366 -0
  97. package/dist/types/alpaca/options/orders.d.ts.map +1 -0
  98. package/dist/types/alpaca/options/strategies.d.ts +224 -0
  99. package/dist/types/alpaca/options/strategies.d.ts.map +1 -0
  100. package/dist/types/alpaca/streams/base-stream.d.ts +143 -0
  101. package/dist/types/alpaca/streams/base-stream.d.ts.map +1 -0
  102. package/dist/types/alpaca/streams/crypto-stream.d.ts +173 -0
  103. package/dist/types/alpaca/streams/crypto-stream.d.ts.map +1 -0
  104. package/dist/types/alpaca/streams/index.d.ts +54 -0
  105. package/dist/types/alpaca/streams/index.d.ts.map +1 -0
  106. package/dist/types/alpaca/streams/option-stream.d.ts +167 -0
  107. package/dist/types/alpaca/streams/option-stream.d.ts.map +1 -0
  108. package/dist/types/alpaca/streams/stock-stream.d.ts +176 -0
  109. package/dist/types/alpaca/streams/stock-stream.d.ts.map +1 -0
  110. package/dist/types/alpaca/streams/stream-manager.d.ts +277 -0
  111. package/dist/types/alpaca/streams/stream-manager.d.ts.map +1 -0
  112. package/dist/types/alpaca/streams/trading-stream.d.ts +186 -0
  113. package/dist/types/alpaca/streams/trading-stream.d.ts.map +1 -0
  114. package/dist/types/alpaca/streams.d.ts +88 -0
  115. package/dist/types/alpaca/streams.d.ts.map +1 -0
  116. package/dist/types/alpaca/test-imports.d.ts +7 -0
  117. package/dist/types/alpaca/test-imports.d.ts.map +1 -0
  118. package/dist/types/alpaca/trading/account.d.ts +198 -0
  119. package/dist/types/alpaca/trading/account.d.ts.map +1 -0
  120. package/dist/types/alpaca/trading/bracket-orders.d.ts +162 -0
  121. package/dist/types/alpaca/trading/bracket-orders.d.ts.map +1 -0
  122. package/dist/types/alpaca/trading/clock.d.ts +99 -0
  123. package/dist/types/alpaca/trading/clock.d.ts.map +1 -0
  124. package/dist/types/alpaca/trading/index.d.ts +15 -0
  125. package/dist/types/alpaca/trading/index.d.ts.map +1 -0
  126. package/dist/types/alpaca/trading/oco-orders.d.ts +203 -0
  127. package/dist/types/alpaca/trading/oco-orders.d.ts.map +1 -0
  128. package/dist/types/alpaca/trading/order-utils.d.ts +404 -0
  129. package/dist/types/alpaca/trading/order-utils.d.ts.map +1 -0
  130. package/dist/types/alpaca/trading/orders.d.ts +199 -0
  131. package/dist/types/alpaca/trading/orders.d.ts.map +1 -0
  132. package/dist/types/alpaca/trading/oto-orders.d.ts +282 -0
  133. package/dist/types/alpaca/trading/oto-orders.d.ts.map +1 -0
  134. package/dist/types/alpaca/trading/positions.d.ts +389 -0
  135. package/dist/types/alpaca/trading/positions.d.ts.map +1 -0
  136. package/dist/types/alpaca/trading/smart-orders.d.ts +301 -0
  137. package/dist/types/alpaca/trading/smart-orders.d.ts.map +1 -0
  138. package/dist/types/alpaca/trading/trailing-stops.d.ts +240 -0
  139. package/dist/types/alpaca/trading/trailing-stops.d.ts.map +1 -0
  140. package/dist/types/alpaca-market-data-api.d.ts +12 -10
  141. package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
  142. package/dist/types/alpaca-trading-api.d.ts +12 -12
  143. package/dist/types/alpaca-trading-api.d.ts.map +1 -1
  144. package/dist/types/alphavantage.d.ts +1 -1
  145. package/dist/types/alphavantage.d.ts.map +1 -1
  146. package/dist/types/asset-allocation-algorithm.d.ts +7 -1
  147. package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
  148. package/dist/types/cache/stampede-protected-cache.d.ts.map +1 -1
  149. package/dist/types/config/api-endpoints.d.ts +94 -0
  150. package/dist/types/config/api-endpoints.d.ts.map +1 -0
  151. package/dist/types/crypto.d.ts +2 -2
  152. package/dist/types/crypto.d.ts.map +1 -1
  153. package/dist/types/display-manager.d.ts +1 -1
  154. package/dist/types/display-manager.d.ts.map +1 -1
  155. package/dist/types/errors/index.d.ts +130 -0
  156. package/dist/types/errors/index.d.ts.map +1 -0
  157. package/dist/types/examples/asset-allocation-example.d.ts +7 -6
  158. package/dist/types/examples/asset-allocation-example.d.ts.map +1 -1
  159. package/dist/types/examples/rate-limiter-example.d.ts +7 -0
  160. package/dist/types/examples/rate-limiter-example.d.ts.map +1 -0
  161. package/dist/types/format-tools.d.ts.map +1 -1
  162. package/dist/types/http-timeout.d.ts +37 -0
  163. package/dist/types/http-timeout.d.ts.map +1 -0
  164. package/dist/types/index.d.ts +393 -55
  165. package/dist/types/index.d.ts.map +1 -1
  166. package/dist/types/logger.d.ts +56 -0
  167. package/dist/types/logger.d.ts.map +1 -0
  168. package/dist/types/logging.d.ts +1 -1
  169. package/dist/types/logging.d.ts.map +1 -1
  170. package/dist/types/market-hours.d.ts.map +1 -1
  171. package/dist/types/market-time.d.ts +75 -13
  172. package/dist/types/market-time.d.ts.map +1 -1
  173. package/dist/types/metrics-calcs.d.ts.map +1 -1
  174. package/dist/types/misc-utils.d.ts +4 -1
  175. package/dist/types/misc-utils.d.ts.map +1 -1
  176. package/dist/types/performance-metrics.d.ts +4 -4
  177. package/dist/types/performance-metrics.d.ts.map +1 -1
  178. package/dist/types/polygon-indices.d.ts +3 -3
  179. package/dist/types/polygon-indices.d.ts.map +1 -1
  180. package/dist/types/polygon.d.ts +1 -1
  181. package/dist/types/polygon.d.ts.map +1 -1
  182. package/dist/types/price-utils.d.ts.map +1 -1
  183. package/dist/types/rate-limiter.d.ts +171 -0
  184. package/dist/types/rate-limiter.d.ts.map +1 -0
  185. package/dist/types/schemas/alpaca-schemas.d.ts +779 -0
  186. package/dist/types/schemas/alpaca-schemas.d.ts.map +1 -0
  187. package/dist/types/schemas/alphavantage-schemas.d.ts +255 -0
  188. package/dist/types/schemas/alphavantage-schemas.d.ts.map +1 -0
  189. package/dist/types/schemas/index.d.ts +21 -0
  190. package/dist/types/schemas/index.d.ts.map +1 -0
  191. package/dist/types/schemas/polygon-schemas.d.ts +551 -0
  192. package/dist/types/schemas/polygon-schemas.d.ts.map +1 -0
  193. package/dist/types/schemas/validate-response.d.ts +88 -0
  194. package/dist/types/schemas/validate-response.d.ts.map +1 -0
  195. package/dist/types/technical-analysis.d.ts +9 -9
  196. package/dist/types/technical-analysis.d.ts.map +1 -1
  197. package/dist/types/time-utils.d.ts.map +1 -1
  198. package/dist/types/types/adaptic-types.d.ts +1 -1
  199. package/dist/types/types/adaptic-types.d.ts.map +1 -1
  200. package/dist/types/types/alpaca-types.d.ts +172 -98
  201. package/dist/types/types/alpaca-types.d.ts.map +1 -1
  202. package/dist/types/types/alphavantage-types.d.ts +2 -2
  203. package/dist/types/types/asset-allocation-types.d.ts +11 -11
  204. package/dist/types/types/index.d.ts +8 -8
  205. package/dist/types/types/index.d.ts.map +1 -1
  206. package/dist/types/types/logging-types.d.ts +2 -2
  207. package/dist/types/types/logging-types.d.ts.map +1 -1
  208. package/dist/types/types/market-time-types.d.ts +4 -4
  209. package/dist/types/types/market-time-types.d.ts.map +1 -1
  210. package/dist/types/types/metrics-types.d.ts +3 -3
  211. package/dist/types/types/metrics-types.d.ts.map +1 -1
  212. package/dist/types/types/polygon-indices-types.d.ts +6 -6
  213. package/dist/types/types/polygon-types.d.ts +3 -3
  214. package/dist/types/types/ta-types.d.ts +3 -3
  215. package/dist/types/utils/auth-validator.d.ts +32 -0
  216. package/dist/types/utils/auth-validator.d.ts.map +1 -0
  217. package/dist/types/utils/http-keep-alive.d.ts +110 -0
  218. package/dist/types/utils/http-keep-alive.d.ts.map +1 -0
  219. package/dist/types/utils/paginator.d.ts +154 -0
  220. package/dist/types/utils/paginator.d.ts.map +1 -0
  221. package/dist/types/utils/retry.d.ts +78 -0
  222. package/dist/types/utils/retry.d.ts.map +1 -0
  223. package/package.json +25 -5
  224. package/dist/types/alpaca-functions.d.ts +0 -233
  225. package/dist/types/alpaca-functions.d.ts.map +0 -1
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Trades Module
3
+ * Real-time and historical trade data using Alpaca SDK
4
+ */
5
+ import { AlpacaClient } from "../client";
6
+ import { AlpacaTrade, LatestTradesResponse, DataFeed } from "../../types/alpaca-types";
7
+ /**
8
+ * Error thrown when trade operations fail
9
+ */
10
+ export declare class TradeError extends Error {
11
+ code: string;
12
+ symbol?: string | undefined;
13
+ details?: unknown | undefined;
14
+ constructor(message: string, code: string, symbol?: string | undefined, details?: unknown | undefined);
15
+ }
16
+ /**
17
+ * Parameters for fetching historical trades
18
+ */
19
+ export interface GetHistoricalTradesParams {
20
+ /** Stock symbol */
21
+ symbol: string;
22
+ /** Start date/time for the data range */
23
+ start: Date;
24
+ /** End date/time for the data range (defaults to now) */
25
+ end?: Date;
26
+ /** Maximum number of trades to return */
27
+ limit?: number;
28
+ /** Data feed (sip for premium, iex for free tier) */
29
+ feed?: DataFeed;
30
+ }
31
+ /**
32
+ * Get latest trade for a single symbol
33
+ * @param client - AlpacaClient instance
34
+ * @param symbol - Stock symbol to get trade for
35
+ * @param feed - Optional data feed (sip, iex, delayed_sip)
36
+ * @returns Latest trade for the symbol
37
+ * @throws TradeError if the request fails
38
+ */
39
+ export declare function getLatestTrade(client: AlpacaClient, symbol: string, feed?: DataFeed): Promise<AlpacaTrade>;
40
+ /**
41
+ * Get latest trades for multiple symbols
42
+ * @param client - AlpacaClient instance
43
+ * @param symbols - Array of stock symbols
44
+ * @param feed - Optional data feed (sip, iex, delayed_sip)
45
+ * @returns Object containing trades for all requested symbols
46
+ * @throws TradeError if the request fails
47
+ */
48
+ export declare function getLatestTrades(client: AlpacaClient, symbols: string[], feed?: DataFeed): Promise<LatestTradesResponse>;
49
+ /**
50
+ * Get historical trades with automatic pagination
51
+ * @param client - AlpacaClient instance
52
+ * @param params - Parameters for fetching historical trades
53
+ * @returns Array of trades for the symbol
54
+ * @throws TradeError if the request fails
55
+ */
56
+ export declare function getHistoricalTrades(client: AlpacaClient, params: GetHistoricalTradesParams): Promise<AlpacaTrade[]>;
57
+ /**
58
+ * Get current price for a symbol
59
+ * Uses mid-point of latest quote if available, otherwise falls back to last trade price
60
+ * @param client - AlpacaClient instance
61
+ * @param symbol - Stock symbol
62
+ * @param feed - Optional data feed (sip, iex, delayed_sip)
63
+ * @returns Current price for the symbol
64
+ * @throws TradeError if unable to get price
65
+ */
66
+ export declare function getCurrentPrice(client: AlpacaClient, symbol: string, feed?: DataFeed): Promise<number>;
67
+ /**
68
+ * Get current prices for multiple symbols
69
+ * Uses mid-point of latest quote if available, otherwise falls back to last trade price
70
+ * @param client - AlpacaClient instance
71
+ * @param symbols - Array of stock symbols
72
+ * @param feed - Optional data feed (sip, iex, delayed_sip)
73
+ * @returns Map of symbol to current price
74
+ */
75
+ export declare function getCurrentPrices(client: AlpacaClient, symbols: string[], feed?: DataFeed): Promise<Map<string, number>>;
76
+ /**
77
+ * Get trade volume summary for a symbol over a time period
78
+ * @param client - AlpacaClient instance
79
+ * @param symbol - Stock symbol
80
+ * @param start - Start date/time
81
+ * @param end - End date/time (defaults to now)
82
+ * @returns Total volume and trade count for the period
83
+ */
84
+ export declare function getTradeVolume(client: AlpacaClient, symbol: string, start: Date, end?: Date): Promise<{
85
+ totalVolume: number;
86
+ tradeCount: number;
87
+ avgTradeSize: number;
88
+ }>;
89
+ declare const _default: {
90
+ getLatestTrade: typeof getLatestTrade;
91
+ getLatestTrades: typeof getLatestTrades;
92
+ getHistoricalTrades: typeof getHistoricalTrades;
93
+ getCurrentPrice: typeof getCurrentPrice;
94
+ getCurrentPrices: typeof getCurrentPrices;
95
+ getTradeVolume: typeof getTradeVolume;
96
+ };
97
+ export default _default;
98
+ //# sourceMappingURL=trades.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trades.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/market-data/trades.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,QAAQ,EAET,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAG1B,IAAI,EAAE,MAAM;IACZ,MAAM,CAAC,EAAE,MAAM;IAC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AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,IAAI,EACX,GAAG,CAAC,EAAE,IAAI,GACT,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B5E;;;;;;;;;AAED,wBAOE"}
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Options Contracts Module
3
+ * Query and analyze option contracts
4
+ */
5
+ import { AlpacaClient } from "../client";
6
+ import { OptionContract, OptionType, GetOptionContractsParams } from "../../types/alpaca-types";
7
+ /**
8
+ * Parameters for getting option chain
9
+ */
10
+ export interface GetOptionChainParams {
11
+ /** Filter by expiration date (YYYY-MM-DD format) */
12
+ expirationDate?: string;
13
+ /** Filter by strike price range */
14
+ strikePrice?: {
15
+ min?: number;
16
+ max?: number;
17
+ };
18
+ /** Filter by option type (call or put) */
19
+ type?: OptionType;
20
+ }
21
+ /**
22
+ * ATM options result containing both call and put
23
+ */
24
+ export interface ATMOptionsResult {
25
+ /** ATM call option if found */
26
+ call: OptionContract | null;
27
+ /** ATM put option if found */
28
+ put: OptionContract | null;
29
+ /** The strike price used for ATM determination */
30
+ strikePrice: number;
31
+ /** Current underlying price used for determination */
32
+ underlyingPrice: number;
33
+ }
34
+ /**
35
+ * Options chain grouped by expiration and strike
36
+ */
37
+ export interface GroupedOptionChain {
38
+ /** The underlying symbol */
39
+ underlying: string;
40
+ /** Chain grouped by expiration date */
41
+ byExpiration: {
42
+ [expirationDate: string]: {
43
+ /** Calls at each strike */
44
+ calls: {
45
+ [strike: string]: OptionContract;
46
+ };
47
+ /** Puts at each strike */
48
+ puts: {
49
+ [strike: string]: OptionContract;
50
+ };
51
+ };
52
+ };
53
+ /** All available expiration dates */
54
+ expirations: string[];
55
+ /** All available strike prices */
56
+ strikes: number[];
57
+ }
58
+ /**
59
+ * Get option contracts for an underlying symbol with filters
60
+ *
61
+ * @param client - The AlpacaClient instance
62
+ * @param params - Query parameters for filtering contracts
63
+ * @returns Array of option contracts matching the criteria
64
+ * @throws Error if API request fails
65
+ *
66
+ * @example
67
+ * // Get all AAPL option contracts
68
+ * const contracts = await getOptionContracts(client, {
69
+ * underlying_symbols: ['AAPL'],
70
+ * });
71
+ *
72
+ * @example
73
+ * // Get AAPL calls expiring in the next 30 days
74
+ * const today = new Date();
75
+ * const thirtyDaysOut = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000);
76
+ * const contracts = await getOptionContracts(client, {
77
+ * underlying_symbols: ['AAPL'],
78
+ * type: 'call',
79
+ * expiration_date_gte: today.toISOString().split('T')[0],
80
+ * expiration_date_lte: thirtyDaysOut.toISOString().split('T')[0],
81
+ * });
82
+ */
83
+ export declare function getOptionContracts(client: AlpacaClient, params: GetOptionContractsParams): Promise<OptionContract[]>;
84
+ /**
85
+ * Get a specific option contract by symbol or ID
86
+ *
87
+ * @param client - The AlpacaClient instance
88
+ * @param symbolOrId - Option contract symbol (e.g., AAPL230120C00150000) or contract ID
89
+ * @returns The option contract details
90
+ * @throws Error if contract not found or API request fails
91
+ *
92
+ * @example
93
+ * // Get contract by OCC symbol
94
+ * const contract = await getOptionContract(client, 'AAPL230120C00150000');
95
+ *
96
+ * @example
97
+ * // Get contract by ID
98
+ * const contract = await getOptionContract(client, 'contract-uuid-here');
99
+ */
100
+ export declare function getOptionContract(client: AlpacaClient, symbolOrId: string): Promise<OptionContract>;
101
+ /**
102
+ * Get option chain for a symbol with optional filters
103
+ *
104
+ * @param client - The AlpacaClient instance
105
+ * @param underlying - The underlying symbol (e.g., 'AAPL')
106
+ * @param params - Optional filter parameters
107
+ * @returns Array of option contracts in the chain
108
+ *
109
+ * @example
110
+ * // Get full option chain for AAPL
111
+ * const chain = await getOptionChain(client, 'AAPL');
112
+ *
113
+ * @example
114
+ * // Get AAPL puts at specific strike range
115
+ * const chain = await getOptionChain(client, 'AAPL', {
116
+ * type: 'put',
117
+ * strikePrice: { min: 140, max: 160 },
118
+ * });
119
+ */
120
+ export declare function getOptionChain(client: AlpacaClient, underlying: string, params?: GetOptionChainParams): Promise<OptionContract[]>;
121
+ /**
122
+ * Get available expiration dates for an underlying symbol
123
+ *
124
+ * @param client - The AlpacaClient instance
125
+ * @param underlying - The underlying symbol (e.g., 'AAPL')
126
+ * @returns Sorted array of expiration dates (YYYY-MM-DD format)
127
+ *
128
+ * @example
129
+ * const expirations = await getExpirationDates(client, 'AAPL');
130
+ * console.log(`Next expiration: ${expirations[0]}`);
131
+ */
132
+ export declare function getExpirationDates(client: AlpacaClient, underlying: string): Promise<string[]>;
133
+ /**
134
+ * Get available strike prices for an underlying at a specific expiration
135
+ *
136
+ * @param client - The AlpacaClient instance
137
+ * @param underlying - The underlying symbol
138
+ * @param expirationDate - The expiration date (YYYY-MM-DD format)
139
+ * @returns Sorted array of available strike prices
140
+ *
141
+ * @example
142
+ * const strikes = await getStrikePrices(client, 'AAPL', '2024-01-19');
143
+ */
144
+ export declare function getStrikePrices(client: AlpacaClient, underlying: string, expirationDate: string): Promise<number[]>;
145
+ /**
146
+ * Find ATM (at-the-money) options for an underlying
147
+ * Returns both call and put options at the strike price closest to current price
148
+ *
149
+ * @param client - The AlpacaClient instance
150
+ * @param underlying - The underlying symbol
151
+ * @param expirationDate - The expiration date (YYYY-MM-DD format)
152
+ * @param currentPrice - Current price of the underlying (required to determine ATM)
153
+ * @param type - Optional filter to return only call or put
154
+ * @returns ATM options result with call and/or put contracts
155
+ *
156
+ * @example
157
+ * // Get both ATM call and put
158
+ * const atm = await findATMOptions(client, 'AAPL', '2024-01-19', 175.50);
159
+ * console.log(`ATM Call: ${atm.call?.symbol}`);
160
+ * console.log(`ATM Put: ${atm.put?.symbol}`);
161
+ *
162
+ * @example
163
+ * // Get only ATM call
164
+ * const atm = await findATMOptions(client, 'AAPL', '2024-01-19', 175.50, 'call');
165
+ */
166
+ export declare function findATMOptions(client: AlpacaClient, underlying: string, expirationDate: string, currentPrice: number, type?: OptionType): Promise<ATMOptionsResult>;
167
+ /**
168
+ * Get grouped option chain organized by expiration and strike
169
+ *
170
+ * @param client - The AlpacaClient instance
171
+ * @param underlying - The underlying symbol
172
+ * @param expirationDates - Optional array of expiration dates to include
173
+ * @returns Grouped option chain structure
174
+ *
175
+ * @example
176
+ * const chain = await getGroupedOptionChain(client, 'AAPL');
177
+ * // Access calls at specific expiration and strike
178
+ * const call = chain.byExpiration['2024-01-19'].calls['175'];
179
+ */
180
+ export declare function getGroupedOptionChain(client: AlpacaClient, underlying: string, expirationDates?: string[]): Promise<GroupedOptionChain>;
181
+ /**
182
+ * Find options contracts within a delta range (approximated by strike distance from current price)
183
+ *
184
+ * @param client - The AlpacaClient instance
185
+ * @param underlying - The underlying symbol
186
+ * @param expirationDate - The expiration date
187
+ * @param currentPrice - Current price of the underlying
188
+ * @param targetDeltaPercent - Target delta as percentage of current price (e.g., 5 for 5%)
189
+ * @param type - Option type (call or put)
190
+ * @returns Array of contracts within the delta range
191
+ *
192
+ * @example
193
+ * // Find calls approximately 5% OTM
194
+ * const otmCalls = await findOptionsByDelta(client, 'AAPL', '2024-01-19', 175, 5, 'call');
195
+ */
196
+ export declare function findOptionsByDelta(client: AlpacaClient, underlying: string, expirationDate: string, currentPrice: number, targetDeltaPercent: number, type: OptionType): Promise<OptionContract[]>;
197
+ /**
198
+ * Find the nearest expiration date to a target number of days out
199
+ *
200
+ * @param client - The AlpacaClient instance
201
+ * @param underlying - The underlying symbol
202
+ * @param targetDays - Target number of days to expiration
203
+ * @returns The nearest available expiration date
204
+ *
205
+ * @example
206
+ * // Find expiration closest to 30 days out
207
+ * const expiration = await findNearestExpiration(client, 'AAPL', 30);
208
+ */
209
+ export declare function findNearestExpiration(client: AlpacaClient, underlying: string, targetDays: number): Promise<string>;
210
+ /**
211
+ * Parse OCC option symbol to extract components
212
+ *
213
+ * @param occSymbol - OCC option symbol (e.g., AAPL230120C00150000)
214
+ * @returns Parsed symbol components
215
+ *
216
+ * @example
217
+ * const parsed = parseOCCSymbol('AAPL230120C00150000');
218
+ * // Returns: { underlying: 'AAPL', expiration: '2023-01-20', type: 'call', strike: 150 }
219
+ */
220
+ export declare function parseOCCSymbol(occSymbol: string): {
221
+ underlying: string;
222
+ expiration: string;
223
+ type: OptionType;
224
+ strike: number;
225
+ } | null;
226
+ /**
227
+ * Build OCC option symbol from components
228
+ *
229
+ * @param underlying - The underlying symbol
230
+ * @param expiration - Expiration date (YYYY-MM-DD format)
231
+ * @param type - Option type (call or put)
232
+ * @param strike - Strike price
233
+ * @returns OCC-formatted option symbol
234
+ *
235
+ * @example
236
+ * const symbol = buildOCCSymbol('AAPL', '2023-01-20', 'call', 150);
237
+ * // Returns: 'AAPL230120C00150000'
238
+ */
239
+ export declare function buildOCCSymbol(underlying: string, expiration: string, type: OptionType, strike: number): string;
240
+ /**
241
+ * Check if an option contract is tradable
242
+ *
243
+ * @param contract - The option contract to check
244
+ * @returns True if the contract is active and tradable
245
+ */
246
+ export declare function isContractTradable(contract: OptionContract): boolean;
247
+ /**
248
+ * Calculate days to expiration for a contract
249
+ *
250
+ * @param contract - The option contract
251
+ * @returns Number of calendar days until expiration
252
+ */
253
+ export declare function getDaysToExpiration(contract: OptionContract): number;
254
+ /**
255
+ * Check if a contract is expiring within N days
256
+ *
257
+ * @param contract - The option contract
258
+ * @param days - Number of days threshold
259
+ * @returns True if contract expires within the specified days
260
+ */
261
+ export declare function isExpiringWithin(contract: OptionContract, days: number): boolean;
262
+ declare const _default: {
263
+ getOptionContracts: typeof getOptionContracts;
264
+ getOptionContract: typeof getOptionContract;
265
+ getOptionChain: typeof getOptionChain;
266
+ getExpirationDates: typeof getExpirationDates;
267
+ getStrikePrices: typeof getStrikePrices;
268
+ findATMOptions: typeof findATMOptions;
269
+ getGroupedOptionChain: typeof getGroupedOptionChain;
270
+ findOptionsByDelta: typeof findOptionsByDelta;
271
+ findNearestExpiration: typeof findNearestExpiration;
272
+ parseOCCSymbol: typeof parseOCCSymbol;
273
+ buildOCCSymbol: typeof buildOCCSymbol;
274
+ isContractTradable: typeof isContractTradable;
275
+ getDaysToExpiration: typeof getDaysToExpiration;
276
+ isExpiringWithin: typeof isExpiringWithin;
277
+ };
278
+ export default _default;
279
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/options/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,cAAc,EACd,UAAU,EACV,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAelC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,WAAW,CAAC,EAAE;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,0CAA0C;IAC1C,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,8BAA8B;IAC9B,GAAG,EAAE,cAAc,GAAG,IAAI,CAAC;IAC3B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,YAAY,EAAE;QACZ,CAAC,cAAc,EAAE,MAAM,GAAG;YACxB,2BAA2B;YAC3B,KAAK,EAAE;gBAAE,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAA;aAAE,CAAC;YAC5C,0BAA0B;YAC1B,IAAI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options Market Data Module
3
+ * Quotes, bars, and analytics for options using Alpaca SDK
4
+ */
5
+ import { AlpacaClient } from "../client";
6
+ import { OptionQuote, OptionTrade, OptionBar, OptionSnapshot, OptionGreeks, OptionsChainParams, OptionsChainResponse, TimeFrame } from "../../types/alpaca-types";
7
+ /**
8
+ * Error class for options data operations
9
+ */
10
+ export declare class OptionsDataError extends Error {
11
+ code: string;
12
+ symbol?: string | undefined;
13
+ details?: unknown | undefined;
14
+ constructor(message: string, code: string, symbol?: string | undefined, details?: unknown | undefined);
15
+ }
16
+ /**
17
+ * Options data feed type
18
+ */
19
+ export type OptionsFeed = "opra" | "indicative";
20
+ /**
21
+ * Get options chain with snapshots for an underlying symbol
22
+ * Returns option contracts with their latest quotes, trades, and Greeks
23
+ */
24
+ export declare function getOptionsChain(client: AlpacaClient, params: OptionsChainParams): Promise<OptionsChainResponse>;
25
+ /**
26
+ * Get latest option quotes for multiple symbols
27
+ */
28
+ export declare function getLatestOptionsQuotes(client: AlpacaClient, symbols: string[]): Promise<Map<string, OptionQuote>>;
29
+ /**
30
+ * Get latest option trades for multiple symbols
31
+ */
32
+ export declare function getLatestOptionsTrades(client: AlpacaClient, symbols: string[]): Promise<Map<string, OptionTrade>>;
33
+ /**
34
+ * Get option snapshots with Greeks for multiple symbols
35
+ */
36
+ export declare function getOptionsSnapshots(client: AlpacaClient, symbols: string[]): Promise<Map<string, OptionSnapshot>>;
37
+ /**
38
+ * Parameters for historical options bars request
39
+ */
40
+ export interface GetHistoricalOptionsBarsParams {
41
+ /** Option contract symbols */
42
+ symbols: string[];
43
+ /** Bar timeframe (e.g., '1Min', '1Hour', '1Day') */
44
+ timeframe: TimeFrame;
45
+ /** Start date/time */
46
+ start?: Date;
47
+ /** End date/time */
48
+ end?: Date;
49
+ /** Maximum number of bars to return */
50
+ limit?: number;
51
+ }
52
+ /**
53
+ * Get historical option bars (OHLCV data)
54
+ */
55
+ export declare function getHistoricalOptionsBars(client: AlpacaClient, params: GetHistoricalOptionsBarsParams): Promise<Map<string, OptionBar[]>>;
56
+ /**
57
+ * Calculate implied volatility from option price (simplified approximation)
58
+ * For production use, consider using a proper Black-Scholes solver
59
+ */
60
+ export declare function approximateImpliedVolatility(optionPrice: number, underlyingPrice: number, strike: number, daysToExpiration: number, riskFreeRate?: number, isCall?: boolean): number;
61
+ /**
62
+ * Calculate option moneyness
63
+ */
64
+ export declare function calculateMoneyness(underlyingPrice: number, strike: number, isCall: boolean): "ITM" | "ATM" | "OTM";
65
+ /**
66
+ * Find ATM (at-the-money) strikes from an options chain
67
+ */
68
+ export declare function findATMStrikes(snapshots: Map<string, OptionSnapshot>, underlyingPrice: number): {
69
+ callSymbol: string | null;
70
+ putSymbol: string | null;
71
+ strike: number;
72
+ };
73
+ /**
74
+ * Calculate put/call ratio from options chain
75
+ */
76
+ export declare function calculatePutCallRatio(snapshots: Map<string, OptionSnapshot>): {
77
+ volumeRatio: number;
78
+ openInterestRatio: number;
79
+ };
80
+ /**
81
+ * Get option Greeks from a snapshot
82
+ */
83
+ export declare function extractGreeks(snapshot: OptionSnapshot): OptionGreeks | null;
84
+ /**
85
+ * Filter options chain by expiration date range
86
+ */
87
+ export declare function filterByExpiration(snapshots: Map<string, OptionSnapshot>, minDays: number, maxDays: number): Map<string, OptionSnapshot>;
88
+ /**
89
+ * Filter options chain by strike price range
90
+ */
91
+ export declare function filterByStrike(snapshots: Map<string, OptionSnapshot>, minStrike: number, maxStrike: number): Map<string, OptionSnapshot>;
92
+ /**
93
+ * Filter options chain by option type
94
+ */
95
+ export declare function filterByType(snapshots: Map<string, OptionSnapshot>, type: "call" | "put"): Map<string, OptionSnapshot>;
96
+ /**
97
+ * Get the bid-ask spread for an option
98
+ */
99
+ export declare function getOptionSpread(quote: OptionQuote): {
100
+ spread: number;
101
+ spreadPercent: number;
102
+ midPrice: number;
103
+ };
104
+ /**
105
+ * Check if an option has sufficient liquidity
106
+ */
107
+ export declare function hasGoodLiquidity(snapshot: OptionSnapshot, maxSpreadPercent?: number, minOpenInterest?: number): boolean;
108
+ declare const _default: {
109
+ getOptionsChain: typeof getOptionsChain;
110
+ getLatestOptionsQuotes: typeof getLatestOptionsQuotes;
111
+ getLatestOptionsTrades: typeof getLatestOptionsTrades;
112
+ getOptionsSnapshots: typeof getOptionsSnapshots;
113
+ getHistoricalOptionsBars: typeof getHistoricalOptionsBars;
114
+ approximateImpliedVolatility: typeof approximateImpliedVolatility;
115
+ calculateMoneyness: typeof calculateMoneyness;
116
+ findATMStrikes: typeof findATMStrikes;
117
+ calculatePutCallRatio: typeof calculatePutCallRatio;
118
+ extractGreeks: typeof extractGreeks;
119
+ filterByExpiration: typeof filterByExpiration;
120
+ filterByStrike: typeof filterByStrike;
121
+ filterByType: typeof filterByType;
122
+ getOptionSpread: typeof getOptionSpread;
123
+ hasGoodLiquidity: typeof hasGoodLiquidity;
124
+ };
125
+ export default _default;
126
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/options/data.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACV,MAAM,0BAA0B,CAAC;AAWlC;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAGhC,IAAI,EAAE,MAAM;IACZ,MAAM,CAAC,EAAE,MAAM;IACf,OAAO,CAAC,EAAE,OAAO;gBAHxB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,OAAO,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,YAAY,CAAC;AAgDhD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,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MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAMA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EACxB,gBAAgB,GAAE,MAAW,EAC7B,eAAe,GAAE,MAAY,GAC5B,OAAO,CAeT;;;;;;;;;;;;;;;;;;AAED,wBAgBE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Options Trading Module
3
+ * Provides functionality for options contracts, orders, strategies, and market data
4
+ */
5
+ export { getOptionContracts, getOptionContract, getOptionChain, getExpirationDates, getStrikePrices, findATMOptions, getGroupedOptionChain, findOptionsByDelta, findNearestExpiration, parseOCCSymbol, buildOCCSymbol, isContractTradable, getDaysToExpiration, isExpiringWithin, } from "./contracts";
6
+ export type { GetOptionChainParams, ATMOptionsResult, GroupedOptionChain, } from "./contracts";
7
+ export { default as contracts } from "./contracts";
8
+ export { createOptionOrder, buyToOpen, sellToClose, sellToOpen, buyToClose, validateMultiLegOrder, createMultiLegOptionOrder, createVerticalSpread, createIronCondor, createStraddle, createStrangle, closeOptionPosition, closeAllOptionPositions, exerciseOption, isOptionOrderTerminal, isOptionOrderCancelable, } from "./orders";
9
+ export type { SingleLegOptionOrderParams, CloseOptionPositionParams, CloseAllOptionsResult, ExerciseOptionParams, MultiLegValidationResult, } from "./orders";
10
+ export { default as orders } from "./orders";
11
+ export { buildOptionSymbol, createVerticalSpread as createVerticalSpreadAdvanced, createIronCondor as createIronCondorAdvanced, createStraddle as createStraddleAdvanced, createCoveredCall, rollOptionPosition, createStrangle as createStrangleAdvanced, createButterflySpread, OptionStrategyError, } from "./strategies";
12
+ export type { VerticalSpreadParams, IronCondorParams, StraddleParams, CoveredCallParams, RollPositionParams, StrangleParams, ButterflySpreadParams, } from "./strategies";
13
+ export { default as strategies } from "./strategies";
14
+ export { getOptionsChain, getLatestOptionsQuotes, getLatestOptionsTrades, getOptionsSnapshots, getHistoricalOptionsBars, approximateImpliedVolatility, calculateMoneyness, findATMStrikes, calculatePutCallRatio, extractGreeks, filterByExpiration, filterByStrike, filterByType, getOptionSpread, hasGoodLiquidity, OptionsDataError, } from "./data";
15
+ export type { OptionsFeed, GetHistoricalOptionsBarsParams } from "./data";
16
+ export { default as data } from "./data";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/options/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EAGrB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAEL,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EAGV,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,cAAc,EAGd,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EAGd,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,IAAI,4BAA4B,EACpD,gBAAgB,IAAI,wBAAwB,EAC5C,cAAc,IAAI,sBAAsB,EACxC,iBAAiB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