@adaptic/utils 0.0.1001 → 0.0.1002
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +160 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +158 -24
- package/dist/index.mjs.map +1 -1
- package/dist/types/__tests__/broker-factory.test.d.ts +2 -0
- package/dist/types/__tests__/broker-factory.test.d.ts.map +1 -0
- package/dist/types/__tests__/broker-types.test.d.ts +2 -0
- package/dist/types/__tests__/broker-types.test.d.ts.map +1 -0
- package/dist/types/alpaca/client.d.ts +1 -1
- package/dist/types/alpaca/client.d.ts.map +1 -1
- package/dist/types/alpaca/legacy/auth.d.ts +27 -0
- package/dist/types/alpaca/legacy/auth.d.ts.map +1 -1
- package/dist/types/alpaca/legacy/index.d.ts +1 -1
- package/dist/types/alpaca/legacy/index.d.ts.map +1 -1
- package/dist/types/broker/factory.d.ts +70 -0
- package/dist/types/broker/factory.d.ts.map +1 -0
- package/dist/types/broker/index.d.ts +9 -0
- package/dist/types/broker/index.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +14 -0
- package/dist/types/errors/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/performance-metrics.d.ts.map +1 -1
- package/dist/types/types/alpaca-types.d.ts +1 -0
- package/dist/types/types/alpaca-types.d.ts.map +1 -1
- package/dist/types/types/broker-types.d.ts +112 -0
- package/dist/types/types/broker-types.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2357,6 +2357,23 @@ class NetworkError extends AdapticUtilsError {
|
|
|
2357
2357
|
this.service = service;
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Unsupported brokerage provider errors
|
|
2362
|
+
* Thrown when a broker operation is requested for a provider that has no
|
|
2363
|
+
* implemented integration (e.g. IBKR or COINBASE before their adapters land,
|
|
2364
|
+
* or an unrecognised provider string from an untyped caller).
|
|
2365
|
+
* Never retryable — the caller must route to a supported provider.
|
|
2366
|
+
*/
|
|
2367
|
+
class UnsupportedBrokerError extends AdapticUtilsError {
|
|
2368
|
+
provider;
|
|
2369
|
+
constructor(
|
|
2370
|
+
/** The provider that was requested but is not supported. */
|
|
2371
|
+
provider, cause) {
|
|
2372
|
+
super(`Brokerage provider "${provider}" is not supported. Supported providers: ALPACA`, "UNSUPPORTED_BROKER", "broker", false, // Unsupported providers are never retryable
|
|
2373
|
+
cause);
|
|
2374
|
+
this.provider = provider;
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2360
2377
|
/**
|
|
2361
2378
|
* Data parsing and format errors
|
|
2362
2379
|
* Used when API responses cannot be parsed or are in unexpected format
|
|
@@ -5771,9 +5788,18 @@ class AlpacaTradingAPI {
|
|
|
5771
5788
|
*
|
|
5772
5789
|
* @param auth - The authentication details for Alpaca
|
|
5773
5790
|
* @returns Validated authentication credentials
|
|
5791
|
+
* @throws UnsupportedBrokerError if `auth.provider` is set to a non-ALPACA provider
|
|
5774
5792
|
* @throws Error if authentication details are missing or invalid
|
|
5775
5793
|
*/
|
|
5776
5794
|
async function validateAuth(auth) {
|
|
5795
|
+
// Multi-broker guard (SP2): this seam only resolves Alpaca credentials.
|
|
5796
|
+
// `auth.provider` is typed as "ALPACA" on AlpacaAuth, but untyped callers
|
|
5797
|
+
// (or future BrokerAuth adapters) may pass other providers at runtime —
|
|
5798
|
+
// fail fast with a typed error instead of silently hitting Alpaca hosts.
|
|
5799
|
+
const requestedProvider = auth.provider;
|
|
5800
|
+
if (requestedProvider !== undefined && requestedProvider !== "ALPACA") {
|
|
5801
|
+
throw new UnsupportedBrokerError(requestedProvider);
|
|
5802
|
+
}
|
|
5777
5803
|
const inlineKey = auth.alpacaApiKey && auth.alpacaApiKey.trim().length > 0
|
|
5778
5804
|
? auth.alpacaApiKey
|
|
5779
5805
|
: undefined;
|
|
@@ -5795,26 +5821,54 @@ async function validateAuth(auth) {
|
|
|
5795
5821
|
};
|
|
5796
5822
|
}
|
|
5797
5823
|
if (auth.adapticAccountId) {
|
|
5798
|
-
|
|
5799
|
-
const alpacaAccount = (await adaptic$1.alpacaAccount.get({
|
|
5800
|
-
id: auth.adapticAccountId,
|
|
5801
|
-
}, client));
|
|
5802
|
-
if (!alpacaAccount || !alpacaAccount.APIKey || !alpacaAccount.APISecret) {
|
|
5803
|
-
throw new Error("Alpaca account not found or incomplete");
|
|
5804
|
-
}
|
|
5805
|
-
validateAlpacaCredentials({
|
|
5806
|
-
apiKey: alpacaAccount.APIKey,
|
|
5807
|
-
apiSecret: alpacaAccount.APISecret,
|
|
5808
|
-
isPaper: alpacaAccount.type === "PAPER",
|
|
5809
|
-
});
|
|
5810
|
-
return {
|
|
5811
|
-
APIKey: alpacaAccount.APIKey,
|
|
5812
|
-
APISecret: alpacaAccount.APISecret,
|
|
5813
|
-
type: alpacaAccount.type,
|
|
5814
|
-
};
|
|
5824
|
+
return resolveBrokerCredentials(auth.adapticAccountId);
|
|
5815
5825
|
}
|
|
5816
5826
|
throw new Error("Either adapticAccountId or both alpacaApiKey and alpacaApiSecret must be provided");
|
|
5817
5827
|
}
|
|
5828
|
+
/**
|
|
5829
|
+
* Resolves broker credentials for a backend brokerage-account id.
|
|
5830
|
+
*
|
|
5831
|
+
* This is the SINGLE backend-coupled credential lookup in this package —
|
|
5832
|
+
* every account-id-based credential resolution must flow through here so
|
|
5833
|
+
* that backend model changes touch exactly one function.
|
|
5834
|
+
*
|
|
5835
|
+
* SP2 transition note: today the id is an `AlpacaAccount.id` resolved via
|
|
5836
|
+
* `adaptic.alpacaAccount.get`. When backend-legacy publishes the
|
|
5837
|
+
* `BrokerageAccount` model (backfilled with `id = AlpacaAccount.id`, so the
|
|
5838
|
+
* id space is identical), the switch to `adaptic.brokerageAccount.get`
|
|
5839
|
+
* happens INSIDE this function only, following the sequencing rule in
|
|
5840
|
+
* CLAUDE.md ("Multi-Broker Sequencing Rule"): backend-legacy publishes →
|
|
5841
|
+
* utils bumps the dependency and switches this helper → utils publishes →
|
|
5842
|
+
* engine bumps its pin. Do not reference `brokerageAccount` anywhere in
|
|
5843
|
+
* this package before the pinned backend-legacy version exports it.
|
|
5844
|
+
*
|
|
5845
|
+
* The lookup is a no-cache GraphQL round trip to backend-legacy; callers
|
|
5846
|
+
* holding inline credentials should never reach it (see `validateAuth`
|
|
5847
|
+
* precedence).
|
|
5848
|
+
*
|
|
5849
|
+
* @param brokerageAccountId - Backend brokerage-account id (currently the AlpacaAccount id)
|
|
5850
|
+
* @returns Validated authentication credentials
|
|
5851
|
+
* @throws Error if the account is not found or its credentials are incomplete
|
|
5852
|
+
*/
|
|
5853
|
+
async function resolveBrokerCredentials(brokerageAccountId) {
|
|
5854
|
+
const client = await getSharedApolloClient();
|
|
5855
|
+
const alpacaAccount = (await adaptic$1.alpacaAccount.get({
|
|
5856
|
+
id: brokerageAccountId,
|
|
5857
|
+
}, client));
|
|
5858
|
+
if (!alpacaAccount || !alpacaAccount.APIKey || !alpacaAccount.APISecret) {
|
|
5859
|
+
throw new Error("Alpaca account not found or incomplete");
|
|
5860
|
+
}
|
|
5861
|
+
validateAlpacaCredentials({
|
|
5862
|
+
apiKey: alpacaAccount.APIKey,
|
|
5863
|
+
apiSecret: alpacaAccount.APISecret,
|
|
5864
|
+
isPaper: alpacaAccount.type === "PAPER",
|
|
5865
|
+
});
|
|
5866
|
+
return {
|
|
5867
|
+
APIKey: alpacaAccount.APIKey,
|
|
5868
|
+
APISecret: alpacaAccount.APISecret,
|
|
5869
|
+
type: alpacaAccount.type,
|
|
5870
|
+
};
|
|
5871
|
+
}
|
|
5818
5872
|
|
|
5819
5873
|
/**
|
|
5820
5874
|
* Legacy Alpaca Utility Functions
|
|
@@ -7944,6 +7998,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
7944
7998
|
getOrders: getOrders$1,
|
|
7945
7999
|
makeRequest: makeRequest,
|
|
7946
8000
|
replaceOrder: replaceOrder$1,
|
|
8001
|
+
resolveBrokerCredentials: resolveBrokerCredentials,
|
|
7947
8002
|
roundPriceForAlpaca: roundPriceForAlpaca$5,
|
|
7948
8003
|
updateConfiguration: updateConfiguration,
|
|
7949
8004
|
validateAuth: validateAuth
|
|
@@ -11166,9 +11221,16 @@ function calculateBetaFromReturns(portfolioReturns, benchmarkReturns) {
|
|
|
11166
11221
|
const denom = n > 1 ? n - 1 : 1;
|
|
11167
11222
|
covariance /= denom;
|
|
11168
11223
|
variance /= denom;
|
|
11169
|
-
// Handle zero variance
|
|
11170
|
-
|
|
11171
|
-
|
|
11224
|
+
// Handle zero (or numerically-degenerate) variance. A constant benchmark
|
|
11225
|
+
// series can still produce a tiny nonzero variance because the computed
|
|
11226
|
+
// mean differs from the constant by an ulp; dividing covariance by that
|
|
11227
|
+
// rounding noise yields a meaningless beta. Treat any variance at or
|
|
11228
|
+
// below the summation noise floor — (n * eps * |mean|)^2, the square of
|
|
11229
|
+
// the worst-case naive-summation error — as zero. When the mean is
|
|
11230
|
+
// exactly 0 this reduces to the exact zero check.
|
|
11231
|
+
const varianceNoiseFloor = (n * Number.EPSILON * Math.abs(averageBenchmarkReturn)) ** 2;
|
|
11232
|
+
if (variance <= varianceNoiseFloor) {
|
|
11233
|
+
getLogger().warn("Benchmark variance is zero or below the floating-point noise floor. Setting beta to 0.");
|
|
11172
11234
|
return {
|
|
11173
11235
|
beta: 0,
|
|
11174
11236
|
covariance,
|
|
@@ -12347,8 +12409,33 @@ const timeDiffString = (milliseconds) => {
|
|
|
12347
12409
|
return parts.join(", ");
|
|
12348
12410
|
};
|
|
12349
12411
|
|
|
12412
|
+
/**
|
|
12413
|
+
* Multi-broker foundation types
|
|
12414
|
+
*
|
|
12415
|
+
* Provider-agnostic brokerage types for the org → fund → brokerageAccount →
|
|
12416
|
+
* broker alignment (SP2). These are strictly ADDITIVE: the existing
|
|
12417
|
+
* Alpaca-specific types (`AlpacaAuth`, `AlpacaCredentials`,
|
|
12418
|
+
* `AlpacaClientConfig`) remain the canonical shapes consumed by the engine
|
|
12419
|
+
* and are unchanged. New provider-aware call sites should prefer these
|
|
12420
|
+
* types; only ALPACA is implemented today — IBKR and COINBASE arms are
|
|
12421
|
+
* typed placeholders that resolve to `UnsupportedBrokerError` at runtime.
|
|
12422
|
+
*
|
|
12423
|
+
* @module @adaptic/utils/types/broker-types
|
|
12424
|
+
*/
|
|
12425
|
+
/**
|
|
12426
|
+
* Type guard narrowing {@link BrokerCredentials} to the implemented
|
|
12427
|
+
* ALPACA arm.
|
|
12428
|
+
*
|
|
12429
|
+
* @param credentials - Any broker credentials union member
|
|
12430
|
+
* @returns True when the credentials belong to the ALPACA provider
|
|
12431
|
+
*/
|
|
12432
|
+
function isAlpacaBrokerCredentials(credentials) {
|
|
12433
|
+
return credentials.provider === "ALPACA";
|
|
12434
|
+
}
|
|
12435
|
+
|
|
12350
12436
|
var Types = /*#__PURE__*/Object.freeze({
|
|
12351
|
-
__proto__: null
|
|
12437
|
+
__proto__: null,
|
|
12438
|
+
isAlpacaBrokerCredentials: isAlpacaBrokerCredentials
|
|
12352
12439
|
});
|
|
12353
12440
|
|
|
12354
12441
|
/**
|
|
@@ -50661,12 +50748,16 @@ class AlpacaClient {
|
|
|
50661
50748
|
}
|
|
50662
50749
|
// Client cache for connection pooling
|
|
50663
50750
|
const clientCache = new Map();
|
|
50751
|
+
// Provider discriminant for cache-key scoping (multi-broker SP2 seam):
|
|
50752
|
+
// keeps Alpaca pool entries disjoint from future providers that might
|
|
50753
|
+
// reuse an identical apiKey string.
|
|
50754
|
+
const ALPACA_PROVIDER = "ALPACA";
|
|
50664
50755
|
/**
|
|
50665
50756
|
* Create or get a cached Alpaca client
|
|
50666
|
-
* Uses apiKey as cache key for connection pooling
|
|
50757
|
+
* Uses provider + apiKey + accountType as cache key for connection pooling
|
|
50667
50758
|
*/
|
|
50668
50759
|
function createAlpacaClient(config) {
|
|
50669
|
-
const cacheKey = `${config.apiKey}-${config.accountType}`;
|
|
50760
|
+
const cacheKey = `${ALPACA_PROVIDER}-${config.apiKey}-${config.accountType}`;
|
|
50670
50761
|
if (clientCache.has(cacheKey)) {
|
|
50671
50762
|
log$k(`Returning cached client for ${config.accountType}`, { type: "debug" });
|
|
50672
50763
|
return clientCache.get(cacheKey);
|
|
@@ -68786,6 +68877,49 @@ function verifyFetchKeepAlive() {
|
|
|
68786
68877
|
};
|
|
68787
68878
|
}
|
|
68788
68879
|
|
|
68880
|
+
/**
|
|
68881
|
+
* Broker Client Factory
|
|
68882
|
+
*
|
|
68883
|
+
* Provider-agnostic entry point for broker trading clients (SP2 multi-broker
|
|
68884
|
+
* seam). Strictly ADDITIVE: `createAlpacaClient`, `createAlpacaTradingAPI`,
|
|
68885
|
+
* and `createAlpacaMarketDataAPI` remain the canonical Alpaca factories and
|
|
68886
|
+
* are unchanged. Only ALPACA is implemented — all other providers throw a
|
|
68887
|
+
* typed {@link UnsupportedBrokerError}.
|
|
68888
|
+
*
|
|
68889
|
+
* @module @adaptic/utils/broker
|
|
68890
|
+
*/
|
|
68891
|
+
/**
|
|
68892
|
+
* Create (or reuse from cache) a broker trading client for the given
|
|
68893
|
+
* credentials.
|
|
68894
|
+
*
|
|
68895
|
+
* ALPACA delegates to `createAlpacaClient`, whose connection-pool cache key
|
|
68896
|
+
* is provider-scoped (`ALPACA-<apiKey>-<accountType>`), so a future
|
|
68897
|
+
* provider reusing an identical apiKey string can never collide with an
|
|
68898
|
+
* Alpaca client. All other providers — including unknown provider strings
|
|
68899
|
+
* from untyped callers — throw {@link UnsupportedBrokerError}.
|
|
68900
|
+
*
|
|
68901
|
+
* @param credentials - Discriminated broker credentials union
|
|
68902
|
+
* @returns A provider-appropriate {@link BrokerTradingClient}
|
|
68903
|
+
* @throws UnsupportedBrokerError for any provider other than ALPACA
|
|
68904
|
+
*/
|
|
68905
|
+
function createBrokerClient(credentials) {
|
|
68906
|
+
switch (credentials.provider) {
|
|
68907
|
+
case "ALPACA":
|
|
68908
|
+
return createAlpacaClient({
|
|
68909
|
+
apiKey: credentials.apiKey,
|
|
68910
|
+
apiSecret: credentials.apiSecret,
|
|
68911
|
+
accountType: credentials.type,
|
|
68912
|
+
});
|
|
68913
|
+
case "IBKR":
|
|
68914
|
+
case "COINBASE":
|
|
68915
|
+
throw new UnsupportedBrokerError(credentials.provider);
|
|
68916
|
+
}
|
|
68917
|
+
// Unreachable for typed callers (the switch above is exhaustive), but
|
|
68918
|
+
// untyped runtime callers may pass an unrecognised provider string —
|
|
68919
|
+
// fail fast with the same typed error rather than undefined behaviour.
|
|
68920
|
+
throw new UnsupportedBrokerError(String(credentials.provider));
|
|
68921
|
+
}
|
|
68922
|
+
|
|
68789
68923
|
/**
|
|
68790
68924
|
* Mirror enums for the trading policy preference system.
|
|
68791
68925
|
* These enums are used by both the trading engine and the frontend app
|
|
@@ -69866,5 +70000,5 @@ const adaptic = {
|
|
|
69866
70000
|
};
|
|
69867
70001
|
const adptc = adaptic;
|
|
69868
70002
|
|
|
69869
|
-
export { API_RETRY_CONFIGS, AVNewsArticleSchema, AVNewsResponseSchema, AdapticUtilsError, AlpacaAccountDetailsSchema, AlpacaApiError, AlpacaBarSchema, AlpacaClient, AlpacaCryptoBarsResponseSchema, AlpacaHistoricalBarsResponseSchema, AlpacaLatestBarsResponseSchema, AlpacaLatestQuotesResponseSchema, AlpacaLatestTradesResponseSchema, AlpacaMarketDataAPI, AlpacaNewsArticleSchema, AlpacaNewsResponseSchema, AlpacaOrderSchema, AlpacaOrdersArraySchema, AlpacaPortfolioHistoryResponseSchema, AlpacaPositionSchema, AlpacaPositionsArraySchema, AlpacaQuoteSchema, AlpacaTradeSchema, AlpacaTradingAPI, AlphaVantageError, AlphaVantageQuoteResponseSchema, AssetAllocationEngine, AuthenticationError, AutonomyMode, BTC_PAIRS, BarError, CircuitOpenError, CryptoDataError, CryptoOrderError, DEFAULT_CACHE_OPTIONS, DEFAULT_RISK_FREE_RATE, DEFAULT_TIMEOUTS, DEFAULT_TRADING_POLICY, DataFormatError, DecisionMemoryOutcome, DecisionOutcome, DecisionRecordStatus, HttpClientError, HttpServerError, KEEP_ALIVE_DEFAULTS, LlmProvider, MARKET_DATA_API, MassiveAggregatesResponseSchema, MassiveApiError, MassiveDailyOpenCloseSchema, MassiveErrorResponseSchema, MassiveGroupedDailyResponseSchema, MassiveLastTradeResponseSchema, MassiveTickerDetailsResponseSchema, MassiveTickerInfoSchema, MassiveTradeSchema as MassiveTradeZodSchema, MassiveTradesResponseSchema, NetworkError, NewsError, OptionStrategyError, OptionsDataError, OverlaySeverity, OverlayStatus, OverlayType, QuoteError, RISK_FREE_RATE_TTL_MS, RateLimitError, RawMassivePriceDataSchema, StampedeProtectedCache, TRADING_API, TimeoutError, TokenBucketRateLimiter, TradeError, TrailingStopValidationError, USDC_PAIRS, USDT_PAIRS, USD_PAIRS, ValidationError, ValidationResponseError, WEBSOCKET_STREAMS, WebSocketError, account, adaptic, adptc, alpaca, analyzeBars, approximateImpliedVolatility, atrNs as atr, bracketOrders, buildOCCSymbol, buildOptionSymbol, buyCryptoNotional, buyToClose, buyToOpen, buyWithStopLoss, buyWithTrailingStop, calculateMoneyness, calculateOrderValue, calculatePeriodPerformance, calculatePutCallRatio, calculateTotalFilledValue, cancelAllCryptoOrders, cancelOCOOrder, cancelOTOOrder, cancelTrailingStop, cancelTrailingStopsForSymbol, checkTradingEligibility, clearClientCache, clock, closeAllOptionPositions, closeOptionPosition, createAlpacaClient, createAlpacaMarketDataAPI, createAlpacaTradingAPI, createBracketOrder, createButterflySpread, createClientFromEnv, createCoveredCall, createCryptoLimitOrder, createCryptoMarketOrder, createCryptoOrder, createCryptoStopLimitOrder, createCryptoStopOrder, createExecutorFromTradingAPI, createIronCondor$1 as createIronCondor, createIronCondor as createIronCondorAdvanced, createMultiLegOptionOrder, createOCOOrder, createOTOOrder, createOptionOrder, createPortfolioTrailingStops, createProtectiveBracket, createStampedeProtectedCache, createStraddle$1 as createStraddle, createStraddle as createStraddleAdvanced, createStrangle$1 as createStrangle, createStrangle as createStrangleAdvanced, createStreamManager, createTimeoutSignal, createTrailingStop, createVerticalSpread$1 as createVerticalSpread, createVerticalSpread as createVerticalSpreadAdvanced, entryWithPercentStopLoss, exerciseOption, extractGreeks, filterByExpiration, filterByStrike, filterByType, filterOrdersByDateRange, findATMOptions, findATMStrikes, findNearestExpiration, findOptionsByDelta, formatOrderForLog, formatOrderSummary, generateOptimalAllocation, getAccountConfiguration, getAccountDetails, getAccountSummary, getAgentPoolStatus, getAllOrders, getAlpacaCalendar, getAlpacaClock, getAverageDailyVolume, getBars, getBuyingPower, getCachedRiskFreeRateSync, getCachedRiskFreeRateSyncWithProvenance, getCrypto24HourChange, getCryptoBars, getCryptoDailyPrices, getCryptoPairsByQuote, getCryptoPrice, getCryptoSnapshots, getCryptoSpread, getCryptoStreamUrl, getCryptoTrades, getCurrentPrice, getCurrentPrices, getDailyPrices, getDailyReturns, getDaysToExpiration, getDefaultRiskProfile, getEquityCurve, getExpirationDates, getFilledOrders, getGroupedOptionChain, getHistoricalOptionsBars, getHistoricalTrades, getIntradayPrices, getLatestBars, getLatestCryptoQuotes, getLatestCryptoTrades, getLatestNews, getLatestOptionsQuotes, getLatestOptionsTrades, getLatestQuote, getLatestQuotes, getLatestTrade, getLatestTrades, getLogger, getMarginInfo, getNews, getNewsForSymbols, getOCOOrderStatus, getOTOOrderStatus, getOpenCryptoOrders, getOpenOrders$1 as getOpenOrdersQuery, getOpenTrailingStops, getOptionChain, getOptionContract, getOptionContracts, getOptionSpread, getOptionsChain, getOptionsSnapshots, getOptionsStreamUrl, getOptionsTradingLevel, getOrderHistory, getOrdersBySymbol, getPDTStatus, getPopularCryptoPairs, getPortfolioHistory, getPreviousClose, getPriceRange, getRiskFreeRate, getRiskFreeRateWithProvenance, getSpread, getSpreads, getStockStreamUrl, getStrikePrices, getSupportedCryptoPairs, getSymbolSentiment, getTimeout, getTradeVolume, getTradingApiUrl, getTradingWebSocketUrl, getTrailingStopHWM, groupOrdersByStatus, groupOrdersBySymbol, hasActiveTrailingStop, hasGoodLiquidity as hasOptionLiquidity, hasGoodLiquidity$1 as hasStockLiquidity, hasSufficientVolume, httpAgent, httpsAgent, isContractTradable, isCryptoPair, isExpiringWithin, isMarginAccount, isOptionOrderCancelable, isOptionOrderTerminal, isOrderFillable, isOrderFilled, isOrderOpen, isOrderTerminal$1 as isOrderTerminalStatus, isSupportedCryptoPair, isTransientNetworkError, index$1 as legacyApi, limitBuyWithTakeProfit, ocoOrders, orderUtils, otoOrders, paginate, paginateAll, parseOCCSymbol, protectLongPosition, protectShortPosition, rateLimiters, resetLogger, resetRiskFreeRateCache, riskNs as risk, rollOptionPosition, roundPriceForAlpaca$3 as roundPriceForAlpaca, roundPriceForAlpacaNumber, safeValidateResponse, searchNews, sellAllCrypto, sellCryptoNotional, sellToClose, sellToOpen, setLogger, setRiskFreeRate, shortWithStopLoss, sortOrdersByDate, strategyNs as strategy, index as tradingPolicy, trailingStops, updateAccountConfiguration, updateTrailingStop, validateAlpacaCredentials, validateAlphaVantageApiKey, validateMassiveApiKey$1 as validateMassiveApiKey, validateMultiLegOrder, validateResponse, verifyFetchKeepAlive, volatilityNs as volatility, waitForOrderFill, withRetry, withTimeout };
|
|
70003
|
+
export { API_RETRY_CONFIGS, AVNewsArticleSchema, AVNewsResponseSchema, AdapticUtilsError, AlpacaAccountDetailsSchema, AlpacaApiError, AlpacaBarSchema, AlpacaClient, AlpacaCryptoBarsResponseSchema, AlpacaHistoricalBarsResponseSchema, AlpacaLatestBarsResponseSchema, AlpacaLatestQuotesResponseSchema, AlpacaLatestTradesResponseSchema, AlpacaMarketDataAPI, AlpacaNewsArticleSchema, AlpacaNewsResponseSchema, AlpacaOrderSchema, AlpacaOrdersArraySchema, AlpacaPortfolioHistoryResponseSchema, AlpacaPositionSchema, AlpacaPositionsArraySchema, AlpacaQuoteSchema, AlpacaTradeSchema, AlpacaTradingAPI, AlphaVantageError, AlphaVantageQuoteResponseSchema, AssetAllocationEngine, AuthenticationError, AutonomyMode, BTC_PAIRS, BarError, CircuitOpenError, CryptoDataError, CryptoOrderError, DEFAULT_CACHE_OPTIONS, DEFAULT_RISK_FREE_RATE, DEFAULT_TIMEOUTS, DEFAULT_TRADING_POLICY, DataFormatError, DecisionMemoryOutcome, DecisionOutcome, DecisionRecordStatus, HttpClientError, HttpServerError, KEEP_ALIVE_DEFAULTS, LlmProvider, MARKET_DATA_API, MassiveAggregatesResponseSchema, MassiveApiError, MassiveDailyOpenCloseSchema, MassiveErrorResponseSchema, MassiveGroupedDailyResponseSchema, MassiveLastTradeResponseSchema, MassiveTickerDetailsResponseSchema, MassiveTickerInfoSchema, MassiveTradeSchema as MassiveTradeZodSchema, MassiveTradesResponseSchema, NetworkError, NewsError, OptionStrategyError, OptionsDataError, OverlaySeverity, OverlayStatus, OverlayType, QuoteError, RISK_FREE_RATE_TTL_MS, RateLimitError, RawMassivePriceDataSchema, StampedeProtectedCache, TRADING_API, TimeoutError, TokenBucketRateLimiter, TradeError, TrailingStopValidationError, USDC_PAIRS, USDT_PAIRS, USD_PAIRS, UnsupportedBrokerError, ValidationError, ValidationResponseError, WEBSOCKET_STREAMS, WebSocketError, account, adaptic, adptc, alpaca, analyzeBars, approximateImpliedVolatility, atrNs as atr, bracketOrders, buildOCCSymbol, buildOptionSymbol, buyCryptoNotional, buyToClose, buyToOpen, buyWithStopLoss, buyWithTrailingStop, calculateMoneyness, calculateOrderValue, calculatePeriodPerformance, calculatePutCallRatio, calculateTotalFilledValue, cancelAllCryptoOrders, cancelOCOOrder, cancelOTOOrder, cancelTrailingStop, cancelTrailingStopsForSymbol, checkTradingEligibility, clearClientCache, clock, closeAllOptionPositions, closeOptionPosition, createAlpacaClient, createAlpacaMarketDataAPI, createAlpacaTradingAPI, createBracketOrder, createBrokerClient, createButterflySpread, createClientFromEnv, createCoveredCall, createCryptoLimitOrder, createCryptoMarketOrder, createCryptoOrder, createCryptoStopLimitOrder, createCryptoStopOrder, createExecutorFromTradingAPI, createIronCondor$1 as createIronCondor, createIronCondor as createIronCondorAdvanced, createMultiLegOptionOrder, createOCOOrder, createOTOOrder, createOptionOrder, createPortfolioTrailingStops, createProtectiveBracket, createStampedeProtectedCache, createStraddle$1 as createStraddle, createStraddle as createStraddleAdvanced, createStrangle$1 as createStrangle, createStrangle as createStrangleAdvanced, createStreamManager, createTimeoutSignal, createTrailingStop, createVerticalSpread$1 as createVerticalSpread, createVerticalSpread as createVerticalSpreadAdvanced, entryWithPercentStopLoss, exerciseOption, extractGreeks, filterByExpiration, filterByStrike, filterByType, filterOrdersByDateRange, findATMOptions, findATMStrikes, findNearestExpiration, findOptionsByDelta, formatOrderForLog, formatOrderSummary, generateOptimalAllocation, getAccountConfiguration, getAccountDetails, getAccountSummary, getAgentPoolStatus, getAllOrders, getAlpacaCalendar, getAlpacaClock, getAverageDailyVolume, getBars, getBuyingPower, getCachedRiskFreeRateSync, getCachedRiskFreeRateSyncWithProvenance, getCrypto24HourChange, getCryptoBars, getCryptoDailyPrices, getCryptoPairsByQuote, getCryptoPrice, getCryptoSnapshots, getCryptoSpread, getCryptoStreamUrl, getCryptoTrades, getCurrentPrice, getCurrentPrices, getDailyPrices, getDailyReturns, getDaysToExpiration, getDefaultRiskProfile, getEquityCurve, getExpirationDates, getFilledOrders, getGroupedOptionChain, getHistoricalOptionsBars, getHistoricalTrades, getIntradayPrices, getLatestBars, getLatestCryptoQuotes, getLatestCryptoTrades, getLatestNews, getLatestOptionsQuotes, getLatestOptionsTrades, getLatestQuote, getLatestQuotes, getLatestTrade, getLatestTrades, getLogger, getMarginInfo, getNews, getNewsForSymbols, getOCOOrderStatus, getOTOOrderStatus, getOpenCryptoOrders, getOpenOrders$1 as getOpenOrdersQuery, getOpenTrailingStops, getOptionChain, getOptionContract, getOptionContracts, getOptionSpread, getOptionsChain, getOptionsSnapshots, getOptionsStreamUrl, getOptionsTradingLevel, getOrderHistory, getOrdersBySymbol, getPDTStatus, getPopularCryptoPairs, getPortfolioHistory, getPreviousClose, getPriceRange, getRiskFreeRate, getRiskFreeRateWithProvenance, getSpread, getSpreads, getStockStreamUrl, getStrikePrices, getSupportedCryptoPairs, getSymbolSentiment, getTimeout, getTradeVolume, getTradingApiUrl, getTradingWebSocketUrl, getTrailingStopHWM, groupOrdersByStatus, groupOrdersBySymbol, hasActiveTrailingStop, hasGoodLiquidity as hasOptionLiquidity, hasGoodLiquidity$1 as hasStockLiquidity, hasSufficientVolume, httpAgent, httpsAgent, isAlpacaBrokerCredentials, isContractTradable, isCryptoPair, isExpiringWithin, isMarginAccount, isOptionOrderCancelable, isOptionOrderTerminal, isOrderFillable, isOrderFilled, isOrderOpen, isOrderTerminal$1 as isOrderTerminalStatus, isSupportedCryptoPair, isTransientNetworkError, index$1 as legacyApi, limitBuyWithTakeProfit, ocoOrders, orderUtils, otoOrders, paginate, paginateAll, parseOCCSymbol, protectLongPosition, protectShortPosition, rateLimiters, resetLogger, resetRiskFreeRateCache, riskNs as risk, rollOptionPosition, roundPriceForAlpaca$3 as roundPriceForAlpaca, roundPriceForAlpacaNumber, safeValidateResponse, searchNews, sellAllCrypto, sellCryptoNotional, sellToClose, sellToOpen, setLogger, setRiskFreeRate, shortWithStopLoss, sortOrdersByDate, strategyNs as strategy, index as tradingPolicy, trailingStops, updateAccountConfiguration, updateTrailingStop, validateAlpacaCredentials, validateAlphaVantageApiKey, validateMassiveApiKey$1 as validateMassiveApiKey, validateMultiLegOrder, validateResponse, verifyFetchKeepAlive, volatilityNs as volatility, waitForOrderFill, withRetry, withTimeout };
|
|
69870
70004
|
//# sourceMappingURL=index.mjs.map
|