@adaptic/utils 0.0.382 → 0.0.900

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,366 @@
1
+ /**
2
+ * Options Orders Module
3
+ * Create and manage option orders
4
+ */
5
+ import { AlpacaClient } from "../client";
6
+ import { AlpacaOrder, PositionIntent, TimeInForce, CreateMultiLegOrderParams, OrderStatus } from "../../types/alpaca-types";
7
+ /**
8
+ * Parameters for creating a single-leg option order
9
+ */
10
+ export interface SingleLegOptionOrderParams {
11
+ /** Option contract symbol (e.g., AAPL230120C00150000) */
12
+ symbol: string;
13
+ /** Number of contracts to trade */
14
+ qty: number;
15
+ /** Order side: buy or sell */
16
+ side: "buy" | "sell";
17
+ /** Order type: market or limit */
18
+ type: "market" | "limit";
19
+ /** Limit price for limit orders (price per share, not per contract) */
20
+ limitPrice?: number;
21
+ /** Position intent: indicates opening or closing a position */
22
+ positionIntent: PositionIntent;
23
+ /** Time in force: day, gtc, ioc, fok, opg, cls */
24
+ timeInForce?: TimeInForce;
25
+ /** Optional client order ID for tracking */
26
+ clientOrderId?: string;
27
+ }
28
+ /**
29
+ * Parameters for closing an option position
30
+ */
31
+ export interface CloseOptionPositionParams {
32
+ /** Specific quantity to close (defaults to full position) */
33
+ qty?: number;
34
+ /** Limit price for limit order close */
35
+ limitPrice?: number;
36
+ /** Time in force for the close order */
37
+ timeInForce?: TimeInForce;
38
+ }
39
+ /**
40
+ * Result of closing all option positions
41
+ */
42
+ export interface CloseAllOptionsResult {
43
+ /** Orders created for closing positions */
44
+ orders: AlpacaOrder[];
45
+ /** Positions that failed to close */
46
+ failed: {
47
+ symbol: string;
48
+ error: string;
49
+ }[];
50
+ /** Total number of positions processed */
51
+ totalProcessed: number;
52
+ }
53
+ /**
54
+ * Parameters for exercising an option
55
+ */
56
+ export interface ExerciseOptionParams {
57
+ /** Option contract symbol */
58
+ symbol: string;
59
+ /** Number of contracts to exercise (defaults to full position) */
60
+ qty?: number;
61
+ }
62
+ /**
63
+ * Multi-leg order validation result
64
+ */
65
+ export interface MultiLegValidationResult {
66
+ /** Whether the order is valid */
67
+ isValid: boolean;
68
+ /** Validation errors if any */
69
+ errors: string[];
70
+ /** Validation warnings if any */
71
+ warnings: string[];
72
+ }
73
+ /**
74
+ * Create a single-leg option order
75
+ *
76
+ * @param client - The AlpacaClient instance
77
+ * @param params - Order parameters
78
+ * @returns The created order
79
+ * @throws Error if order creation fails
80
+ *
81
+ * @example
82
+ * // Buy to open 5 call contracts
83
+ * const order = await createOptionOrder(client, {
84
+ * symbol: 'AAPL230120C00150000',
85
+ * qty: 5,
86
+ * side: 'buy',
87
+ * type: 'limit',
88
+ * limitPrice: 2.50,
89
+ * positionIntent: 'buy_to_open',
90
+ * timeInForce: 'day',
91
+ * });
92
+ *
93
+ * @example
94
+ * // Sell to close with market order
95
+ * const order = await createOptionOrder(client, {
96
+ * symbol: 'AAPL230120C00150000',
97
+ * qty: 5,
98
+ * side: 'sell',
99
+ * type: 'market',
100
+ * positionIntent: 'sell_to_close',
101
+ * });
102
+ */
103
+ export declare function createOptionOrder(client: AlpacaClient, params: SingleLegOptionOrderParams): Promise<AlpacaOrder>;
104
+ /**
105
+ * Buy to open option contracts
106
+ *
107
+ * @param client - The AlpacaClient instance
108
+ * @param symbol - Option contract symbol
109
+ * @param qty - Number of contracts
110
+ * @param limitPrice - Optional limit price (market order if not provided)
111
+ * @param timeInForce - Time in force (default: day)
112
+ * @returns The created order
113
+ *
114
+ * @example
115
+ * const order = await buyToOpen(client, 'AAPL230120C00150000', 5, 2.50);
116
+ */
117
+ export declare function buyToOpen(client: AlpacaClient, symbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
118
+ /**
119
+ * Sell to close option contracts
120
+ *
121
+ * @param client - The AlpacaClient instance
122
+ * @param symbol - Option contract symbol
123
+ * @param qty - Number of contracts
124
+ * @param limitPrice - Optional limit price (market order if not provided)
125
+ * @param timeInForce - Time in force (default: day)
126
+ * @returns The created order
127
+ *
128
+ * @example
129
+ * const order = await sellToClose(client, 'AAPL230120C00150000', 5, 3.00);
130
+ */
131
+ export declare function sellToClose(client: AlpacaClient, symbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
132
+ /**
133
+ * Sell to open option contracts (short selling options)
134
+ *
135
+ * @param client - The AlpacaClient instance
136
+ * @param symbol - Option contract symbol
137
+ * @param qty - Number of contracts
138
+ * @param limitPrice - Optional limit price (market order if not provided)
139
+ * @param timeInForce - Time in force (default: day)
140
+ * @returns The created order
141
+ *
142
+ * @example
143
+ * const order = await sellToOpen(client, 'AAPL230120P00140000', 5, 1.50);
144
+ */
145
+ export declare function sellToOpen(client: AlpacaClient, symbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
146
+ /**
147
+ * Buy to close option contracts (closing short options)
148
+ *
149
+ * @param client - The AlpacaClient instance
150
+ * @param symbol - Option contract symbol
151
+ * @param qty - Number of contracts
152
+ * @param limitPrice - Optional limit price (market order if not provided)
153
+ * @param timeInForce - Time in force (default: day)
154
+ * @returns The created order
155
+ *
156
+ * @example
157
+ * const order = await buyToClose(client, 'AAPL230120P00140000', 5, 0.50);
158
+ */
159
+ export declare function buyToClose(client: AlpacaClient, symbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
160
+ /**
161
+ * Validate multi-leg order parameters
162
+ *
163
+ * @param params - Multi-leg order parameters
164
+ * @returns Validation result with errors and warnings
165
+ */
166
+ export declare function validateMultiLegOrder(params: CreateMultiLegOrderParams): MultiLegValidationResult;
167
+ /**
168
+ * Create a multi-leg option order (spreads, straddles, etc.)
169
+ *
170
+ * @param client - The AlpacaClient instance
171
+ * @param params - Multi-leg order parameters
172
+ * @returns The created order
173
+ * @throws Error if validation fails or order creation fails
174
+ *
175
+ * @example
176
+ * // Create a vertical call spread
177
+ * const order = await createMultiLegOptionOrder(client, {
178
+ * order_class: 'mleg',
179
+ * qty: '1',
180
+ * type: 'limit',
181
+ * limit_price: '1.50',
182
+ * time_in_force: 'day',
183
+ * legs: [
184
+ * {
185
+ * symbol: 'AAPL230120C00150000',
186
+ * ratio_qty: '1',
187
+ * side: 'buy',
188
+ * position_intent: 'buy_to_open',
189
+ * },
190
+ * {
191
+ * symbol: 'AAPL230120C00155000',
192
+ * ratio_qty: '1',
193
+ * side: 'sell',
194
+ * position_intent: 'sell_to_open',
195
+ * },
196
+ * ],
197
+ * });
198
+ */
199
+ export declare function createMultiLegOptionOrder(client: AlpacaClient, params: CreateMultiLegOrderParams): Promise<AlpacaOrder>;
200
+ /**
201
+ * Create a vertical spread (bull call spread or bear put spread)
202
+ *
203
+ * @param client - The AlpacaClient instance
204
+ * @param longSymbol - Symbol of the long leg
205
+ * @param shortSymbol - Symbol of the short leg
206
+ * @param qty - Number of spreads
207
+ * @param limitPrice - Net debit or credit for the spread
208
+ * @param timeInForce - Time in force (default: day)
209
+ * @returns The created order
210
+ *
211
+ * @example
212
+ * // Bull call spread: buy lower strike call, sell higher strike call
213
+ * const order = await createVerticalSpread(
214
+ * client,
215
+ * 'AAPL230120C00150000', // Long leg
216
+ * 'AAPL230120C00155000', // Short leg
217
+ * 5,
218
+ * 1.50 // Net debit
219
+ * );
220
+ */
221
+ export declare function createVerticalSpread(client: AlpacaClient, longSymbol: string, shortSymbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
222
+ /**
223
+ * Create an iron condor spread
224
+ *
225
+ * @param client - The AlpacaClient instance
226
+ * @param putLongSymbol - Lower strike put (buy)
227
+ * @param putShortSymbol - Higher strike put (sell)
228
+ * @param callShortSymbol - Lower strike call (sell)
229
+ * @param callLongSymbol - Higher strike call (buy)
230
+ * @param qty - Number of iron condors
231
+ * @param limitPrice - Net credit for the iron condor
232
+ * @param timeInForce - Time in force (default: day)
233
+ * @returns The created order
234
+ *
235
+ * @example
236
+ * const order = await createIronCondor(
237
+ * client,
238
+ * 'AAPL230120P00140000', // Buy put
239
+ * 'AAPL230120P00145000', // Sell put
240
+ * 'AAPL230120C00155000', // Sell call
241
+ * 'AAPL230120C00160000', // Buy call
242
+ * 5,
243
+ * 2.00 // Net credit
244
+ * );
245
+ */
246
+ export declare function createIronCondor(client: AlpacaClient, putLongSymbol: string, putShortSymbol: string, callShortSymbol: string, callLongSymbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
247
+ /**
248
+ * Create a straddle (buy both call and put at same strike)
249
+ *
250
+ * @param client - The AlpacaClient instance
251
+ * @param callSymbol - Call option symbol
252
+ * @param putSymbol - Put option symbol
253
+ * @param qty - Number of straddles
254
+ * @param limitPrice - Net debit for the straddle
255
+ * @param timeInForce - Time in force (default: day)
256
+ * @returns The created order
257
+ *
258
+ * @example
259
+ * const order = await createStraddle(
260
+ * client,
261
+ * 'AAPL230120C00150000',
262
+ * 'AAPL230120P00150000',
263
+ * 5,
264
+ * 6.00 // Net debit
265
+ * );
266
+ */
267
+ export declare function createStraddle(client: AlpacaClient, callSymbol: string, putSymbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
268
+ /**
269
+ * Create a strangle (buy OTM call and OTM put at different strikes)
270
+ *
271
+ * @param client - The AlpacaClient instance
272
+ * @param callSymbol - OTM call option symbol
273
+ * @param putSymbol - OTM put option symbol
274
+ * @param qty - Number of strangles
275
+ * @param limitPrice - Net debit for the strangle
276
+ * @param timeInForce - Time in force (default: day)
277
+ * @returns The created order
278
+ */
279
+ export declare function createStrangle(client: AlpacaClient, callSymbol: string, putSymbol: string, qty: number, limitPrice?: number, timeInForce?: TimeInForce): Promise<AlpacaOrder>;
280
+ /**
281
+ * Close an option position
282
+ *
283
+ * @param client - The AlpacaClient instance
284
+ * @param symbol - Option contract symbol
285
+ * @param options - Optional close parameters
286
+ * @returns The close order
287
+ * @throws Error if position not found or close fails
288
+ *
289
+ * @example
290
+ * // Close entire position with market order
291
+ * const order = await closeOptionPosition(client, 'AAPL230120C00150000');
292
+ *
293
+ * @example
294
+ * // Close partial position with limit order
295
+ * const order = await closeOptionPosition(client, 'AAPL230120C00150000', {
296
+ * qty: 2,
297
+ * limitPrice: 3.00,
298
+ * });
299
+ */
300
+ export declare function closeOptionPosition(client: AlpacaClient, symbol: string, options?: CloseOptionPositionParams): Promise<AlpacaOrder>;
301
+ /**
302
+ * Close all option positions
303
+ *
304
+ * @param client - The AlpacaClient instance
305
+ * @returns Result containing orders and any failures
306
+ *
307
+ * @example
308
+ * const result = await closeAllOptionPositions(client);
309
+ * console.log(`Closed ${result.orders.length} positions`);
310
+ * if (result.failed.length > 0) {
311
+ * console.log(`Failed to close: ${result.failed.map(f => f.symbol).join(', ')}`);
312
+ * }
313
+ */
314
+ export declare function closeAllOptionPositions(client: AlpacaClient): Promise<CloseAllOptionsResult>;
315
+ /**
316
+ * Exercise an option contract
317
+ * Note: Exercise is only available for American-style options before expiration
318
+ *
319
+ * @param client - The AlpacaClient instance
320
+ * @param symbol - Option contract symbol
321
+ * @param qty - Number of contracts to exercise (defaults to full position)
322
+ * @throws Error if exercise fails
323
+ *
324
+ * @example
325
+ * // Exercise all contracts in position
326
+ * await exerciseOption(client, 'AAPL230120C00150000');
327
+ *
328
+ * @example
329
+ * // Exercise specific quantity
330
+ * await exerciseOption(client, 'AAPL230120C00150000', 5);
331
+ */
332
+ export declare function exerciseOption(client: AlpacaClient, symbol: string, qty?: number): Promise<void>;
333
+ /**
334
+ * Check if an option order is in a terminal state
335
+ *
336
+ * @param status - The order status
337
+ * @returns True if the order is in a terminal state
338
+ */
339
+ export declare function isOptionOrderTerminal(status: OrderStatus): boolean;
340
+ /**
341
+ * Check if an option order can be canceled
342
+ *
343
+ * @param status - The order status
344
+ * @returns True if the order can be canceled
345
+ */
346
+ export declare function isOptionOrderCancelable(status: OrderStatus): boolean;
347
+ declare const _default: {
348
+ createOptionOrder: typeof createOptionOrder;
349
+ buyToOpen: typeof buyToOpen;
350
+ sellToClose: typeof sellToClose;
351
+ sellToOpen: typeof sellToOpen;
352
+ buyToClose: typeof buyToClose;
353
+ validateMultiLegOrder: typeof validateMultiLegOrder;
354
+ createMultiLegOptionOrder: typeof createMultiLegOptionOrder;
355
+ createVerticalSpread: typeof createVerticalSpread;
356
+ createIronCondor: typeof createIronCondor;
357
+ createStraddle: typeof createStraddle;
358
+ createStrangle: typeof createStrangle;
359
+ closeOptionPosition: typeof closeOptionPosition;
360
+ closeAllOptionPositions: typeof closeAllOptionPositions;
361
+ exerciseOption: typeof exerciseOption;
362
+ isOptionOrderTerminal: typeof isOptionOrderTerminal;
363
+ isOptionOrderCancelable: typeof isOptionOrderCancelable;
364
+ };
365
+ export default _default;
366
+ //# sourceMappingURL=orders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/options/orders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,WAAW,EAEX,cAAc,EACd,WAAW,EACX,yBAAyB,EAEzB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAelC;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,kCAAkC;IAClC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,cAAc,EAAE,cAAc,CAAC;IAC/B,kDAAkD;IAClD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,qCAAqC;IACrC,MAAM,EAA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AAC,WAAW,CAAC,CAgCtB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,GAAE,WAAmB,GAC/B,OAAO,CAAC,WAAW,CAAC,CAgCtB;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,WAAW,CAAC,CAgEtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAqEhC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA0Df;AAMD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAQpE;;;;;;;;;;;;;;;;;;;AAMD,wBAwBE"}
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Options Strategies Module
3
+ * Build and execute common option strategies using Alpaca SDK
4
+ */
5
+ import { AlpacaClient } from "../client";
6
+ import { AlpacaOrder, TimeInForce } from "../../types/alpaca-types";
7
+ /**
8
+ * Error class for option strategy operations
9
+ */
10
+ export declare class OptionStrategyError extends Error {
11
+ code: string;
12
+ strategy?: string | undefined;
13
+ details?: unknown | undefined;
14
+ constructor(message: string, code: string, strategy?: string | undefined, details?: unknown | undefined);
15
+ }
16
+ /**
17
+ * Parameters for creating a vertical spread (call or put spread)
18
+ */
19
+ export interface VerticalSpreadParams {
20
+ /** Underlying stock symbol */
21
+ underlying: string;
22
+ /** Expiration date in YYYY-MM-DD format */
23
+ expirationDate: string;
24
+ /** Option type: call or put */
25
+ type: "call" | "put";
26
+ /** Strike price for the long leg */
27
+ longStrike: number;
28
+ /** Strike price for the short leg */
29
+ shortStrike: number;
30
+ /** Number of contracts */
31
+ qty: number;
32
+ /** Debit = buy spread, Credit = sell spread */
33
+ direction: "debit" | "credit";
34
+ /** Optional limit price for the spread (net debit or credit) */
35
+ limitPrice?: number;
36
+ /** Time in force for the order */
37
+ timeInForce?: TimeInForce;
38
+ }
39
+ /**
40
+ * Parameters for creating an iron condor
41
+ */
42
+ export interface IronCondorParams {
43
+ /** Underlying stock symbol */
44
+ underlying: string;
45
+ /** Expiration date in YYYY-MM-DD format */
46
+ expirationDate: string;
47
+ /** Strike price for the long put (lowest strike) */
48
+ putLongStrike: number;
49
+ /** Strike price for the short put */
50
+ putShortStrike: number;
51
+ /** Strike price for the short call */
52
+ callShortStrike: number;
53
+ /** Strike price for the long call (highest strike) */
54
+ callLongStrike: number;
55
+ /** Number of contracts */
56
+ qty: number;
57
+ /** Optional limit price for the spread (net credit) */
58
+ limitPrice?: number;
59
+ /** Time in force for the order */
60
+ timeInForce?: TimeInForce;
61
+ }
62
+ /**
63
+ * Parameters for creating a straddle
64
+ */
65
+ export interface StraddleParams {
66
+ /** Underlying stock symbol */
67
+ underlying: string;
68
+ /** Expiration date in YYYY-MM-DD format */
69
+ expirationDate: string;
70
+ /** Strike price (same for both call and put) */
71
+ strike: number;
72
+ /** Number of contracts */
73
+ qty: number;
74
+ /** Long = buy both options, Short = sell both options */
75
+ direction: "long" | "short";
76
+ /** Optional limit price for the spread */
77
+ limitPrice?: number;
78
+ /** Time in force for the order */
79
+ timeInForce?: TimeInForce;
80
+ }
81
+ /**
82
+ * Parameters for creating a covered call
83
+ */
84
+ export interface CoveredCallParams {
85
+ /** Underlying stock symbol */
86
+ underlying: string;
87
+ /** Expiration date in YYYY-MM-DD format */
88
+ expirationDate: string;
89
+ /** Strike price for the call option */
90
+ strike: number;
91
+ /** Number of contracts (each contract = 100 shares) */
92
+ qty: number;
93
+ /** Optional limit price for the call option */
94
+ limitPrice?: number;
95
+ /** Time in force for the order */
96
+ timeInForce?: TimeInForce;
97
+ }
98
+ /**
99
+ * Parameters for rolling an option position
100
+ */
101
+ export interface RollPositionParams {
102
+ /** Current option contract symbol to close */
103
+ currentSymbol: string;
104
+ /** New expiration date in YYYY-MM-DD format */
105
+ newExpirationDate: string;
106
+ /** New strike price */
107
+ newStrike: number;
108
+ /** Option type: call or put */
109
+ type: "call" | "put";
110
+ /** Optional limit price for the roll (net debit or credit) */
111
+ limitPrice?: number;
112
+ /** Time in force for the order */
113
+ timeInForce?: TimeInForce;
114
+ }
115
+ /**
116
+ * Parameters for creating a strangle
117
+ */
118
+ export interface StrangleParams {
119
+ /** Underlying stock symbol */
120
+ underlying: string;
121
+ /** Expiration date in YYYY-MM-DD format */
122
+ expirationDate: string;
123
+ /** Strike price for the put option (lower strike) */
124
+ putStrike: number;
125
+ /** Strike price for the call option (higher strike) */
126
+ callStrike: number;
127
+ /** Number of contracts */
128
+ qty: number;
129
+ /** Long = buy both options, Short = sell both options */
130
+ direction: "long" | "short";
131
+ /** Optional limit price for the spread */
132
+ limitPrice?: number;
133
+ /** Time in force for the order */
134
+ timeInForce?: TimeInForce;
135
+ }
136
+ /**
137
+ * Parameters for creating a butterfly spread
138
+ */
139
+ export interface ButterflySpreadParams {
140
+ /** Underlying stock symbol */
141
+ underlying: string;
142
+ /** Expiration date in YYYY-MM-DD format */
143
+ expirationDate: string;
144
+ /** Option type: call or put */
145
+ type: "call" | "put";
146
+ /** Lower strike price */
147
+ lowerStrike: number;
148
+ /** Middle strike price (usually ATM) */
149
+ middleStrike: number;
150
+ /** Upper strike price */
151
+ upperStrike: number;
152
+ /** Number of contracts */
153
+ qty: number;
154
+ /** Optional limit price for the spread */
155
+ limitPrice?: number;
156
+ /** Time in force for the order */
157
+ timeInForce?: TimeInForce;
158
+ }
159
+ /**
160
+ * Build an OCC-compliant option symbol
161
+ * Format: ROOT + YYMMDD + C/P + Strike (8 digits with 3 decimals)
162
+ */
163
+ export declare function buildOptionSymbol(underlying: string, expirationDate: string, type: "call" | "put", strike: number): string;
164
+ /**
165
+ * Create a vertical spread (call or put spread)
166
+ * - Bull Call Spread: Buy lower strike call, sell higher strike call
167
+ * - Bear Call Spread: Sell lower strike call, buy higher strike call
168
+ * - Bull Put Spread: Sell higher strike put, buy lower strike put
169
+ * - Bear Put Spread: Buy higher strike put, sell lower strike put
170
+ */
171
+ export declare function createVerticalSpread(client: AlpacaClient, params: VerticalSpreadParams): Promise<AlpacaOrder>;
172
+ /**
173
+ * Create an iron condor
174
+ * Combines a bull put spread and a bear call spread
175
+ * - Buy put at putLongStrike (lowest)
176
+ * - Sell put at putShortStrike
177
+ * - Sell call at callShortStrike
178
+ * - Buy call at callLongStrike (highest)
179
+ */
180
+ export declare function createIronCondor(client: AlpacaClient, params: IronCondorParams): Promise<AlpacaOrder>;
181
+ /**
182
+ * Create a straddle (buy/sell both call and put at same strike)
183
+ * - Long straddle: Buy call and put at same strike (expects high volatility)
184
+ * - Short straddle: Sell call and put at same strike (expects low volatility)
185
+ */
186
+ export declare function createStraddle(client: AlpacaClient, params: StraddleParams): Promise<AlpacaOrder>;
187
+ /**
188
+ * Create a covered call
189
+ * - Buy (or already own) 100 shares per contract
190
+ * - Sell call option against the shares
191
+ */
192
+ export declare function createCoveredCall(client: AlpacaClient, params: CoveredCallParams): Promise<{
193
+ stockOrder: AlpacaOrder;
194
+ optionOrder: AlpacaOrder;
195
+ }>;
196
+ /**
197
+ * Roll an option position to a new expiration/strike
198
+ * Closes the current position and opens a new one
199
+ */
200
+ export declare function rollOptionPosition(client: AlpacaClient, params: RollPositionParams): Promise<AlpacaOrder>;
201
+ /**
202
+ * Create a strangle (buy/sell call and put at different strikes)
203
+ * - Long strangle: Buy OTM call and OTM put (expects high volatility)
204
+ * - Short strangle: Sell OTM call and OTM put (expects low volatility)
205
+ */
206
+ export declare function createStrangle(client: AlpacaClient, params: StrangleParams): Promise<AlpacaOrder>;
207
+ /**
208
+ * Create a butterfly spread
209
+ * - Long butterfly: Buy 1 lower, sell 2 middle, buy 1 upper
210
+ * - Expects price to stay near middle strike
211
+ */
212
+ export declare function createButterflySpread(client: AlpacaClient, params: ButterflySpreadParams): Promise<AlpacaOrder>;
213
+ declare const _default: {
214
+ buildOptionSymbol: typeof buildOptionSymbol;
215
+ createVerticalSpread: typeof createVerticalSpread;
216
+ createIronCondor: typeof createIronCondor;
217
+ createStraddle: typeof createStraddle;
218
+ createCoveredCall: typeof createCoveredCall;
219
+ rollOptionPosition: typeof rollOptionPosition;
220
+ createStrangle: typeof createStrangle;
221
+ createButterflySpread: typeof createButterflySpread;
222
+ };
223
+ export default _default;
224
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/options/strategies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EACL,WAAW,EAEX,WAAW,EAIZ,MAAM,0BAA0B,CAAC;AAYlC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAGnC,IAAI,EAAE,MAAM;IACZ,QAAQ,CAAC,EAAE,MAAM;IACjB,OAAO,CAAC,EAAE,OAAO;gBAHxB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,YAAA,EACjB,OAAO,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,+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