@adaptic/utils 0.1.44 → 0.1.46

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 (204) hide show
  1. package/dist/index.cjs +4558 -59031
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +4554 -58772
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/test.js +218 -563
  6. package/dist/test.js.map +1 -1
  7. package/dist/types/adaptic.d.ts.map +1 -1
  8. package/dist/types/alpaca-functions.d.ts +233 -0
  9. package/dist/types/alpaca-functions.d.ts.map +1 -0
  10. package/dist/types/alpaca-market-data-api.d.ts +10 -12
  11. package/dist/types/alpaca-market-data-api.d.ts.map +1 -1
  12. package/dist/types/alpaca-trading-api.d.ts +2 -2
  13. package/dist/types/alpaca-trading-api.d.ts.map +1 -1
  14. package/dist/types/alphavantage.d.ts.map +1 -1
  15. package/dist/types/asset-allocation-algorithm.d.ts +0 -6
  16. package/dist/types/asset-allocation-algorithm.d.ts.map +1 -1
  17. package/dist/types/crypto.d.ts +2 -2
  18. package/dist/types/crypto.d.ts.map +1 -1
  19. package/dist/types/examples/asset-allocation-example.d.ts +6 -7
  20. package/dist/types/examples/asset-allocation-example.d.ts.map +1 -1
  21. package/dist/types/index.d.ts +37 -373
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/market-hours.d.ts.map +1 -1
  24. package/dist/types/market-time.d.ts +11 -73
  25. package/dist/types/market-time.d.ts.map +1 -1
  26. package/dist/types/metrics-calcs.d.ts.map +1 -1
  27. package/dist/types/misc-utils.d.ts +0 -3
  28. package/dist/types/misc-utils.d.ts.map +1 -1
  29. package/dist/types/performance-metrics.d.ts +5 -5
  30. package/dist/types/performance-metrics.d.ts.map +1 -1
  31. package/dist/types/polygon-indices.d.ts +2 -2
  32. package/dist/types/polygon-indices.d.ts.map +1 -1
  33. package/dist/types/polygon.d.ts.map +1 -1
  34. package/dist/types/price-utils.d.ts.map +1 -1
  35. package/dist/types/technical-analysis.d.ts.map +1 -1
  36. package/dist/types/trading-policy/defaults.d.ts +46 -0
  37. package/dist/types/trading-policy/defaults.d.ts.map +1 -0
  38. package/dist/types/trading-policy/index.d.ts +8 -0
  39. package/dist/types/trading-policy/index.d.ts.map +1 -0
  40. package/dist/types/types/adaptic-types.d.ts +1 -1
  41. package/dist/types/types/adaptic-types.d.ts.map +1 -1
  42. package/dist/types/types/alpaca-types.d.ts +17 -91
  43. package/dist/types/types/alpaca-types.d.ts.map +1 -1
  44. package/dist/types/types/logging-types.d.ts +1 -1
  45. package/dist/types/types/logging-types.d.ts.map +1 -1
  46. package/dist/types/types/metrics-types.d.ts +1 -1
  47. package/dist/types/types/metrics-types.d.ts.map +1 -1
  48. package/package.json +10 -25
  49. package/dist/types/__tests__/alpaca-functions.test.d.ts +0 -2
  50. package/dist/types/__tests__/alpaca-functions.test.d.ts.map +0 -1
  51. package/dist/types/__tests__/api-endpoints.test.d.ts +0 -2
  52. package/dist/types/__tests__/api-endpoints.test.d.ts.map +0 -1
  53. package/dist/types/__tests__/asset-allocation.test.d.ts +0 -2
  54. package/dist/types/__tests__/asset-allocation.test.d.ts.map +0 -1
  55. package/dist/types/__tests__/auth-validator.test.d.ts +0 -2
  56. package/dist/types/__tests__/auth-validator.test.d.ts.map +0 -1
  57. package/dist/types/__tests__/cache.test.d.ts +0 -2
  58. package/dist/types/__tests__/cache.test.d.ts.map +0 -1
  59. package/dist/types/__tests__/errors.test.d.ts +0 -2
  60. package/dist/types/__tests__/errors.test.d.ts.map +0 -1
  61. package/dist/types/__tests__/format-tools.test.d.ts +0 -2
  62. package/dist/types/__tests__/format-tools.test.d.ts.map +0 -1
  63. package/dist/types/__tests__/http-keep-alive.test.d.ts +0 -2
  64. package/dist/types/__tests__/http-keep-alive.test.d.ts.map +0 -1
  65. package/dist/types/__tests__/http-timeout.test.d.ts +0 -2
  66. package/dist/types/__tests__/http-timeout.test.d.ts.map +0 -1
  67. package/dist/types/__tests__/logger.test.d.ts +0 -2
  68. package/dist/types/__tests__/logger.test.d.ts.map +0 -1
  69. package/dist/types/__tests__/market-time.test.d.ts +0 -2
  70. package/dist/types/__tests__/market-time.test.d.ts.map +0 -1
  71. package/dist/types/__tests__/misc-utils.test.d.ts +0 -2
  72. package/dist/types/__tests__/misc-utils.test.d.ts.map +0 -1
  73. package/dist/types/__tests__/paginator.test.d.ts +0 -2
  74. package/dist/types/__tests__/paginator.test.d.ts.map +0 -1
  75. package/dist/types/__tests__/performance-metrics.test.d.ts +0 -2
  76. package/dist/types/__tests__/performance-metrics.test.d.ts.map +0 -1
  77. package/dist/types/__tests__/polygon.test.d.ts +0 -2
  78. package/dist/types/__tests__/polygon.test.d.ts.map +0 -1
  79. package/dist/types/__tests__/property-based-financial.test.d.ts +0 -2
  80. package/dist/types/__tests__/property-based-financial.test.d.ts.map +0 -1
  81. package/dist/types/__tests__/rate-limiter.test.d.ts +0 -2
  82. package/dist/types/__tests__/rate-limiter.test.d.ts.map +0 -1
  83. package/dist/types/__tests__/schema-validation.test.d.ts +0 -2
  84. package/dist/types/__tests__/schema-validation.test.d.ts.map +0 -1
  85. package/dist/types/__tests__/technical-analysis.test.d.ts +0 -2
  86. package/dist/types/__tests__/technical-analysis.test.d.ts.map +0 -1
  87. package/dist/types/__tests__/time-utils.test.d.ts +0 -2
  88. package/dist/types/__tests__/time-utils.test.d.ts.map +0 -1
  89. package/dist/types/alpaca/client.d.ts +0 -95
  90. package/dist/types/alpaca/client.d.ts.map +0 -1
  91. package/dist/types/alpaca/crypto/data.d.ts +0 -281
  92. package/dist/types/alpaca/crypto/data.d.ts.map +0 -1
  93. package/dist/types/alpaca/crypto/index.d.ts +0 -75
  94. package/dist/types/alpaca/crypto/index.d.ts.map +0 -1
  95. package/dist/types/alpaca/crypto/orders.d.ts +0 -221
  96. package/dist/types/alpaca/crypto/orders.d.ts.map +0 -1
  97. package/dist/types/alpaca/index.d.ts +0 -205
  98. package/dist/types/alpaca/index.d.ts.map +0 -1
  99. package/dist/types/alpaca/legacy/account.d.ts +0 -34
  100. package/dist/types/alpaca/legacy/account.d.ts.map +0 -1
  101. package/dist/types/alpaca/legacy/assets.d.ts +0 -13
  102. package/dist/types/alpaca/legacy/assets.d.ts.map +0 -1
  103. package/dist/types/alpaca/legacy/auth.d.ts +0 -18
  104. package/dist/types/alpaca/legacy/auth.d.ts.map +0 -1
  105. package/dist/types/alpaca/legacy/index.d.ts +0 -15
  106. package/dist/types/alpaca/legacy/index.d.ts.map +0 -1
  107. package/dist/types/alpaca/legacy/market-data.d.ts +0 -32
  108. package/dist/types/alpaca/legacy/market-data.d.ts.map +0 -1
  109. package/dist/types/alpaca/legacy/orders.d.ts +0 -84
  110. package/dist/types/alpaca/legacy/orders.d.ts.map +0 -1
  111. package/dist/types/alpaca/legacy/positions.d.ts +0 -66
  112. package/dist/types/alpaca/legacy/positions.d.ts.map +0 -1
  113. package/dist/types/alpaca/legacy/utils.d.ts +0 -18
  114. package/dist/types/alpaca/legacy/utils.d.ts.map +0 -1
  115. package/dist/types/alpaca/market-data/bars.d.ts +0 -142
  116. package/dist/types/alpaca/market-data/bars.d.ts.map +0 -1
  117. package/dist/types/alpaca/market-data/index.d.ts +0 -13
  118. package/dist/types/alpaca/market-data/index.d.ts.map +0 -1
  119. package/dist/types/alpaca/market-data/news.d.ts +0 -87
  120. package/dist/types/alpaca/market-data/news.d.ts.map +0 -1
  121. package/dist/types/alpaca/market-data/quotes.d.ts +0 -85
  122. package/dist/types/alpaca/market-data/quotes.d.ts.map +0 -1
  123. package/dist/types/alpaca/market-data/trades.d.ts +0 -98
  124. package/dist/types/alpaca/market-data/trades.d.ts.map +0 -1
  125. package/dist/types/alpaca/options/contracts.d.ts +0 -279
  126. package/dist/types/alpaca/options/contracts.d.ts.map +0 -1
  127. package/dist/types/alpaca/options/data.d.ts +0 -126
  128. package/dist/types/alpaca/options/data.d.ts.map +0 -1
  129. package/dist/types/alpaca/options/index.d.ts +0 -17
  130. package/dist/types/alpaca/options/index.d.ts.map +0 -1
  131. package/dist/types/alpaca/options/orders.d.ts +0 -366
  132. package/dist/types/alpaca/options/orders.d.ts.map +0 -1
  133. package/dist/types/alpaca/options/strategies.d.ts +0 -224
  134. package/dist/types/alpaca/options/strategies.d.ts.map +0 -1
  135. package/dist/types/alpaca/streams/base-stream.d.ts +0 -143
  136. package/dist/types/alpaca/streams/base-stream.d.ts.map +0 -1
  137. package/dist/types/alpaca/streams/crypto-stream.d.ts +0 -173
  138. package/dist/types/alpaca/streams/crypto-stream.d.ts.map +0 -1
  139. package/dist/types/alpaca/streams/index.d.ts +0 -54
  140. package/dist/types/alpaca/streams/index.d.ts.map +0 -1
  141. package/dist/types/alpaca/streams/option-stream.d.ts +0 -167
  142. package/dist/types/alpaca/streams/option-stream.d.ts.map +0 -1
  143. package/dist/types/alpaca/streams/stock-stream.d.ts +0 -176
  144. package/dist/types/alpaca/streams/stock-stream.d.ts.map +0 -1
  145. package/dist/types/alpaca/streams/stream-manager.d.ts +0 -277
  146. package/dist/types/alpaca/streams/stream-manager.d.ts.map +0 -1
  147. package/dist/types/alpaca/streams/trading-stream.d.ts +0 -186
  148. package/dist/types/alpaca/streams/trading-stream.d.ts.map +0 -1
  149. package/dist/types/alpaca/streams.d.ts +0 -88
  150. package/dist/types/alpaca/streams.d.ts.map +0 -1
  151. package/dist/types/alpaca/test-imports.d.ts +0 -7
  152. package/dist/types/alpaca/test-imports.d.ts.map +0 -1
  153. package/dist/types/alpaca/trading/account.d.ts +0 -198
  154. package/dist/types/alpaca/trading/account.d.ts.map +0 -1
  155. package/dist/types/alpaca/trading/bracket-orders.d.ts +0 -162
  156. package/dist/types/alpaca/trading/bracket-orders.d.ts.map +0 -1
  157. package/dist/types/alpaca/trading/clock.d.ts +0 -99
  158. package/dist/types/alpaca/trading/clock.d.ts.map +0 -1
  159. package/dist/types/alpaca/trading/index.d.ts +0 -15
  160. package/dist/types/alpaca/trading/index.d.ts.map +0 -1
  161. package/dist/types/alpaca/trading/oco-orders.d.ts +0 -203
  162. package/dist/types/alpaca/trading/oco-orders.d.ts.map +0 -1
  163. package/dist/types/alpaca/trading/order-utils.d.ts +0 -404
  164. package/dist/types/alpaca/trading/order-utils.d.ts.map +0 -1
  165. package/dist/types/alpaca/trading/orders.d.ts +0 -199
  166. package/dist/types/alpaca/trading/orders.d.ts.map +0 -1
  167. package/dist/types/alpaca/trading/oto-orders.d.ts +0 -282
  168. package/dist/types/alpaca/trading/oto-orders.d.ts.map +0 -1
  169. package/dist/types/alpaca/trading/positions.d.ts +0 -389
  170. package/dist/types/alpaca/trading/positions.d.ts.map +0 -1
  171. package/dist/types/alpaca/trading/smart-orders.d.ts +0 -301
  172. package/dist/types/alpaca/trading/smart-orders.d.ts.map +0 -1
  173. package/dist/types/alpaca/trading/trailing-stops.d.ts +0 -240
  174. package/dist/types/alpaca/trading/trailing-stops.d.ts.map +0 -1
  175. package/dist/types/config/api-endpoints.d.ts +0 -94
  176. package/dist/types/config/api-endpoints.d.ts.map +0 -1
  177. package/dist/types/errors/index.d.ts +0 -130
  178. package/dist/types/errors/index.d.ts.map +0 -1
  179. package/dist/types/examples/rate-limiter-example.d.ts +0 -7
  180. package/dist/types/examples/rate-limiter-example.d.ts.map +0 -1
  181. package/dist/types/http-timeout.d.ts +0 -37
  182. package/dist/types/http-timeout.d.ts.map +0 -1
  183. package/dist/types/logger.d.ts +0 -56
  184. package/dist/types/logger.d.ts.map +0 -1
  185. package/dist/types/rate-limiter.d.ts +0 -171
  186. package/dist/types/rate-limiter.d.ts.map +0 -1
  187. package/dist/types/schemas/alpaca-schemas.d.ts +0 -779
  188. package/dist/types/schemas/alpaca-schemas.d.ts.map +0 -1
  189. package/dist/types/schemas/alphavantage-schemas.d.ts +0 -255
  190. package/dist/types/schemas/alphavantage-schemas.d.ts.map +0 -1
  191. package/dist/types/schemas/index.d.ts +0 -21
  192. package/dist/types/schemas/index.d.ts.map +0 -1
  193. package/dist/types/schemas/polygon-schemas.d.ts +0 -551
  194. package/dist/types/schemas/polygon-schemas.d.ts.map +0 -1
  195. package/dist/types/schemas/validate-response.d.ts +0 -88
  196. package/dist/types/schemas/validate-response.d.ts.map +0 -1
  197. package/dist/types/utils/auth-validator.d.ts +0 -32
  198. package/dist/types/utils/auth-validator.d.ts.map +0 -1
  199. package/dist/types/utils/http-keep-alive.d.ts +0 -110
  200. package/dist/types/utils/http-keep-alive.d.ts.map +0 -1
  201. package/dist/types/utils/paginator.d.ts +0 -154
  202. package/dist/types/utils/paginator.d.ts.map +0 -1
  203. package/dist/types/utils/retry.d.ts +0 -78
  204. package/dist/types/utils/retry.d.ts.map +0 -1
