@adaptic/utils 0.0.984 → 0.0.985
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 +176 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +175 -32
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +25 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/massive.d.ts +30 -1
- package/dist/types/massive.d.ts.map +1 -1
- package/dist/types/price-utils.d.ts.map +1 -1
- package/dist/types/risk-free-rate.d.ts +90 -0
- package/dist/types/risk-free-rate.d.ts.map +1 -1
- package/dist/types/types/massive-types.d.ts +51 -0
- package/dist/types/types/massive-types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8520,6 +8520,11 @@ const fetchPrices = async (params, options) => {
|
|
|
8520
8520
|
try {
|
|
8521
8521
|
let allResults = [];
|
|
8522
8522
|
let nextUrl = `${baseUrl}?${urlParams.toString()}`;
|
|
8523
|
+
// DE-006: track upstream freshness across pagination. If any page
|
|
8524
|
+
// reports DELAYED, the whole batch is treated as DELAYED — this is the
|
|
8525
|
+
// safer default for downstream latency-sensitive logic (e.g., trade
|
|
8526
|
+
// execution should refuse stale prices, not silently mix them).
|
|
8527
|
+
let aggregatedStatus = "OK";
|
|
8523
8528
|
while (nextUrl) {
|
|
8524
8529
|
//getLogger().info(`Debug: Fetching ${nextUrl}`);
|
|
8525
8530
|
await rateLimiters.massive.acquire();
|
|
@@ -8529,6 +8534,7 @@ const fetchPrices = async (params, options) => {
|
|
|
8529
8534
|
throw new Error(`Massive.com API responded with status: ${data.status}`);
|
|
8530
8535
|
}
|
|
8531
8536
|
if (data.status === "DELAYED") {
|
|
8537
|
+
aggregatedStatus = "DELAYED";
|
|
8532
8538
|
const now = Date.now();
|
|
8533
8539
|
const lastWarn = delayedWarnTimestamps.get(params.ticker) ?? 0;
|
|
8534
8540
|
if (now - lastWarn > DELAYED_WARN_COOLDOWN_MS) {
|
|
@@ -8542,6 +8548,14 @@ const fetchPrices = async (params, options) => {
|
|
|
8542
8548
|
// Check if there's a next page and append API key
|
|
8543
8549
|
nextUrl = data.next_url ? `${data.next_url}&apiKey=${apiKey}` : "";
|
|
8544
8550
|
}
|
|
8551
|
+
// DE-006: stamp each bar with the upstream freshness so downstream
|
|
8552
|
+
// consumers (engine pricing pipeline, performance metrics, risk gates)
|
|
8553
|
+
// can branch on `bar._freshness?.status === "DELAYED"`.
|
|
8554
|
+
const freshness = {
|
|
8555
|
+
status: aggregatedStatus,
|
|
8556
|
+
receivedAt: new Date(),
|
|
8557
|
+
...(aggregatedStatus === "DELAYED" ? { delayedSince: null } : {}),
|
|
8558
|
+
};
|
|
8545
8559
|
return allResults.map((entry) => ({
|
|
8546
8560
|
date: new Date(entry.t).toLocaleString("en-US", {
|
|
8547
8561
|
year: "numeric",
|
|
@@ -8562,6 +8576,7 @@ const fetchPrices = async (params, options) => {
|
|
|
8562
8576
|
vol: entry.v,
|
|
8563
8577
|
vwap: entry.vw,
|
|
8564
8578
|
trades: entry.n,
|
|
8579
|
+
_freshness: freshness,
|
|
8565
8580
|
}));
|
|
8566
8581
|
}
|
|
8567
8582
|
catch (error) {
|
|
@@ -8602,6 +8617,43 @@ const fetchPrices = async (params, options) => {
|
|
|
8602
8617
|
}
|
|
8603
8618
|
});
|
|
8604
8619
|
};
|
|
8620
|
+
/**
|
|
8621
|
+
* Variant of {@link fetchPrices} that returns a discriminated
|
|
8622
|
+
* {@link MassiveResult} wrapper, surfacing the upstream feed status (`OK` vs
|
|
8623
|
+
* `DELAYED`) at the result level. This is the preferred entry point for new
|
|
8624
|
+
* code that needs to gate latency-sensitive decisions on freshness.
|
|
8625
|
+
*
|
|
8626
|
+
* The underlying bars are still stamped with `_freshness` so consumers that
|
|
8627
|
+
* already destructure the array can branch per-bar; the wrapper simply
|
|
8628
|
+
* promotes that information to the top of the result for clarity.
|
|
8629
|
+
*
|
|
8630
|
+
* DE-006: closes the loop for callers that need to know when the Massive feed
|
|
8631
|
+
* is on a delayed plan (e.g. free tier, market-data outage downgrade).
|
|
8632
|
+
*
|
|
8633
|
+
* @param params - Same parameters accepted by {@link fetchPrices}.
|
|
8634
|
+
* @param options - Same options accepted by {@link fetchPrices}.
|
|
8635
|
+
* @returns A {@link MassiveResult} carrying the bar array plus freshness
|
|
8636
|
+
* metadata.
|
|
8637
|
+
*/
|
|
8638
|
+
const fetchPricesWithFreshness = async (params, options) => {
|
|
8639
|
+
const data = await fetchPrices(params, options);
|
|
8640
|
+
// Bars are stamped uniformly inside `fetchPrices`; reading the first one is
|
|
8641
|
+
// sufficient. If the result is empty (no bars in the requested window) we
|
|
8642
|
+
// default to OK with the current wall clock — there is no upstream signal
|
|
8643
|
+
// to contradict it.
|
|
8644
|
+
const sampleFreshness = data[0]?._freshness;
|
|
8645
|
+
const status = sampleFreshness?.status ?? "OK";
|
|
8646
|
+
const receivedAt = sampleFreshness?.receivedAt ?? new Date();
|
|
8647
|
+
if (status === "DELAYED") {
|
|
8648
|
+
return {
|
|
8649
|
+
status: "DELAYED",
|
|
8650
|
+
data,
|
|
8651
|
+
receivedAt,
|
|
8652
|
+
delayedSince: sampleFreshness?.delayedSince ?? null,
|
|
8653
|
+
};
|
|
8654
|
+
}
|
|
8655
|
+
return { status: "OK", data, receivedAt };
|
|
8656
|
+
};
|
|
8605
8657
|
/**
|
|
8606
8658
|
* Analyzes the price data for a given stock.
|
|
8607
8659
|
* @param {MassivePriceData[]} priceData - The price data to analyze.
|
|
@@ -9245,7 +9297,11 @@ function getEquityValues(equityData, portfolioHistory, marketTimeUtil, period) {
|
|
|
9245
9297
|
initialEquity = Number(validData[0].value);
|
|
9246
9298
|
}
|
|
9247
9299
|
return {
|
|
9248
|
-
|
|
9300
|
+
// DE-005: previously `Number(latestPoint.valueOf)`, which read the
|
|
9301
|
+
// un-invoked function reference and silently returned NaN. `latestPoint`
|
|
9302
|
+
// is already a number (see line above; sourced from `point.value` which
|
|
9303
|
+
// is typed `number` in EquityPoint), so use it directly.
|
|
9304
|
+
latestEquity: latestPoint,
|
|
9249
9305
|
initialEquity,
|
|
9250
9306
|
latestTimestamp: validData[validData.length - 1].time,
|
|
9251
9307
|
initialTimestamp: validData[0].time,
|
|
@@ -9344,25 +9400,42 @@ async function fetchTreasuryBillRate() {
|
|
|
9344
9400
|
return percent / 100;
|
|
9345
9401
|
}
|
|
9346
9402
|
/**
|
|
9347
|
-
*
|
|
9348
|
-
*
|
|
9349
|
-
*
|
|
9350
|
-
*
|
|
9351
|
-
*
|
|
9352
|
-
*
|
|
9353
|
-
*
|
|
9354
|
-
*
|
|
9355
|
-
* -
|
|
9356
|
-
*
|
|
9357
|
-
*
|
|
9358
|
-
*
|
|
9359
|
-
*
|
|
9360
|
-
*
|
|
9361
|
-
*
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9403
|
+
* Provenance-aware variant of {@link getRiskFreeRate} that returns the rate
|
|
9404
|
+
* AND tells the caller where it came from. Use this in any code path that
|
|
9405
|
+
* publishes performance metrics (Sharpe, alpha, Sortino) so downstream
|
|
9406
|
+
* reports can flag computations made against a fictional fallback rate.
|
|
9407
|
+
*
|
|
9408
|
+
* Behavior is identical to {@link getRiskFreeRate} for the cache and
|
|
9409
|
+
* deduplication semantics; only the return shape differs:
|
|
9410
|
+
*
|
|
9411
|
+
* - Fresh cache hit: `{ source: "cached", fetchedAt: <original fetch time> }`
|
|
9412
|
+
* - Cold or stale cache + successful fetch: `{ source: "live", fetchedAt: <now> }`
|
|
9413
|
+
* - Cold or stale cache + failed fetch but cached value present:
|
|
9414
|
+
* `{ source: "cached", fetchedAt: <original fetch time> }` — the stale
|
|
9415
|
+
* value is reused so existing alpha calculations keep working through a
|
|
9416
|
+
* transient outage. The provenance still says `cached`, not `live`.
|
|
9417
|
+
* - Cold cache + failed fetch + no cached value:
|
|
9418
|
+
* `{ source: "default", fetchedAt: <now> }` — the 2% fallback is used. This
|
|
9419
|
+
* is the case downstream reports MUST flag, because Sharpe / alpha computed
|
|
9420
|
+
* against a 2% floor that was never observed in market data is a fiction.
|
|
9421
|
+
*
|
|
9422
|
+
* DE-029: closes the silent-failure loop where a first-fetch network failure
|
|
9423
|
+
* propagated `DEFAULT_RISK_FREE_RATE` indistinguishable from a live
|
|
9424
|
+
* observation.
|
|
9425
|
+
*
|
|
9426
|
+
* @returns The annualized risk-free rate plus its provenance.
|
|
9427
|
+
*/
|
|
9428
|
+
async function getRiskFreeRateWithProvenance() {
|
|
9429
|
+
// Snapshot the cache reference before the freshness check so the type
|
|
9430
|
+
// narrows correctly without a non-null assertion (the check itself uses a
|
|
9431
|
+
// mutable module-level variable, which TypeScript will not narrow across).
|
|
9432
|
+
const snapshot = cache;
|
|
9433
|
+
if (snapshot !== null && isFresh(snapshot)) {
|
|
9434
|
+
return {
|
|
9435
|
+
rate: snapshot.rate,
|
|
9436
|
+
source: "cached",
|
|
9437
|
+
fetchedAt: new Date(snapshot.fetchedAt),
|
|
9438
|
+
};
|
|
9366
9439
|
}
|
|
9367
9440
|
if (inflight !== null) {
|
|
9368
9441
|
return inflight;
|
|
@@ -9370,8 +9443,13 @@ async function getRiskFreeRate() {
|
|
|
9370
9443
|
inflight = (async () => {
|
|
9371
9444
|
try {
|
|
9372
9445
|
const rate = await fetchTreasuryBillRate();
|
|
9373
|
-
|
|
9374
|
-
|
|
9446
|
+
const fetchedAtMs = Date.now();
|
|
9447
|
+
cache = { rate, fetchedAt: fetchedAtMs };
|
|
9448
|
+
return {
|
|
9449
|
+
rate,
|
|
9450
|
+
source: "live",
|
|
9451
|
+
fetchedAt: new Date(fetchedAtMs),
|
|
9452
|
+
};
|
|
9375
9453
|
}
|
|
9376
9454
|
catch (error) {
|
|
9377
9455
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -9381,10 +9459,18 @@ async function getRiskFreeRate() {
|
|
|
9381
9459
|
cachedRate: cache.rate,
|
|
9382
9460
|
cacheAgeMs: Date.now() - cache.fetchedAt,
|
|
9383
9461
|
});
|
|
9384
|
-
return
|
|
9462
|
+
return {
|
|
9463
|
+
rate: cache.rate,
|
|
9464
|
+
source: "cached",
|
|
9465
|
+
fetchedAt: new Date(cache.fetchedAt),
|
|
9466
|
+
};
|
|
9385
9467
|
}
|
|
9386
9468
|
getLogger().warn("Failed to fetch risk-free rate and no cached value available; falling back to DEFAULT_RISK_FREE_RATE", { error: message, fallback: DEFAULT_RISK_FREE_RATE });
|
|
9387
|
-
return
|
|
9469
|
+
return {
|
|
9470
|
+
rate: DEFAULT_RISK_FREE_RATE,
|
|
9471
|
+
source: "default",
|
|
9472
|
+
fetchedAt: new Date(),
|
|
9473
|
+
};
|
|
9388
9474
|
}
|
|
9389
9475
|
finally {
|
|
9390
9476
|
inflight = null;
|
|
@@ -9392,6 +9478,31 @@ async function getRiskFreeRate() {
|
|
|
9392
9478
|
})();
|
|
9393
9479
|
return inflight;
|
|
9394
9480
|
}
|
|
9481
|
+
/**
|
|
9482
|
+
* Returns the current annualized risk-free rate (decimal, e.g. 0.0452 for
|
|
9483
|
+
* 4.52%), fetching from the US Treasury Fiscal Data API and caching for 24h.
|
|
9484
|
+
*
|
|
9485
|
+
* Behavior:
|
|
9486
|
+
* - If a fresh cached value exists (<24h old), returns it without a network
|
|
9487
|
+
* round-trip.
|
|
9488
|
+
* - If the cache is stale or empty, fetches the latest 13-week T-Bill rate,
|
|
9489
|
+
* updates the cache, and returns it.
|
|
9490
|
+
* - If the fetch fails, returns the last-known-good cached value (even if
|
|
9491
|
+
* expired) or {@link DEFAULT_RISK_FREE_RATE} as a last resort, logging a
|
|
9492
|
+
* warning in both cases.
|
|
9493
|
+
* - Concurrent calls during a cold cache are deduplicated so only one network
|
|
9494
|
+
* request is in flight at a time.
|
|
9495
|
+
*
|
|
9496
|
+
* For provenance-aware callers (performance reports, audit logging) prefer
|
|
9497
|
+
* {@link getRiskFreeRateWithProvenance}, which returns both the rate AND
|
|
9498
|
+
* whether it came from a live fetch, the cache, or the fallback default.
|
|
9499
|
+
*
|
|
9500
|
+
* @returns Annualized risk-free rate as a decimal.
|
|
9501
|
+
*/
|
|
9502
|
+
async function getRiskFreeRate() {
|
|
9503
|
+
const result = await getRiskFreeRateWithProvenance();
|
|
9504
|
+
return result.rate;
|
|
9505
|
+
}
|
|
9395
9506
|
/**
|
|
9396
9507
|
* Synchronous accessor that returns the most recent cached risk-free rate
|
|
9397
9508
|
* without performing I/O. If the cache is stale, a background refresh is
|
|
@@ -9406,22 +9517,53 @@ async function getRiskFreeRate() {
|
|
|
9406
9517
|
* {@link DEFAULT_RISK_FREE_RATE} if no value has been cached yet.
|
|
9407
9518
|
*/
|
|
9408
9519
|
function getCachedRiskFreeRateSync() {
|
|
9520
|
+
return getCachedRiskFreeRateSyncWithProvenance().rate;
|
|
9521
|
+
}
|
|
9522
|
+
/**
|
|
9523
|
+
* Provenance-aware sibling of {@link getCachedRiskFreeRateSync}. Returns the
|
|
9524
|
+
* cached rate plus a flag indicating whether a real value has been cached
|
|
9525
|
+
* (`"cached"`) or whether the caller is being given the {@link DEFAULT_RISK_FREE_RATE}
|
|
9526
|
+
* fallback (`"default"`).
|
|
9527
|
+
*
|
|
9528
|
+
* Use this in synchronous hot paths that nonetheless need to flag computations
|
|
9529
|
+
* made against the fallback (e.g., real-time alpha streaming where async
|
|
9530
|
+
* round-trips are not viable but downstream reports must still distinguish
|
|
9531
|
+
* live from fictional rates).
|
|
9532
|
+
*
|
|
9533
|
+
* As with the original sync accessor, a stale cache triggers a fire-and-forget
|
|
9534
|
+
* background refresh so the next synchronous call sees fresh data; the call
|
|
9535
|
+
* itself remains synchronous and returns the last-known-good value.
|
|
9536
|
+
*
|
|
9537
|
+
* DE-029: closes the silent-failure loop where the synchronous fallback was
|
|
9538
|
+
* indistinguishable from a real cache hit.
|
|
9539
|
+
*
|
|
9540
|
+
* @returns A {@link RiskFreeRateResult} carrying the rate and its provenance.
|
|
9541
|
+
*/
|
|
9542
|
+
function getCachedRiskFreeRateSyncWithProvenance() {
|
|
9409
9543
|
if (cache === null) {
|
|
9410
9544
|
// Kick off a background fetch so the next sync caller has a real number.
|
|
9411
|
-
void
|
|
9412
|
-
// Errors are already logged inside
|
|
9413
|
-
// keep this truly fire-and-forget.
|
|
9545
|
+
void getRiskFreeRateWithProvenance().catch(() => {
|
|
9546
|
+
// Errors are already logged inside getRiskFreeRateWithProvenance;
|
|
9547
|
+
// swallow here to keep this truly fire-and-forget.
|
|
9414
9548
|
});
|
|
9415
|
-
return
|
|
9549
|
+
return {
|
|
9550
|
+
rate: DEFAULT_RISK_FREE_RATE,
|
|
9551
|
+
source: "default",
|
|
9552
|
+
fetchedAt: new Date(),
|
|
9553
|
+
};
|
|
9416
9554
|
}
|
|
9417
9555
|
if (!isFresh(cache)) {
|
|
9418
9556
|
// Stale: trigger background refresh but still return the last-known-good
|
|
9419
9557
|
// value so the call remains synchronous.
|
|
9420
|
-
void
|
|
9421
|
-
// Errors are already logged inside
|
|
9558
|
+
void getRiskFreeRateWithProvenance().catch(() => {
|
|
9559
|
+
// Errors are already logged inside getRiskFreeRateWithProvenance.
|
|
9422
9560
|
});
|
|
9423
9561
|
}
|
|
9424
|
-
return
|
|
9562
|
+
return {
|
|
9563
|
+
rate: cache.rate,
|
|
9564
|
+
source: "cached",
|
|
9565
|
+
fetchedAt: new Date(cache.fetchedAt),
|
|
9566
|
+
};
|
|
9425
9567
|
}
|
|
9426
9568
|
|
|
9427
9569
|
// metric-calcs.ts
|
|
@@ -68579,6 +68721,7 @@ const adaptic = {
|
|
|
68579
68721
|
fetchLastQuote: fetchLastQuote,
|
|
68580
68722
|
fetchTrades: fetchTrades,
|
|
68581
68723
|
fetchPrices: fetchPrices,
|
|
68724
|
+
fetchPricesWithFreshness: fetchPricesWithFreshness,
|
|
68582
68725
|
analyseMassivePriceData: analyseMassivePriceData,
|
|
68583
68726
|
formatPriceData: formatPriceData,
|
|
68584
68727
|
fetchDailyOpenClose: fetchDailyOpenClose,
|
|
@@ -68645,5 +68788,5 @@ const adaptic = {
|
|
|
68645
68788
|
};
|
|
68646
68789
|
const adptc = adaptic;
|
|
68647
68790
|
|
|
68648
|
-
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, 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, 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, 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, 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, rollOptionPosition, roundPriceForAlpaca$3 as roundPriceForAlpaca, roundPriceForAlpacaNumber, safeValidateResponse, searchNews, sellAllCrypto, sellCryptoNotional, sellToClose, sellToOpen, setLogger, setRiskFreeRate, shortWithStopLoss, sortOrdersByDate, index as tradingPolicy, trailingStops, updateAccountConfiguration, updateTrailingStop, validateAlpacaCredentials, validateAlphaVantageApiKey, validateMassiveApiKey$1 as validateMassiveApiKey, validateMultiLegOrder, validateResponse, verifyFetchKeepAlive, waitForOrderFill, withRetry, withTimeout };
|
|
68791
|
+
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, 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, 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, rollOptionPosition, roundPriceForAlpaca$3 as roundPriceForAlpaca, roundPriceForAlpacaNumber, safeValidateResponse, searchNews, sellAllCrypto, sellCryptoNotional, sellToClose, sellToOpen, setLogger, setRiskFreeRate, shortWithStopLoss, sortOrdersByDate, index as tradingPolicy, trailingStops, updateAccountConfiguration, updateTrailingStop, validateAlpacaCredentials, validateAlphaVantageApiKey, validateMassiveApiKey$1 as validateMassiveApiKey, validateMultiLegOrder, validateResponse, verifyFetchKeepAlive, waitForOrderFill, withRetry, withTimeout };
|
|
68649
68792
|
//# sourceMappingURL=index.mjs.map
|