@adaptic/utils 0.0.1000 → 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 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +158 -30
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +0 -6
- package/dist/test.js.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/market-hours.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
|
@@ -1245,12 +1245,6 @@ const marketEarlyCloses = {
|
|
|
1245
1245
|
},
|
|
1246
1246
|
},
|
|
1247
1247
|
2026: {
|
|
1248
|
-
"2026-07-02": {
|
|
1249
|
-
date: "2026-07-02",
|
|
1250
|
-
time: "13:00",
|
|
1251
|
-
optionsTime: "13:15",
|
|
1252
|
-
notes: "Independence Day observed, market closes early at 1:00 p.m. (1:15 p.m. for eligible options). NYSE American Equities, NYSE Arca Equities, NYSE Chicago, and NYSE National late trading sessions will close at 5:00 p.m. Eastern Time.",
|
|
1253
|
-
},
|
|
1254
1248
|
"2026-11-27": {
|
|
1255
1249
|
date: "2026-11-27",
|
|
1256
1250
|
time: "13:00",
|
|
@@ -2363,6 +2357,23 @@ class NetworkError extends AdapticUtilsError {
|
|
|
2363
2357
|
this.service = service;
|
|
2364
2358
|
}
|
|
2365
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
|
+
}
|
|
2366
2377
|
/**
|
|
2367
2378
|
* Data parsing and format errors
|
|
2368
2379
|
* Used when API responses cannot be parsed or are in unexpected format
|
|
@@ -5777,9 +5788,18 @@ class AlpacaTradingAPI {
|
|
|
5777
5788
|
*
|
|
5778
5789
|
* @param auth - The authentication details for Alpaca
|
|
5779
5790
|
* @returns Validated authentication credentials
|
|
5791
|
+
* @throws UnsupportedBrokerError if `auth.provider` is set to a non-ALPACA provider
|
|
5780
5792
|
* @throws Error if authentication details are missing or invalid
|
|
5781
5793
|
*/
|
|
5782
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
|
+
}
|
|
5783
5803
|
const inlineKey = auth.alpacaApiKey && auth.alpacaApiKey.trim().length > 0
|
|
5784
5804
|
? auth.alpacaApiKey
|
|
5785
5805
|
: undefined;
|
|
@@ -5801,26 +5821,54 @@ async function validateAuth(auth) {
|
|
|
5801
5821
|
};
|
|
5802
5822
|
}
|
|
5803
5823
|
if (auth.adapticAccountId) {
|
|
5804
|
-
|
|
5805
|
-
const alpacaAccount = (await adaptic$1.alpacaAccount.get({
|
|
5806
|
-
id: auth.adapticAccountId,
|
|
5807
|
-
}, client));
|
|
5808
|
-
if (!alpacaAccount || !alpacaAccount.APIKey || !alpacaAccount.APISecret) {
|
|
5809
|
-
throw new Error("Alpaca account not found or incomplete");
|
|
5810
|
-
}
|
|
5811
|
-
validateAlpacaCredentials({
|
|
5812
|
-
apiKey: alpacaAccount.APIKey,
|
|
5813
|
-
apiSecret: alpacaAccount.APISecret,
|
|
5814
|
-
isPaper: alpacaAccount.type === "PAPER",
|
|
5815
|
-
});
|
|
5816
|
-
return {
|
|
5817
|
-
APIKey: alpacaAccount.APIKey,
|
|
5818
|
-
APISecret: alpacaAccount.APISecret,
|
|
5819
|
-
type: alpacaAccount.type,
|
|
5820
|
-
};
|
|
5824
|
+
return resolveBrokerCredentials(auth.adapticAccountId);
|
|
5821
5825
|
}
|
|
5822
5826
|
throw new Error("Either adapticAccountId or both alpacaApiKey and alpacaApiSecret must be provided");
|
|
5823
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
|
+
}
|
|
5824
5872
|
|
|
5825
5873
|
/**
|
|
5826
5874
|
* Legacy Alpaca Utility Functions
|
|
@@ -7950,6 +7998,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
7950
7998
|
getOrders: getOrders$1,
|
|
7951
7999
|
makeRequest: makeRequest,
|
|
7952
8000
|
replaceOrder: replaceOrder$1,
|
|
8001
|
+
resolveBrokerCredentials: resolveBrokerCredentials,
|
|
7953
8002
|
roundPriceForAlpaca: roundPriceForAlpaca$5,
|
|
7954
8003
|
updateConfiguration: updateConfiguration,
|
|
7955
8004
|
validateAuth: validateAuth
|
|
@@ -11172,9 +11221,16 @@ function calculateBetaFromReturns(portfolioReturns, benchmarkReturns) {
|
|
|
11172
11221
|
const denom = n > 1 ? n - 1 : 1;
|
|
11173
11222
|
covariance /= denom;
|
|
11174
11223
|
variance /= denom;
|
|
11175
|
-
// Handle zero variance
|
|
11176
|
-
|
|
11177
|
-
|
|
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.");
|
|
11178
11234
|
return {
|
|
11179
11235
|
beta: 0,
|
|
11180
11236
|
covariance,
|
|
@@ -12353,8 +12409,33 @@ const timeDiffString = (milliseconds) => {
|
|
|
12353
12409
|
return parts.join(", ");
|
|
12354
12410
|
};
|
|
12355
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
|
+
|
|
12356
12436
|
var Types = /*#__PURE__*/Object.freeze({
|
|
12357
|
-
__proto__: null
|
|
12437
|
+
__proto__: null,
|
|
12438
|
+
isAlpacaBrokerCredentials: isAlpacaBrokerCredentials
|
|
12358
12439
|
});
|
|
12359
12440
|
|
|
12360
12441
|
/**
|
|
@@ -50667,12 +50748,16 @@ class AlpacaClient {
|
|
|
50667
50748
|
}
|
|
50668
50749
|
// Client cache for connection pooling
|
|
50669
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";
|
|
50670
50755
|
/**
|
|
50671
50756
|
* Create or get a cached Alpaca client
|
|
50672
|
-
* Uses apiKey as cache key for connection pooling
|
|
50757
|
+
* Uses provider + apiKey + accountType as cache key for connection pooling
|
|
50673
50758
|
*/
|
|
50674
50759
|
function createAlpacaClient(config) {
|
|
50675
|
-
const cacheKey = `${config.apiKey}-${config.accountType}`;
|
|
50760
|
+
const cacheKey = `${ALPACA_PROVIDER}-${config.apiKey}-${config.accountType}`;
|
|
50676
50761
|
if (clientCache.has(cacheKey)) {
|
|
50677
50762
|
log$k(`Returning cached client for ${config.accountType}`, { type: "debug" });
|
|
50678
50763
|
return clientCache.get(cacheKey);
|
|
@@ -68792,6 +68877,49 @@ function verifyFetchKeepAlive() {
|
|
|
68792
68877
|
};
|
|
68793
68878
|
}
|
|
68794
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
|
+
|
|
68795
68923
|
/**
|
|
68796
68924
|
* Mirror enums for the trading policy preference system.
|
|
68797
68925
|
* These enums are used by both the trading engine and the frontend app
|
|
@@ -69872,5 +70000,5 @@ const adaptic = {
|
|
|
69872
70000
|
};
|
|
69873
70001
|
const adptc = adaptic;
|
|
69874
70002
|
|
|
69875
|
-
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 };
|
|
69876
70004
|
//# sourceMappingURL=index.mjs.map
|