@@ -1,205 +0,0 @@
1
- /**
2
- * Alpaca Module
3
- * Unified export of all Alpaca functionality using official SDK
4
- *
5
- * @module @adaptic/utils/alpaca
6
- */
7
- export * from "./client";
8
- export * from "./trading";
9
- export { getLatestQuote, getLatestQuotes, getSpread, getSpreads, hasGoodLiquidity as hasStockLiquidity, QuoteError, type SpreadInfo, } from "./market-data/quotes";
10
- export { getBars, getLatestBars, getDailyPrices, getIntradayPrices, getPreviousClose, analyzeBars, getPriceRange, getAverageDailyVolume, hasSufficientVolume, BarError, type GetBarsParams, type BarAnalysis, } from "./market-data/bars";
11
- export { getLatestTrade, getLatestTrades, getHistoricalTrades, getCurrentPrice, getCurrentPrices, getTradeVolume, TradeError, type GetHistoricalTradesParams, } from "./market-data/trades";
12
- export { getNews, getLatestNews, searchNews, getNewsForSymbols, getSymbolSentiment, NewsError, type GetNewsParams, } from "./market-data/news";
13
- export { getOptionContracts, getOptionContract, getOptionChain, getExpirationDates, getStrikePrices, findATMOptions, getGroupedOptionChain, findOptionsByDelta, findNearestExpiration, parseOCCSymbol, buildOCCSymbol, isContractTradable, getDaysToExpiration, isExpiringWithin, type GetOptionChainParams, type ATMOptionsResult, type GroupedOptionChain, } from "./options/contracts";
14
- export { createOptionOrder, buyToOpen, sellToClose, sellToOpen, buyToClose, validateMultiLegOrder, createMultiLegOptionOrder, createVerticalSpread, createIronCondor, createStraddle, createStrangle, closeOptionPosition, closeAllOptionPositions, exerciseOption, isOptionOrderTerminal, isOptionOrderCancelable, type SingleLegOptionOrderParams, type CloseOptionPositionParams, type CloseAllOptionsResult, type ExerciseOptionParams, type MultiLegValidationResult, } from "./options/orders";
15
- export { buildOptionSymbol, createVerticalSpread as createVerticalSpreadAdvanced, createIronCondor as createIronCondorAdvanced, createStraddle as createStraddleAdvanced, createCoveredCall, rollOptionPosition, createStrangle as createStrangleAdvanced, createButterflySpread, OptionStrategyError, type VerticalSpreadParams, type IronCondorParams, type StraddleParams, type CoveredCallParams, type RollPositionParams, type StrangleParams, type ButterflySpreadParams, } from "./options/strategies";
16
- export { getOptionsChain, getLatestOptionsQuotes, getLatestOptionsTrades, getOptionsSnapshots, getHistoricalOptionsBars, approximateImpliedVolatility, calculateMoneyness, findATMStrikes, calculatePutCallRatio, extractGreeks, filterByExpiration, filterByStrike, filterByType, getOptionSpread, hasGoodLiquidity as hasOptionLiquidity, OptionsDataError, type OptionsFeed, type GetHistoricalOptionsBarsParams, } from "./options/data";
17
- export { CryptoOrderError, CryptoOrderParams, createCryptoOrder, createCryptoMarketOrder, createCryptoLimitOrder, createCryptoStopOrder, createCryptoStopLimitOrder, buyCryptoNotional, sellCryptoNotional, sellAllCrypto, getOpenCryptoOrders, cancelAllCryptoOrders, isCryptoPair, } from "./crypto/orders";
18
- export { CryptoDataError, CryptoTrade, CryptoQuote, GetCryptoBarsParams, CryptoSnapshot, getCryptoBars, getLatestCryptoTrades, getLatestCryptoQuotes, getCryptoPrice, getCryptoSpread, getCryptoSnapshots, getCryptoTrades, getCryptoDailyPrices, getCrypto24HourChange, getSupportedCryptoPairs, getCryptoPairsByQuote, isSupportedCryptoPair, getPopularCryptoPairs, BTC_PAIRS, USDT_PAIRS, USDC_PAIRS, USD_PAIRS, } from "./crypto/data";
19
- export * from "./streams";
20
- import * as legacyApi from "./legacy";
21
- export { legacyApi };
22
- import { createAlpacaClient, AlpacaClient, AlpacaClientConfig, createClientFromEnv, clearClientCache } from "./client";
23
- import * as trading from "./trading/orders";
24
- import * as orderUtils from "./trading/order-utils";
25
- import * as bracketOrders from "./trading/bracket-orders";
26
- import * as ocoOrders from "./trading/oco-orders";
27
- import * as otoOrders from "./trading/oto-orders";
28
- import * as trailingStops from "./trading/trailing-stops";
29
- import * as smartOrders from "./trading/smart-orders";
30
- import * as positions from "./trading/positions";
31
- import * as account from "./trading/account";
32
- import * as clock from "./trading/clock";
33
- import * as quotes from "./market-data/quotes";
34
- import * as bars from "./market-data/bars";
35
- import * as trades from "./market-data/trades";
36
- import * as news from "./market-data/news";
37
- import * as optionContracts from "./options/contracts";
38
- import * as optionOrders from "./options/orders";
39
- import * as optionStrategies from "./options/strategies";
40
- import * as optionData from "./options/data";
41
- import * as cryptoOrders from "./crypto/orders";
42
- import * as cryptoData from "./crypto/data";
43
- import * as streams from "./streams";
44
- /**
45
- * Alpaca namespace for convenient access to all functionality
46
- *
47
- * @example
48
- * ```typescript
49
- * import { alpaca } from '@adaptic/utils';
50
- *
51
- * // Create client
52
- * const client = alpaca.createClient({
53
- * apiKey: 'your-api-key',
54
- * apiSecret: 'your-api-secret',
55
- * accountType: 'PAPER',
56
- * });
57
- *
58
- * // Use trading functions
59
- * const order = await alpaca.orders.createOrder(client, { ... });
60
- *
61
- * // Use market data functions
62
- * const quote = await alpaca.quotes.getLatestQuote(client, 'AAPL');
63
- *
64
- * // Use smart orders
65
- * const bracket = await alpaca.smartOrders.createSmartOrder(client, { ... });
66
- * ```
67
- */
68
- export declare const alpaca: {
69
- createClient: typeof createAlpacaClient;
70
- createClientFromEnv: typeof createClientFromEnv;
71
- clearClientCache: typeof clearClientCache;
72
- orders: {
73
- getOrdersBySymbol(client: AlpacaClient, symbol: string, params?: Omit<import("..").GetOrdersParams, "symbols">): Promise<import("..").AlpacaOrder[]>;
74
- getOpenOrders(client: AlpacaClient, params?: Omit<import("..").GetOrdersParams, "status">): Promise<import("..").AlpacaOrder[]>;
75
- getFilledOrders(client: AlpacaClient, params: orderUtils.GetFilledOrdersParams): Promise<import("..").AlpacaOrder[]>;
76
- getOrderHistory(client: AlpacaClient, params?: orderUtils.GetOrderHistoryParams): Promise<orderUtils.OrderHistoryResult>;
77
- getAllOrders(client: AlpacaClient, params?: orderUtils.GetAllOrdersParams): Promise<import("..").AlpacaOrder[]>;
78
- waitForOrderFill(client: AlpacaClient, params: orderUtils.WaitForOrderFillParams): Promise<orderUtils.WaitForOrderFillResult>;
79
- isOrderFillable(order: import("..").AlpacaOrder): boolean;
80
- isOrderFilled(order: import("..").AlpacaOrder): boolean;
81
- isOrderTerminal(order: import("..").AlpacaOrder): boolean;
82
- isOrderOpen(order: import("..").AlpacaOrder): boolean;
83
- calculateOrderValue(order: import("..").AlpacaOrder): number | null;
84
- formatOrderSummary(order: import("..").AlpacaOrder): orderUtils.OrderSummary;
85
- formatOrderForLog(order: import("..").AlpacaOrder): string;
86
- roundPriceForAlpaca(price: number): string;
87
- roundPriceForAlpacaNumber(price: number): number;
88
- groupOrdersBySymbol(orders: import("..").AlpacaOrder[]): Map<string, import("..").AlpacaOrder[]>;
89
- groupOrdersByStatus(orders: import("..").AlpacaOrder[]): Map<string, import("..").AlpacaOrder[]>;
90
- calculateTotalFilledValue(orders: import("..").AlpacaOrder[]): number;
91
- filterOrdersByDateRange(orders: import("..").AlpacaOrder[], startDate: Date, endDate: Date): import("..").AlpacaOrder[];
92
- sortOrdersByDate(orders: import("..").AlpacaOrder[], direction?: "asc" | "desc"): import("..").AlpacaOrder[];
93
- default: {
94
- getOrdersBySymbol: typeof orderUtils.getOrdersBySymbol;
95
- getOpenOrders: typeof orderUtils.getOpenOrders;
96
- getFilledOrders: typeof orderUtils.getFilledOrders;
97
- getOrderHistory: typeof orderUtils.getOrderHistory;
98
- getAllOrders: typeof orderUtils.getAllOrders;
99
- waitForOrderFill: typeof orderUtils.waitForOrderFill;
100
- isOrderFillable: typeof orderUtils.isOrderFillable;
101
- isOrderFilled: typeof orderUtils.isOrderFilled;
102
- isOrderTerminal: typeof orderUtils.isOrderTerminal;
103
- isOrderOpen: typeof orderUtils.isOrderOpen;
104
- calculateOrderValue: typeof orderUtils.calculateOrderValue;
105
- calculateTotalFilledValue: typeof orderUtils.calculateTotalFilledValue;
106
- formatOrderSummary: typeof orderUtils.formatOrderSummary;
107
- formatOrderForLog: typeof orderUtils.formatOrderForLog;
108
- roundPriceForAlpaca: typeof orderUtils.roundPriceForAlpaca;
109
- roundPriceForAlpacaNumber: typeof orderUtils.roundPriceForAlpacaNumber;
110
- groupOrdersBySymbol: typeof orderUtils.groupOrdersBySymbol;
111
- groupOrdersByStatus: typeof orderUtils.groupOrdersByStatus;
112
- filterOrdersByDateRange: typeof orderUtils.filterOrdersByDateRange;
113
- sortOrdersByDate: typeof orderUtils.sortOrdersByDate;
114
- };
115
- createOrder(client: AlpacaClient, params: import("..").CreateOrderParams): Promise<import("..").AlpacaOrder>;
116
- getOrder(client: AlpacaClient, orderId: string): Promise<import("..").AlpacaOrder>;
117
- getOrders(client: AlpacaClient, params?: import("..").GetOrdersParams): Promise<import("..").AlpacaOrder[]>;
118
- cancelOrder(client: AlpacaClient, orderId: string): Promise<void>;
119
- cancelAllOrders(client: AlpacaClient): Promise<trading.CancelAllOrdersResponse>;
120
- replaceOrder(client: AlpacaClient, orderId: string, params: import("..").ReplaceOrderParams): Promise<import("..").AlpacaOrder>;
121
- isOrderCancelable(status: import("..").OrderStatus): boolean;
122
- getOrderByClientId(client: AlpacaClient, clientOrderId: string): Promise<import("..").AlpacaOrder>;
123
- };
124
- smartOrders: {
125
- bracket: typeof bracketOrders;
126
- oco: typeof ocoOrders;
127
- oto: typeof otoOrders;
128
- trailingStops: typeof trailingStops;
129
- determineOrderType(params: smartOrders.SmartOrderParams): smartOrders.SmartOrderType;
130
- createSmartOrder(client: AlpacaClient, params: smartOrders.SmartOrderParams): Promise<smartOrders.SmartOrderResult>;
131
- createPercentageBracket(client: AlpacaClient, params: smartOrders.PercentageBracketParams): Promise<bracketOrders.BracketOrderResult>;
132
- createRiskManagedPosition(client: AlpacaClient, params: smartOrders.RiskManagedPositionParams): Promise<bracketOrders.BracketOrderResult | otoOrders.OTOOrderResult>;
133
- calculateRewardRiskRatio(entryPrice: number, takeProfitPrice: number, stopLossPrice: number, side: import("..").OrderSide): number;
134
- calculatePositionSize(accountValue: number, riskPercent: number, entryPrice: number, stopPrice: number): number;
135
- default: {
136
- createSmartOrder: typeof smartOrders.createSmartOrder;
137
- determineOrderType: typeof smartOrders.determineOrderType;
138
- createPercentageBracket: typeof smartOrders.createPercentageBracket;
139
- createRiskManagedPosition: typeof smartOrders.createRiskManagedPosition;
140
- calculateRewardRiskRatio: typeof smartOrders.calculateRewardRiskRatio;
141
- calculatePositionSize: typeof smartOrders.calculatePositionSize;
142
- createBracketOrder: typeof bracketOrders.createBracketOrder;
143
- createProtectiveBracket: typeof bracketOrders.createProtectiveBracket;
144
- createExecutorFromTradingAPI: typeof bracketOrders.createExecutorFromTradingAPI;
145
- createOCOOrder: typeof ocoOrders.createOCOOrder;
146
- createOTOOrder: typeof otoOrders.createOTOOrder;
147
- createTrailingStop: typeof trailingStops.createTrailingStop;
148
- updateTrailingStop: typeof trailingStops.updateTrailingStop;
149
- };
150
- createBracketOrder(executor: bracketOrders.BracketOrderExecutor, params: bracketOrders.BracketOrderParams): Promise<bracketOrders.BracketOrderResult>;
151
- createProtectiveBracket(executor: bracketOrders.BracketOrderExecutor, params: bracketOrders.ProtectiveBracketParams): Promise<bracketOrders.BracketOrderResult>;
152
- createExecutorFromTradingAPI(api: {
153
- makeRequest: (endpoint: string, method: string, body?: unknown) => Promise<import("..").AlpacaOrder>;
154
- }): bracketOrders.BracketOrderExecutor;
155
- createOCOOrder(client: AlpacaClient, params: ocoOrders.OCOOrderParams): Promise<ocoOrders.OCOOrderResult>;
156
- cancelOCOOrder(client: AlpacaClient, parentOrderId: string): Promise<void>;
157
- getOCOOrderStatus(client: AlpacaClient, parentOrderId: string): Promise<import("..").AlpacaOrder>;
158
- protectLongPosition(client: AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<ocoOrders.OCOOrderResult>;
159
- protectShortPosition(client: AlpacaClient, symbol: string, qty: number, takeProfitPrice: number, stopLossPrice: number, stopLimitPrice?: number): Promise<ocoOrders.OCOOrderResult>;
160
- createOTOOrder(client: AlpacaClient, params: otoOrders.OTOOrderParams): Promise<otoOrders.OTOOrderResult>;
161
- cancelOTOOrder(client: AlpacaClient, parentOrderId: string): Promise<void>;
162
- getOTOOrderStatus(client: AlpacaClient, parentOrderId: string): Promise<import("..").AlpacaOrder>;
163
- buyWithStopLoss(client: AlpacaClient, symbol: string, qty: number, stopLossPrice: number, stopLimitPrice?: number): Promise<otoOrders.OTOOrderResult>;
164
- buyWithTrailingStop(client: AlpacaClient, symbol: string, qty: number, trailPercent: number): Promise<otoOrders.OTOOrderResult>;
165
- limitBuyWithTakeProfit(client: AlpacaClient, symbol: string, qty: number, entryPrice: number, takeProfitPrice: number): Promise<otoOrders.OTOOrderResult>;
166
- shortWithStopLoss(client: AlpacaClient, symbol: string, qty: number, entryPrice: number, stopLossPrice: number): Promise<otoOrders.OTOOrderResult>;
167
- entryWithPercentStopLoss(client: AlpacaClient, symbol: string, qty: number, entryPrice: number | null, stopLossPercent: number, side?: import("..").OrderSide): Promise<otoOrders.OTOOrderResult>;
168
- createTrailingStop(client: AlpacaClient, params: trailingStops.TrailingStopParams): Promise<import("..").AlpacaOrder>;
169
- updateTrailingStop(client: AlpacaClient, orderId: string, updates: {
170
- trailPercent?: number;
171
- trailPrice?: number;
172
- }): Promise<import("..").AlpacaOrder>;
173
- getTrailingStopHWM(client: AlpacaClient, orderId: string): Promise<trailingStops.TrailingStopHWMResult>;
174
- cancelTrailingStop(client: AlpacaClient, orderId: string): Promise<void>;
175
- createPortfolioTrailingStops(client: AlpacaClient, params: trailingStops.PortfolioTrailingStopParams): Promise<Map<string, import("..").AlpacaOrder>>;
176
- getOpenTrailingStops(client: AlpacaClient, symbol?: string): Promise<import("..").AlpacaOrder[]>;
177
- hasActiveTrailingStop(client: AlpacaClient, symbol: string): Promise<boolean>;
178
- cancelTrailingStopsForSymbol(client: AlpacaClient, symbol: string): Promise<number>;
179
- TrailingStopValidationError: typeof trailingStops.TrailingStopValidationError;
180
- };
181
- positions: typeof positions;
182
- account: typeof account;
183
- clock: typeof clock;
184
- quotes: typeof quotes;
185
- bars: typeof bars;
186
- trades: typeof trades;
187
- news: typeof news;
188
- options: {
189
- contracts: typeof optionContracts;
190
- orders: typeof optionOrders;
191
- strategies: typeof optionStrategies;
192
- data: typeof optionData;
193
- };
194
- crypto: {
195
- orders: typeof cryptoOrders;
196
- data: typeof cryptoData;
197
- };
198
- streams: typeof streams;
199
- };
200
- /**
201
- * Re-export type definitions for external use
202
- */
203
- export type { AlpacaClient, AlpacaClientConfig };
204
- export default alpaca;
205
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alpaca/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,OAAO,EAEL,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,IAAI,iBAAiB,EACrC,UAAU,EAEV,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,OAAO,EACP,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,QAAQ,EAER,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,UAAU,EAEV,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAE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AAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAC;AAGzC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAC;AAG3C,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAG7C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEA4DmgM,CAAC;;;;;;;;;;;;;;;;;wBAA5xL,CAAC;sBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CARpR,CAAC;AAEF;;GAEG;AACH,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEjD,eAAe,MAAM,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Legacy Alpaca Account Functions
3
- * Account details, portfolio history, and configuration management
4
- * using AlpacaAuth pattern with direct fetch calls.
5
- */
6
- import { types } from "@adaptic/backend-legacy";
7
- import { AlpacaAccountDetails, AccountConfiguration, FetchAccountDetailsProps, FetchPortfolioHistoryProps, PortfolioHistoryResponse } from "../../types/alpaca-types";
8
- /**
9
- * Fetches account details from Alpaca API.
10
- * @param props - The properties for fetching account details
11
- * @returns The account details
12
- */
13
- export declare function fetchAccountDetails({ accountId, client, brokerageAccount, auth, }: FetchAccountDetailsProps): Promise<AlpacaAccountDetails>;
14
- /**
15
- * Fetches portfolio history for one Alpaca account, as stored in Adaptic backend.
16
- * @param props - The properties for fetching portfolio history
17
- * @returns The portfolio history
18
- */
19
- export declare function fetchPortfolioHistory({ params, accountId, client, brokerageAccount, }: FetchPortfolioHistoryProps): Promise<PortfolioHistoryResponse>;
20
- /**
21
- * Retrieves the configuration for a specific Alpaca account.
22
- * @param account - The Alpaca account to retrieve the configuration for
23
- * @returns The account configuration
24
- */
25
- export declare function getConfiguration(account: types.BrokerageAccount): Promise<AccountConfiguration>;
26
- /**
27
- * Updates the configuration for a specific Alpaca account.
28
- * @param user - The user making the update
29
- * @param account - The Alpaca account to update
30
- * @param updatedConfig - The updated configuration
31
- * @returns The updated account configuration
32
- */
33
- export declare function updateConfiguration(user: types.User, account: types.BrokerageAccount, updatedConfig: AccountConfiguration): Promise<AccountConfiguration>;
34
- //# sourceMappingURL=account.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/account.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAEpB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAMlC;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,IAAI,GACL,EAAE,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAmE1D;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,EACN,SAAS,EACT,MAAM,EACN,gBAAgB,GACjB,EAAE,0BAA0B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA4FhE;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,KAAK,CAAC,gBAAgB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAgG/B;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,OAAO,EAAE,KAAK,CAAC,gBAAgB,EAC/B,aAAa,EAAE,oBAAoB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAoP/B"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Legacy Alpaca Asset Functions
3
- * Asset retrieval using AlpacaAuth pattern with direct fetch calls.
4
- */
5
- import { AlpacaAuth, AlpacaAsset } from "../../types/alpaca-types";
6
- /**
7
- * Retrieves an asset from Alpaca by symbol or asset ID.
8
- * @param auth - The authentication details for Alpaca
9
- * @param symbolOrAssetId - The symbol or asset ID to retrieve
10
- * @returns The requested asset
11
- */
12
- export declare function getAsset(auth: AlpacaAuth, symbolOrAssetId: string): Promise<AlpacaAsset>;
13
- //# sourceMappingURL=assets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/assets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMnE;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,UAAU,EAChB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAiCtB"}
@@ -1,18 +0,0 @@
1
- import { AlpacaAuth } from "../../types/alpaca-types";
2
- /**
3
- * Validated authentication credentials ready for API calls.
4
- */
5
- export interface ValidatedAuth {
6
- apiKey: string;
7
- apiSecret: string;
8
- type: string;
9
- }
10
- /**
11
- * Resolves AlpacaAuth into validated API credentials.
12
- * Supports authentication via adapticAccountId or direct API key/secret.
13
- * @param auth - The authentication details for Alpaca
14
- * @returns Validated authentication credentials
15
- * @throws Error if authentication details are missing or invalid
16
- */
17
- export declare function validateAuth(auth: AlpacaAuth): Promise<ValidatedAuth>;
18
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/auth.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CA6C3E"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Legacy Alpaca API Functions
3
- * Re-exports all legacy functions that use the AlpacaAuth pattern
4
- * with direct fetch calls (as opposed to the SDK-based AlpacaClient pattern).
5
- *
6
- * @module @adaptic/utils/alpaca/legacy
7
- */
8
- export { validateAuth, type ValidatedAuth } from "./auth";
9
- export { roundPriceForAlpaca, cleanContent } from "./utils";
10
- export { makeRequest, createOrder, getOrders, cancelAllOrders, getOrder, replaceOrder, cancelOrder, createLimitOrder, } from "./orders";
11
- export { fetchAllPositions, fetchPosition, closePosition, closeAllPositions, closeAllPositionsAfterHours, } from "./positions";
12
- export { fetchAccountDetails, fetchPortfolioHistory, getConfiguration, updateConfiguration, } from "./account";
13
- export { getLatestQuotes, fetchNews } from "./market-data";
14
- export { getAsset } from "./assets";
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG1D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5D,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
@@ -1,32 +0,0 @@
1
- import { AlpacaAuth, DataFeed, LatestQuotesResponse, SimpleNews } from "../../types/alpaca-types";
2
- /**
3
- * Get the most recent quotes for requested symbols.
4
- * @param auth - The authentication details for Alpaca
5
- * @param params - Parameters including symbols array, optional feed and currency
6
- * @returns Latest quote data for each symbol
7
- * @throws Error if request fails or rate limit exceeded
8
- */
9
- export declare function getLatestQuotes(auth: AlpacaAuth, params: {
10
- symbols: string[];
11
- feed?: DataFeed;
12
- currency?: string;
13
- }): Promise<LatestQuotesResponse>;
14
- /**
15
- * Fetches news articles from Alpaca API for specified symbols.
16
- * @param symbols - The symbols to fetch news for (comma-separated for multiple symbols)
17
- * @param params - Optional parameters for fetching news
18
- * @returns The fetched news articles and optional pagination token
19
- */
20
- export declare function fetchNews(symbols: string, params?: {
21
- auth?: AlpacaAuth;
22
- start?: Date | string;
23
- end?: Date | string;
24
- limit?: number;
25
- sort?: "asc" | "desc";
26
- page_token?: string;
27
- include_content?: boolean;
28
- }): Promise<{
29
- news: SimpleNews[];
30
- nextPageToken?: string;
31
- }>;
32
- //# sourceMappingURL=market-data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"market-data.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/market-data.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,oBAAoB,EAEpB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAWlC;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAChE,OAAO,CAAC,oBAAoB,CAAC,CA4B/B;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;IACP,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GACA,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqIzD"}
@@ -1,84 +0,0 @@
1
- /**
2
- * Legacy Alpaca Order Functions
3
- * Order management using AlpacaAuth pattern with direct fetch calls.
4
- */
5
- import { AlpacaAuth, AlpacaOrder, CreateOrderParams, GetOrdersParams, ReplaceOrderParams } from "../../types/alpaca-types";
6
- /**
7
- * Makes a generic authenticated request to the Alpaca API.
8
- * @param auth - The authentication details for Alpaca
9
- * @param params - Request parameters including endpoint, method, body, queryString, and apiBaseUrl
10
- * @returns The parsed JSON response
11
- * @throws Error if the request fails
12
- */
13
- export declare function makeRequest<T = unknown>(auth: AlpacaAuth, params: {
14
- endpoint: string;
15
- method: string;
16
- body?: Record<string, unknown> | CreateOrderParams;
17
- queryString?: string;
18
- apiBaseUrl?: string;
19
- }): Promise<T>;
20
- /**
21
- * Creates a new order in Alpaca.
22
- * @param auth - The authentication details for Alpaca
23
- * @param params - The parameters for creating the order
24
- * @returns The created order
25
- */
26
- export declare function createOrder(auth: AlpacaAuth, params: CreateOrderParams): Promise<AlpacaOrder>;
27
- /**
28
- * Retrieves a list of orders from Alpaca with automatic pagination.
29
- * @param auth - The authentication details for Alpaca
30
- * @param params - The parameters for fetching orders
31
- * @returns The list of orders
32
- */
33
- export declare function getOrders(auth: AlpacaAuth, params?: GetOrdersParams): Promise<AlpacaOrder[]>;
34
- /**
35
- * Cancels all orders in Alpaca.
36
- * @param auth - The authentication details for Alpaca
37
- * @returns The list of canceled orders with their statuses
38
- */
39
- export declare function cancelAllOrders(auth: AlpacaAuth): Promise<{
40
- id: string;
41
- status: number;
42
- }[]>;
43
- /**
44
- * Retrieves a specific order from Alpaca.
45
- * @param auth - The authentication details for Alpaca
46
- * @param orderId - The ID of the order to retrieve
47
- * @param nested - Whether to include nested details
48
- * @returns The requested order
49
- */
50
- export declare function getOrder(auth: AlpacaAuth, orderId: string, nested?: boolean): Promise<AlpacaOrder>;
51
- /**
52
- * Replaces an existing order in Alpaca.
53
- * @param auth - The authentication details for Alpaca
54
- * @param orderId - The ID of the order to replace
55
- * @param params - The parameters for replacing the order
56
- * @returns The updated order
57
- */
58
- export declare function replaceOrder(auth: AlpacaAuth, orderId: string, params: ReplaceOrderParams): Promise<AlpacaOrder>;
59
- /**
60
- * Cancels a specific order in Alpaca.
61
- * @param auth - The authentication details for Alpaca
62
- * @param orderId - The ID of the order to cancel
63
- * @returns Success status and optional message if order not found
64
- */
65
- export declare function cancelOrder(auth: AlpacaAuth, orderId: string): Promise<{
66
- success: boolean;
67
- message?: string;
68
- }>;
69
- /**
70
- * Creates a limit order in Alpaca.
71
- * @param auth - The authentication details for Alpaca
72
- * @param params - Order parameters including symbol, qty, side, limitPrice, position_intent, extended_hours
73
- * @returns The created limit order
74
- */
75
- export declare function createLimitOrder(auth: AlpacaAuth, params?: {
76
- symbol: string;
77
- qty: number;
78
- side: "buy" | "sell";
79
- limitPrice: number;
80
- position_intent: "buy_to_open" | "buy_to_close" | "sell_to_open" | "sell_to_close";
81
- extended_hours: boolean;
82
- client_order_id?: string;
83
- }): Promise<AlpacaOrder>;
84
- //# sourceMappingURL=orders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/orders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AASlC;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC3C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,CAAC,CAAC,CAkEZ;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CA4BtB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,WAAW,EAAE,CAAC,CAoDxB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,UAAU,GACf,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CA0B3C;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,WAAW,CAAC,CAgCtB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,WAAW,CAAC,CA6BtB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA8BjD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,UAAU,EAChB,MAAM,GAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EACX,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAS1B,GACA,OAAO,CAAC,WAAW,CAAC,CAuCtB"}
@@ -1,66 +0,0 @@
1
- /**
2
- * Legacy Alpaca Position Functions
3
- * Position management using AlpacaAuth pattern with direct fetch calls.
4
- */
5
- import { AlpacaAuth, AlpacaOrder, AlpacaPosition } from "../../types/alpaca-types";
6
- /**
7
- * Fetches all positions for an Alpaca trading account.
8
- * @param auth - The authentication details for Alpaca
9
- * @returns The list of positions
10
- */
11
- export declare function fetchAllPositions(auth: AlpacaAuth): Promise<AlpacaPosition[]>;
12
- /**
13
- * Fetches a specific position for an Alpaca account.
14
- * @param auth - The authentication details for Alpaca
15
- * @param symbolOrAssetId - The symbol or asset ID to fetch the position for
16
- * @returns The position details or null with message if not found
17
- */
18
- export declare function fetchPosition(auth: AlpacaAuth, symbolOrAssetId: string): Promise<{
19
- position: AlpacaPosition | null;
20
- message?: string;
21
- }>;
22
- /**
23
- * Closes a specific position in Alpaca.
24
- * @param auth - The authentication details for Alpaca
25
- * @param symbolOrAssetId - The symbol or asset ID of the position to close
26
- * @param params - Optional parameters for closing the position
27
- * @returns The order created to close the position
28
- */
29
- export declare function closePosition(auth: AlpacaAuth, symbolOrAssetId: string, params?: {
30
- qty?: number;
31
- percentage?: number;
32
- useLimitOrder?: boolean;
33
- cancelOrders?: boolean;
34
- slippagePercent1?: number;
35
- extendedHours?: boolean;
36
- }): Promise<AlpacaOrder>;
37
- /**
38
- * Closes all positions in Alpaca.
39
- * @param auth - The authentication details for Alpaca
40
- * @param params - Optional parameters for closing all positions
41
- * @returns The status of each position closure attempt
42
- */
43
- export declare function closeAllPositions(auth: AlpacaAuth, params?: {
44
- cancel_orders?: boolean;
45
- useLimitOrders?: boolean;
46
- slippagePercent1?: number;
47
- }): Promise<Array<{
48
- symbol: string;
49
- status: number;
50
- body?: AlpacaOrder;
51
- }> | void>;
52
- /**
53
- * Closes all positions in Alpaca using limit orders during extended hours trading.
54
- * @param auth - The authentication details for Alpaca
55
- * @param params - Optional parameters for closing all positions
56
- * @returns The status of each position closure attempt
57
- */
58
- export declare function closeAllPositionsAfterHours(auth: AlpacaAuth, params?: {
59
- cancel_orders?: boolean;
60
- slippagePercent1?: number;
61
- }): Promise<Array<{
62
- symbol: string;
63
- status: number;
64
- body?: AlpacaOrder;
65
- }> | void>;
66
- //# sourceMappingURL=positions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"positions.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/positions.ts"],"names":[],"mappings":"AAAA;;;GAGG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CAAC,EAAE,MAAM,CAAC;CACsB,GACjD,OAAO,CAAC,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC,GAAG,IAAI,CAAC,CAoGT"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Legacy Alpaca Utility Functions
3
- * HTML content cleaning and price rounding helpers.
4
- */
5
- /**
6
- * Round a price to the nearest 2 decimal places for Alpaca,
7
- * or 4 decimal places for prices less than $1.
8
- * @param price - The price to round
9
- * @returns The rounded price
10
- */
11
- export declare const roundPriceForAlpaca: (price: number) => number;
12
- /**
13
- * Cleans HTML content by removing tags, scripts, styles, and decoding entities.
14
- * @param htmlContent - The HTML string to clean
15
- * @returns The cleaned plain-text string
16
- */
17
- export declare function cleanContent(htmlContent: string): string;
18
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/alpaca/legacy/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,MAInD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsCxD"}