@agg-build/sdk 4.25.0 → 4.26.0
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/{agg-websocket-Bxt9PzTz.d.mts → agg-websocket-x_U4-orL.d.mts} +133 -14
- package/dist/{agg-websocket-Bxt9PzTz.d.ts → agg-websocket-x_U4-orL.d.ts} +133 -14
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +129 -3
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-QXBVA5TW.mjs → chunk-CPMSVNBO.mjs} +129 -3
- package/dist/index.d.mts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +162 -10
- package/dist/index.mjs +34 -8
- package/dist/market-data.d.mts +2 -2
- package/dist/market-data.d.ts +2 -2
- package/dist/market-data.js +129 -3
- package/dist/market-data.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as LeaderboardSeriesQuery, J as LeaderboardSeries, K as ExecutionPositionsQuery, N as ExecutionPositionGroup, Q as ManagedBalancesParams, R as UnifiedBalanceResponse, X as UpsertVenueKey, Y as VenueKeySummary, Z as VenueKeyStatus, _ as CreatePaperTradingAccountParams, $ as PaperTradingAppOptions, a0 as PaperTradingAccount, a1 as PaperTradingAccountListParams, a2 as PaperTradingAccountsPage, a3 as SetPaperTradingBalanceParams, a4 as PaperTradingBalanceResponse, a5 as ResetPaperTradingAccountParams, a6 as PlacePaperTradingOrderParams, a7 as PaperTradingOrder, a8 as PaperTradingListParams, a9 as PaperTradingPositionsPage, aa as PaperTradingOrdersPage, ab as PaperTradingPortfolio, ac as CancelOrderSignature, ad as CancelManagedExecutionResponse, ae as CancelVenueOrderParams, af as MatchStatus, ag as MarketStatus, ah as RecurrenceFilter, ai as VenueEvent, aj as EventBootstrapResponse, ak as SportsLiveResponse, al as ListRecurringCryptoMarketsOptions, am as RecurringCryptoMarketsResponse, an as GetCryptoReferencePricesOptions, ao as CryptoReferencePricesResponse, ap as Category, aq as AppClientConfigResponse, ar as VenueGeoPolicyResponse, as as RpcTokenResponse, at as NewsFeedListResponse, au as NewsFeedPageOptions, av as NewsFeedArticleFeedResponse, aw as NewsFeedMarketFeedResponse, ax as NewsFeedStatusResponse, ay as NewsFeedMarketNewsParams, az as NewsFeedMarketNewsResponse, aA as SearchParams, aB as SearchResponse, aC as CorrelatedMarketsStatus, aD as CorrelatedMarketSignalBatch, aE as CorrelatedMarketQueryResult, aF as CorrelatedMarketCascadeResponse, aG as ResolveCorrelatedMarketsParams, aH as ResolveCorrelatedMarketsResponse, aI as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aJ as BatchOrderbooksResponse, aK as BatchMidpointsResponse, aL as OutcomeOrderbookResponse, aM as SmartRouteParams, aN as SmartRouteResponse, f as AggWebSocketCallbacks, A as AggWebSocket,
|
|
2
|
-
export {
|
|
1
|
+
import { V as Venue, U as UserProfile, T as TradeSplit, g as VenueMarket, h as VenueMarketOutcome, i as Orderbook, j as TradeSide, k as AggClientOptions, l as AggClientSessionInput, m as AuthStatus, S as SiweMessageParams, n as SiwsMessageParams, o as AggAuthVerifyBody, p as AggAuthStartBody, q as AggAuthStartResult, r as AggLinkAccountBody, s as AggLinkAccountResult, t as AggLinkAccountWalletConfirmBody, u as AggLinkAccountConfirmResult, v as UpdateUserBody, P as PaginatedResponse, w as UserHolding, x as OrderListQuery, y as TradeExecutorOrderListResponse, E as ExecutionOrdersQuery, z as ExecutionOrderItem, B as ExecutionStatusQuery, D as ExecutionStatusResponse, F as UserActivityQuery, G as UserActivityItem, L as LeaderboardQuery, H as LeaderboardRow, I as LeaderboardSeriesQuery, J as LeaderboardSeries, K as ExecutionPositionsQuery, N as ExecutionPositionGroup, Q as ManagedBalancesParams, R as UnifiedBalanceResponse, X as UpsertVenueKey, Y as VenueKeySummary, Z as VenueKeyStatus, _ as CreatePaperTradingAccountParams, $ as PaperTradingAppOptions, a0 as PaperTradingAccount, a1 as PaperTradingAccountListParams, a2 as PaperTradingAccountsPage, a3 as SetPaperTradingBalanceParams, a4 as PaperTradingBalanceResponse, a5 as ResetPaperTradingAccountParams, a6 as PlacePaperTradingOrderParams, a7 as PaperTradingOrder, a8 as PaperTradingListParams, a9 as PaperTradingPositionsPage, aa as PaperTradingOrdersPage, ab as PaperTradingPortfolio, ac as CancelOrderSignature, ad as CancelManagedExecutionResponse, ae as CancelVenueOrderParams, af as MatchStatus, ag as MarketStatus, ah as RecurrenceFilter, ai as VenueEvent, aj as EventBootstrapResponse, ak as SportsLiveResponse, al as ListRecurringCryptoMarketsOptions, am as RecurringCryptoMarketsResponse, an as GetCryptoReferencePricesOptions, ao as CryptoReferencePricesResponse, ap as Category, aq as AppClientConfigResponse, ar as VenueGeoPolicyResponse, as as RpcTokenResponse, at as NewsFeedListResponse, au as NewsFeedPageOptions, av as NewsFeedArticleFeedResponse, aw as NewsFeedMarketFeedResponse, ax as NewsFeedStatusResponse, ay as NewsFeedMarketNewsParams, az as NewsFeedMarketNewsResponse, aA as SearchParams, aB as SearchResponse, aC as CorrelatedMarketsStatus, aD as CorrelatedMarketSignalBatch, aE as CorrelatedMarketQueryResult, aF as CorrelatedMarketCascadeResponse, aG as ResolveCorrelatedMarketsParams, aH as ResolveCorrelatedMarketsResponse, aI as ChartResolution, C as ChartBarsResponse, b as ChartHistoryManifest, aJ as BatchOrderbooksResponse, aK as BatchMidpointsResponse, aL as OutcomeOrderbookResponse, aM as SmartRouteParams, aN as SmartRouteResponse, f as AggWebSocketCallbacks, aO as BookWatchdogOptions, A as AggWebSocket, aP as ExecuteManagedParams, aQ as ExecuteManagedResponse, aR as PlaceLimitOrderParams, aS as PlaceLimitOrderResponse, aT as PlaceOrderParams, aU as PlaceOrderResponse, aV as RedeemRequest, aW as RedeemResponse, aX as BalanceRefillPolicy, aY as CreateBalanceRefillPolicyParams, aZ as UpdateBalanceRefillPolicyParams, a_ as BalanceRefillAttempt, a$ as WithdrawManagedParams, b0 as WithdrawManagedResponse, b1 as WithdrawPreviewParams, b2 as WithdrawPreviewResponse, b3 as WithdrawalQuoteParams, b4 as WithdrawalQuoteResponse, b5 as SyncBalancesResponse, b6 as DepositAddressesResponse, b7 as GetPositionsParams, b8 as PositionGroup, b9 as RampQuoteRequest, ba as RampQuote, bb as RampSessionRequest, bc as RampWidgetSession, bd as Candle, c as ChartCandle } from './agg-websocket-x_U4-orL.js';
|
|
2
|
+
export { be as ACTIVE_VENUES, bf as Account, bg as AccountProvider, bh as AccountType, bi as AggAuthDeliveryMode, bj as AggAuthPrivyVerifyBody, bk as AggAuthProviderType, bl as AggAuthWalletVerifyBody, bm as AggClientAuthOptions, bn as AggSessionUser, d as AggWebSocketDiagnostics, a as AggWebSocketOptions, bo as AggregatedOrderbookLevel, bp as AggregatedOrderbookResponse, bq as App, br as AppTradingMode, bs as AttributedOrderbook, bt as AttributedOrderbookLevel, bu as AuthCodeResponse, bv as AuthTokenResponse, bw as AuthUser, bx as BalanceCustody, by as BalanceRefillAttemptStatus, bz as BalanceRefillPolicyStatus, bA as BookQuality, bB as CONFIRMED_MATCH_STATUSES, bC as CandleBuilder, bD as CandleInterval, bE as CandleTail, bF as Chain, bG as ChartBarsMeta, bH as ChartVenueCandles, bI as ComputeSplitsRequest, bJ as ComputeSplitsResponse, bK as ComputeSplitsSelection, bL as CorrelatedMarketCascadeItem, bM as CorrelatedMarketSide, bN as CorrelatedMarketSignal, bO as CorrelatedMarketSignalDirection, bP as CreateApp, bQ as CryptoReferencePriceError, bR as CryptoReferencePriceExternalMarketInput, bS as CryptoReferencePriceMarketInput, bT as CryptoReferencePriceResult, bU as CryptoReferencePriceSource, bV as CryptoReferencePriceTarget, bW as DepositAddressesPendingResponse, bX as DepositAddressesReadyResponse, bY as DepositAddressesSupportedChain, bZ as DepositAddressesToken, b_ as DepositStep, b$ as DiagnosticCallback, c0 as DiagnosticEvent, c1 as ExecuteManagedRequest, c2 as ExecuteTradeRequest, c3 as ExecuteTradeResponse, c4 as ExecutionDagProgress, c5 as ExecutionDisplayGroupStatus, c6 as ExecutionDisplayStepKind, c7 as ExecutionMode, c8 as ExecutionOverallState, c9 as ExecutionStatusOrder, ca as ExecutionStatusStep, cb as GetBalanceQuery, cc as GetBalanceResponse, cd as GetHoldingsQuery, ce as GetHoldingsResponse, cf as GetOrdersParams, cg as GetOrdersQuery, ch as GetPositionsQuery, ci as HelloResponse, cj as HistoryRangeRequest, ck as INACTIVE_VENUES, cl as LeaderboardMetric, cm as LeaderboardSeriesPoint, cn as LeaderboardStats, co as LimitOrderTimeInForce, cp as MarkSource, cq as MarketPriceHistory, cr as MarketView, cs as MarketViewBatch, ct as MatchType, cu as MatchedMidpoint, cv as MatchedMidpointOutcome, cw as MatchedOrderbookMarket, cx as MatchedVenueMarketOutcomeRef, cy as MidpointItem, cz as MidpointRow, cA as NewsFeedArticleFeedItem, cB as NewsFeedArticleWithSummary, cC as NewsFeedLinkedMarket, cD as NewsFeedMarketFeedArticle, cE as NewsFeedMarketFeedItem, cF as NewsFeedMarketNewsResult, cG as NonceResponse, cH as NovigExecutionMode, cI as OPTIONAL_SIGNATURE_TIMEOUT_MS, cJ as OrderListItem, cK as OrderStatus, cL as OrderType, cM as OrderbookBatchItemError, cN as OrderbookBatchItemErrorCode, cO as OrderbookBatchItemStatus, cP as OrderbookHistoryPoint, cQ as OrderbookHistoryResponse, cR as OrderbookLevel, cS as OrderbookQuoteFill, cT as OrderbookQuoteParams, cU as OrderbookQuoteResponse, cV as OrderbookServiceUnavailableError, O as OrderbookState, cW as OrderbooksOnlyError, cX as OutcomeMidpoint, cY as OutcomeMidpointRow, cZ as PaperTradingBalanceAdjustment, c_ as PaperTradingLiquidityStatus, c$ as PaperTradingMarkSource, d0 as PaperTradingPosition, d1 as PersistedAuthSnapshot, d2 as PositionRedeemStatus, d3 as PricePoint, d4 as PriceSource, d5 as PricesHistoryResponse, d6 as ProphetxExecutionMode, d7 as RECURRENCE_CADENCES, d8 as RecurrenceCadence, d9 as RecurringCryptoComparisonPoint, da as RecurringCryptoComparisonPriceSource, db as RecurringCryptoDuration, dc as RecurringCryptoDurationInput, dd as RecurringCryptoMarketMetrics, de as RecurringCryptoOrderbookDepthLevel, df as RecurringCryptoOrderbookDepthSide, dg as RecurringCryptoOutcome, dh as RecurringCryptoOutcomeOrderbookDepth, di as RecurringCryptoPriceComparison, dj as RecurringCryptoReferencePrice, dk as RecurringCryptoResolution, dl as RecurringCryptoSourceConfidence, dm as RecurringCryptoVenueMarket, dn as RecurringCryptoWindowComparisons, dp as RecurringCryptoWindowMarket, dq as RedeemLegResult, dr as RedeemLegStatus, ds as RequestedOrderbookMarket, dt as ResolvedCorrelatedMarketsResponse, du as SELF_CUSTODY_FILL_TIMEOUT_MS, dv as SELF_CUSTODY_POLL_INTERVAL_MS, dw as ServerWallet, dx as SettlementDiff, dy as SettlementDifference, dz as SettlementSource, dA as SetupDepositAddressStep, dB as SetupVenueKeyStep, dC as SignatureRequest, dD as SignatureRequestType, dE as SignerFn, dF as SimpleOrderbookLevel, dG as SmartRouteAllocation, dH as SmartRouteBridgeStep, dI as SmartRouteFeeBreakdown, dJ as SmartRouteFill, dK as SmartRouteSettlementLeg, dL as SmartRouteSettlementPlan, dM as SmartRouteSetupCostLine, dN as SmartRouteSide, dO as SmartRouteStatus, dP as SmartRouteVenueFill, dQ as SportsGameStatus, dR as SportsLiveParticipant, dS as SportsLiveState, dT as TERMINAL_EXECUTION_STATES, dU as TimeInForce, dV as TradeExecutorOrder, dW as TradeStep, dX as UserActivityBridge, dY as UserActivityDeposit, dZ as UserActivityRedeem, d_ as UserActivityRedeemLeg, d$ as UserActivityTrade, e0 as UserActivityType, e1 as UserActivityUserOp, e2 as UserActivityWithdrawal, e3 as VENUES, e4 as VENUE_CHAIN_IDS, e5 as ValidateBalanceOnClientStep, e6 as ValidateManagedParams, e7 as ValidateManagedRequest, e8 as ValidateManagedResponse, e9 as ValidateTradeRequest, ea as ValidateTradeResponse, eb as VenueEventListItem, ec as VenueEventWithMarkets, ed as VenueGeoPolicyEntry, ee as VenueMarketListItem, ef as VenueMarketRef, eg as VenueOrderbookEntry, eh as VenueOrderbookLevel, ei as VenuePositionBalance, ej as VenuePriceInfo, ek as VenueSoloQuote, el as VerifyBody, em as VerifyResponse, en as WalletChainBalance, eo as WalletTokenBalance, ep as WithdrawManagedRequest, eq as WithdrawManagedSourceItem, er as WithdrawTokenSymbol, es as WithdrawalExpected, et as WithdrawalLeg, eu as WithdrawalLegStatus, ev as WithdrawalLegType, ew as WithdrawalLifecycleStatus, ex as WithdrawalSource, ey as WithdrawalSourceItem, ez as WithdrawalSourceStatus, eA as WithdrawalSourceTokenSymbol, e as WsArbFeedBatch, eB as WsArbFeedEntry, W as WsArbMarketUpdate, eC as WsAttributedLevel, eD as WsAuthenticated, eE as WsBalanceUpdate, eF as WsCandleInterval, eG as WsClientMessage, eH as WsConnected, eI as WsError, eJ as WsHeartbeat, eK as WsMarkSource, eL as WsMarketResolved, eM as WsOrderEvent, eN as WsOrderEventType, eO as WsOrderSubmitted, eP as WsOrderbookDelta, eQ as WsOrderbookSnapshot, eR as WsRedeemEvent, eS as WsServerMessage, eT as WsSubscribed, eU as WsTrade, eV as WsUnsubscribed, eW as WsVenueBook, eX as WsVenueInfo, eY as WsVenueLevel, eZ as WsWithdrawalLegStatus, e_ as WsWithdrawalLifecycleEvent, e$ as WsWithdrawalLifecycleLeg, f0 as WsWithdrawalLifecycleStatus, f1 as applyOrderbookDelta, f2 as computeChecksum, f3 as getEffectiveDisabledVenues, f4 as isVenueActive, f5 as isVenueDataVisible, f6 as isVenueInactive, f7 as snapshotToOrderbook } from './agg-websocket-x_U4-orL.js';
|
|
3
3
|
|
|
4
4
|
declare enum ImageSize {
|
|
5
5
|
sm = 44,
|
|
@@ -774,8 +774,9 @@ declare class AggClient {
|
|
|
774
774
|
*/
|
|
775
775
|
getLeaderboard(params?: LeaderboardQuery): Promise<PaginatedResponse<LeaderboardRow>>;
|
|
776
776
|
/**
|
|
777
|
-
* One user's
|
|
778
|
-
* most 366) with a running cumulative
|
|
777
|
+
* One user's (or, with no user, the whole app's) leaderboard stats per UTC
|
|
778
|
+
* day (default the last 30 days, at most 366) with a running cumulative
|
|
779
|
+
* realized P&L, optionally for a single category. Gross of fees;
|
|
779
780
|
* unrealized P&L is not included.
|
|
780
781
|
*/
|
|
781
782
|
getLeaderboardSeries(params: LeaderboardSeriesQuery): Promise<LeaderboardSeries>;
|
|
@@ -1095,6 +1096,12 @@ declare class AggClient {
|
|
|
1095
1096
|
*/
|
|
1096
1097
|
createWebSocket(callbacks?: AggWebSocketCallbacks, options?: {
|
|
1097
1098
|
enableLogs?: boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* Checks books with no update for 5 minutes against
|
|
1101
|
+
* `GET /orderbooks/outcomes` and heals any that drifted. On by default;
|
|
1102
|
+
* pass `false` to disable or an object to tune the timings.
|
|
1103
|
+
*/
|
|
1104
|
+
bookWatchdog?: false | Pick<BookWatchdogOptions, "silenceMs" | "checkIntervalMs">;
|
|
1098
1105
|
}): AggWebSocket;
|
|
1099
1106
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
1100
1107
|
executeManaged(params: ExecuteManagedParams): Promise<ExecuteManagedResponse>;
|
|
@@ -1339,4 +1346,4 @@ declare function prepareHostedVenueRoute(client: FundingClient & Pick<AggClient,
|
|
|
1339
1346
|
|
|
1340
1347
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
1341
1348
|
|
|
1342
|
-
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueFundingIntent, type HostedVenueFundingOptions, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, LeaderboardSeries, LeaderboardSeriesQuery, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
|
1349
|
+
export { AggApiError, type AggApiErrorInit, type AggApiFieldError, AggAuthStartBody, AggAuthStartResult, AggAuthVerifyBody, AggClient, AggClientOptions, AggClientSessionInput, AggLinkAccountBody, AggLinkAccountConfirmResult, AggLinkAccountResult, AggLinkAccountWalletConfirmBody, type AggRateLimitResponse, AggWebSocket, AggWebSocketCallbacks, AppClientConfigResponse, AuthStatus, BalanceRefillAttempt, BalanceRefillPolicy, BatchMidpointsResponse, BatchOrderbooksResponse, BookWatchdogOptions, type BuildVenueUrlOpts, CancelManagedExecutionResponse, CancelOrderSignature, CancelVenueOrderParams, Candle, Category, ChartBarsResponse, ChartCandle, ChartHistoryManifest, ChartResolution, CorrelatedMarketCascadeResponse, CorrelatedMarketQueryResult, CorrelatedMarketSignalBatch, CorrelatedMarketsStatus, CreateBalanceRefillPolicyParams, CreatePaperTradingAccountParams, CryptoReferencePricesResponse, DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW, DEFAULT_BALANCE_REFILL_MAX_FEE_RAW, DepositAddressesResponse, EventBootstrapResponse, ExecuteManagedParams, ExecuteManagedResponse, ExecutionOrderItem, ExecutionOrdersQuery, ExecutionPositionGroup, ExecutionPositionsQuery, ExecutionStatusQuery, ExecutionStatusResponse, GetCryptoReferencePricesOptions, GetPositionsParams, type HostedVenueAccount, type HostedVenueActivity, type HostedVenueActivityCode, type HostedVenueActivityQuery, type HostedVenueBalance, type HostedVenueDepositAddress, type HostedVenueFundingIntent, type HostedVenueFundingOptions, type HostedVenueWithdrawal, type HostedVenueWithdrawalRequest, IMAGE_SIZES, ImageSize, LIMIT_PRICE_RAW_SCALE, LeaderboardQuery, LeaderboardRow, LeaderboardSeries, LeaderboardSeriesQuery, type LimitPriceSide, type LimitPriceTickAdjustment, ListRecurringCryptoMarketsOptions, type LoadImmutableHistoryOptions, ManagedBalancesParams, MarketStatus, MatchStatus, NewsFeedArticleFeedResponse, NewsFeedListResponse, NewsFeedMarketFeedResponse, NewsFeedMarketNewsParams, NewsFeedMarketNewsResponse, NewsFeedPageOptions, NewsFeedStatusResponse, OrderListQuery, Orderbook, OutcomeOrderbookResponse, PaginatedResponse, PaperTradingAccount, PaperTradingAccountsPage, PaperTradingAppOptions, PaperTradingBalanceResponse, PaperTradingListParams, PaperTradingOrder, PaperTradingOrdersPage, PaperTradingPortfolio, PaperTradingPositionsPage, PlaceLimitOrderParams, PlaceLimitOrderResponse, PlacePaperTradingOrderParams, PositionGroup, type ProvisionHostedVenueAccountBody, type QuoteError, type QuoteErrorCode, RETINA_IMAGE_SIZES, RampQuote, RampQuoteRequest, RampSessionRequest, RampWidgetSession, RecurrenceFilter, RecurringCryptoMarketsResponse, RedeemRequest, RedeemResponse, ResetPaperTradingAccountParams, ResolveCorrelatedMarketsParams, ResolveCorrelatedMarketsResponse, RpcTokenResponse, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, SearchParams, SearchResponse, SetPaperTradingBalanceParams, SmartRouteParams, SmartRouteResponse, type SplitsByAmountResult, SportsLiveResponse, SyncBalancesResponse, TradeExecutorOrderListResponse, TradeSide, TradeSplit, TurnstileChallengeError, UnifiedBalanceResponse, UpdateBalanceRefillPolicyParams, UpdateUserBody, UpsertVenueKey, UserActivityItem, UserActivityQuery, UserHolding, UserProfile, Venue, VenueEvent, VenueGeoPolicyResponse, VenueKeyStatus, VenueKeySummary, VenueMarket, type VenueMarketClusterNode, VenueMarketOutcome, WithdrawManagedParams, WithdrawManagedResponse, WithdrawPreviewParams, WithdrawPreviewResponse, WithdrawalQuoteParams, WithdrawalQuoteResponse, adjustLimitPriceRawToTick, aggregateMidpoint, buildVenueUrl, computeBestSplitsByAmount, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, formatOutcomeTitle, getBalanceRefillMaximumRaw, getWalletAddressFromUserProfile, hasShape, isAggApiError, isBalanceRefillWithinDailyCap, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, loadImmutableHistory, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, orderbookCrc32, parse, parseEmail, parseEmailStrict, prepareHostedVenueFunding, prepareHostedVenueRoute, projectedOrderbookChecksum, retinaImageUrl, safeParse, sortVenues, toChecksumAddress };
|
package/dist/index.js
CHANGED
|
@@ -1545,6 +1545,10 @@ var RECONNECT_BASE_MS = 1e3;
|
|
|
1545
1545
|
var RECONNECT_MAX_MS = 3e4;
|
|
1546
1546
|
var STALE_TIMEOUT_MS = 45e3;
|
|
1547
1547
|
var ORDERBOOK_DEBUG_TOP_LEVELS = 5;
|
|
1548
|
+
var WATCHDOG_SILENCE_MS = 5 * 6e4;
|
|
1549
|
+
var WATCHDOG_CHECK_INTERVAL_MS = 6e4;
|
|
1550
|
+
var WATCHDOG_BATCH_MAX = 100;
|
|
1551
|
+
var WATCHDOG_REQUEST_TIMEOUT_MS = 15e3;
|
|
1548
1552
|
var AggWebSocket = class {
|
|
1549
1553
|
constructor(options) {
|
|
1550
1554
|
this.ws = null;
|
|
@@ -1570,6 +1574,18 @@ var AggWebSocket = class {
|
|
|
1570
1574
|
this.books = /* @__PURE__ */ new Map();
|
|
1571
1575
|
/** Markets currently resyncing (awaiting snapshot after seq gap / checksum mismatch). */
|
|
1572
1576
|
this.resyncing = /* @__PURE__ */ new Set();
|
|
1577
|
+
/**
|
|
1578
|
+
* Per subscribed orderbook outcome: last time it made progress (subscribe,
|
|
1579
|
+
* snapshot, applied delta) or was checked against REST (ms). Tracked from
|
|
1580
|
+
* subscribe, not from the first snapshot, so a book that never arrives or
|
|
1581
|
+
* is stuck resyncing is still found by the watchdog.
|
|
1582
|
+
*/
|
|
1583
|
+
this.bookCheckedAt = /* @__PURE__ */ new Map();
|
|
1584
|
+
/** Outcomes the watchdog already resnapshotted; a repeat mismatch resubscribes. */
|
|
1585
|
+
this.watchdogResnapshotted = /* @__PURE__ */ new Set();
|
|
1586
|
+
this.watchdogTimer = null;
|
|
1587
|
+
this.watchdogAbort = null;
|
|
1588
|
+
this.watchdogPausedUntil = 0;
|
|
1573
1589
|
// ── Connection state ──
|
|
1574
1590
|
this.connecting = false;
|
|
1575
1591
|
this._connected = false;
|
|
@@ -1585,6 +1601,7 @@ var AggWebSocket = class {
|
|
|
1585
1601
|
this.callbacks = (_b = options.callbacks) != null ? _b : {};
|
|
1586
1602
|
this.initialToken = options.initialToken;
|
|
1587
1603
|
this.enableLogs = (_c = options.enableLogs) != null ? _c : false;
|
|
1604
|
+
this.bookWatchdog = options.bookWatchdog;
|
|
1588
1605
|
}
|
|
1589
1606
|
// ── Public API ──
|
|
1590
1607
|
get connected() {
|
|
@@ -1730,6 +1747,7 @@ var AggWebSocket = class {
|
|
|
1730
1747
|
this.subs.set(outcomeId, sub);
|
|
1731
1748
|
}
|
|
1732
1749
|
if (sub.refCount === 0) {
|
|
1750
|
+
this.bookCheckedAt.set(outcomeId, Date.now());
|
|
1733
1751
|
this.pendingSubs.add(outcomeId);
|
|
1734
1752
|
this.ensureConnected();
|
|
1735
1753
|
if (this._connected) {
|
|
@@ -1754,6 +1772,8 @@ var AggWebSocket = class {
|
|
|
1754
1772
|
this.books.delete(outcomeId);
|
|
1755
1773
|
}
|
|
1756
1774
|
this.resyncing.delete(outcomeId);
|
|
1775
|
+
this.bookCheckedAt.delete(outcomeId);
|
|
1776
|
+
this.watchdogResnapshotted.delete(outcomeId);
|
|
1757
1777
|
if (this._connected) {
|
|
1758
1778
|
if (this.pendingFlushSubs.has(outcomeId)) {
|
|
1759
1779
|
this.pendingFlushSubs.delete(outcomeId);
|
|
@@ -1821,6 +1841,7 @@ var AggWebSocket = class {
|
|
|
1821
1841
|
}
|
|
1822
1842
|
/** Send a JWT to authenticate (or re-authenticate) the connection. */
|
|
1823
1843
|
authenticate(token) {
|
|
1844
|
+
this.initialToken = token;
|
|
1824
1845
|
if (this._connected) {
|
|
1825
1846
|
this.send({ action: "authenticate", token });
|
|
1826
1847
|
}
|
|
@@ -1852,6 +1873,7 @@ var AggWebSocket = class {
|
|
|
1852
1873
|
}
|
|
1853
1874
|
/** Permanently destroy. Cannot reconnect after this. */
|
|
1854
1875
|
destroy() {
|
|
1876
|
+
var _a;
|
|
1855
1877
|
this.destroyed = true;
|
|
1856
1878
|
for (const controller of this.historyControllers)
|
|
1857
1879
|
controller.abort(new Error("Market-data client disposed"));
|
|
@@ -1862,6 +1884,12 @@ var AggWebSocket = class {
|
|
|
1862
1884
|
this.subs.clear();
|
|
1863
1885
|
this.books.clear();
|
|
1864
1886
|
this.resyncing.clear();
|
|
1887
|
+
if (this.watchdogTimer) clearInterval(this.watchdogTimer);
|
|
1888
|
+
this.watchdogTimer = null;
|
|
1889
|
+
(_a = this.watchdogAbort) == null ? void 0 : _a.abort();
|
|
1890
|
+
this.watchdogAbort = null;
|
|
1891
|
+
this.bookCheckedAt.clear();
|
|
1892
|
+
this.watchdogResnapshotted.clear();
|
|
1865
1893
|
this.pendingSubs.clear();
|
|
1866
1894
|
this.pendingTradeSubs.clear();
|
|
1867
1895
|
this.pendingResnapshots.clear();
|
|
@@ -2045,11 +2073,21 @@ var AggWebSocket = class {
|
|
|
2045
2073
|
* ready to accept subscriptions. Now flush all pending subs.
|
|
2046
2074
|
*/
|
|
2047
2075
|
handleConnected(msg) {
|
|
2048
|
-
var _a, _b, _c, _d;
|
|
2076
|
+
var _a, _b, _c, _d, _e;
|
|
2049
2077
|
this._connected = true;
|
|
2050
|
-
|
|
2051
|
-
|
|
2078
|
+
if (this.bookWatchdog && !this.watchdogTimer && !this.destroyed) {
|
|
2079
|
+
this.watchdogTimer = setInterval(
|
|
2080
|
+
() => void this.checkSilentBooks(),
|
|
2081
|
+
(_a = this.bookWatchdog.checkIntervalMs) != null ? _a : WATCHDOG_CHECK_INTERVAL_MS
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
(_c = (_b = this.callbacks).onConnectionStateChange) == null ? void 0 : _c.call(_b, true);
|
|
2085
|
+
(_e = (_d = this.callbacks).onConnected) == null ? void 0 : _e.call(_d, msg);
|
|
2052
2086
|
const orderbookSet = new Set(this.activeOrderbookMarkets());
|
|
2087
|
+
const reconnectedAt = Date.now();
|
|
2088
|
+
for (const id of orderbookSet) {
|
|
2089
|
+
if (this.bookCheckedAt.has(id)) this.bookCheckedAt.set(id, reconnectedAt);
|
|
2090
|
+
}
|
|
2053
2091
|
this.pendingSubs.forEach((id) => orderbookSet.add(id));
|
|
2054
2092
|
this.pendingFlushSubs.forEach((id) => orderbookSet.add(id));
|
|
2055
2093
|
const orderbookIds = Array.from(orderbookSet);
|
|
@@ -2092,6 +2130,7 @@ var AggWebSocket = class {
|
|
|
2092
2130
|
const msg = __spreadProps(__spreadValues({}, raw), { timestamp: raw.timestamp / 1e3 });
|
|
2093
2131
|
const book = snapshotToOrderbook(msg);
|
|
2094
2132
|
this.books.set(msg.outcomeId, new IndexedOrderbook(book));
|
|
2133
|
+
this.bookCheckedAt.set(msg.outcomeId, Date.now());
|
|
2095
2134
|
this.resyncing.delete(msg.outcomeId);
|
|
2096
2135
|
this.pendingResnapshots.delete(msg.outcomeId);
|
|
2097
2136
|
this.debugOrderbook("snapshot_applied", {
|
|
@@ -2161,6 +2200,8 @@ var AggWebSocket = class {
|
|
|
2161
2200
|
this.requestResnapshot(outcomeId);
|
|
2162
2201
|
return;
|
|
2163
2202
|
}
|
|
2203
|
+
this.bookCheckedAt.set(outcomeId, Date.now());
|
|
2204
|
+
this.watchdogResnapshotted.delete(outcomeId);
|
|
2164
2205
|
(_b = (_a = this.callbacks).onBookTick) == null ? void 0 : _b.call(_a, outcomeId, {
|
|
2165
2206
|
midpoint: msg.midpoint,
|
|
2166
2207
|
timestamp: msg.timestamp,
|
|
@@ -2183,6 +2224,8 @@ var AggWebSocket = class {
|
|
|
2183
2224
|
var _a, _b;
|
|
2184
2225
|
const msg = __spreadProps(__spreadValues({}, raw), { timestamp: raw.timestamp / 1e3 });
|
|
2185
2226
|
this.books.delete(msg.outcomeId);
|
|
2227
|
+
this.bookCheckedAt.delete(msg.outcomeId);
|
|
2228
|
+
this.watchdogResnapshotted.delete(msg.outcomeId);
|
|
2186
2229
|
this.pendingResnapshots.delete(msg.outcomeId);
|
|
2187
2230
|
this.resyncing.delete(msg.outcomeId);
|
|
2188
2231
|
(_b = (_a = this.callbacks).onMarketResolved) == null ? void 0 : _b.call(_a, msg);
|
|
@@ -2202,6 +2245,89 @@ var AggWebSocket = class {
|
|
|
2202
2245
|
const msg = __spreadProps(__spreadValues({}, raw), { timestamp: raw.timestamp / 1e3 });
|
|
2203
2246
|
(_b = (_a = this.callbacks).onRedeemEvent) == null ? void 0 : _b.call(_a, msg);
|
|
2204
2247
|
}
|
|
2248
|
+
// ── Book watchdog ──
|
|
2249
|
+
/**
|
|
2250
|
+
* Heartbeats prove the socket, not each stream. Every subscribed outcome
|
|
2251
|
+
* with no progress for `silenceMs` is checked against the REST `seq`:
|
|
2252
|
+
*
|
|
2253
|
+
* - book present, not resyncing, same `seq` → the market is just quiet;
|
|
2254
|
+
* - different `seq`, no book (snapshot never arrived, or a resubscribe's
|
|
2255
|
+
* snapshot was lost), or stuck resyncing (any recovery whose snapshot
|
|
2256
|
+
* was lost) → resnapshot, then resubscribe on the next overdue check;
|
|
2257
|
+
* - REST can't serve it (`null`) → counted as an attempt, so the next
|
|
2258
|
+
* batch moves on to other outcomes instead of retrying the same 100.
|
|
2259
|
+
*/
|
|
2260
|
+
checkSilentBooks() {
|
|
2261
|
+
return __async(this, null, function* () {
|
|
2262
|
+
var _a;
|
|
2263
|
+
const opts = this.bookWatchdog;
|
|
2264
|
+
if (!opts || !this._connected || this.watchdogAbort) return;
|
|
2265
|
+
const now = Date.now();
|
|
2266
|
+
if (now < this.watchdogPausedUntil) return;
|
|
2267
|
+
const silenceMs = (_a = opts.silenceMs) != null ? _a : WATCHDOG_SILENCE_MS;
|
|
2268
|
+
const silent = this.activeOrderbookMarkets().filter((id) => this.bookCheckedAt.has(id)).filter((id) => now - this.bookCheckedAt.get(id) >= silenceMs).sort((a, b) => this.bookCheckedAt.get(a) - this.bookCheckedAt.get(b)).slice(0, WATCHDOG_BATCH_MAX);
|
|
2269
|
+
if (silent.length === 0) return;
|
|
2270
|
+
const checkedAt = new Map(silent.map((id) => [id, this.bookCheckedAt.get(id)]));
|
|
2271
|
+
const abort = new AbortController();
|
|
2272
|
+
this.watchdogAbort = abort;
|
|
2273
|
+
const timeout = setTimeout(() => abort.abort(), WATCHDOG_REQUEST_TIMEOUT_MS);
|
|
2274
|
+
try {
|
|
2275
|
+
const url = new URL(`${opts.baseUrl.replace(/\/$/, "")}/orderbooks/outcomes`);
|
|
2276
|
+
url.searchParams.set("venueMarketOutcomeIds", silent.join(","));
|
|
2277
|
+
url.searchParams.set("depth", "1");
|
|
2278
|
+
const response = yield fetch(url, { headers: opts.headers, signal: abort.signal });
|
|
2279
|
+
if (!response.ok) {
|
|
2280
|
+
const retryAfterS = Number(response.headers.get("retry-after"));
|
|
2281
|
+
if (response.status === 429 && retryAfterS > 0) {
|
|
2282
|
+
this.watchdogPausedUntil = Date.now() + retryAfterS * 1e3;
|
|
2283
|
+
}
|
|
2284
|
+
this.emitDiagnostic({ type: "book_watchdog_error", status: response.status });
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
const body = yield response.json();
|
|
2288
|
+
if (this.destroyed) return;
|
|
2289
|
+
silent.forEach((outcomeId, i) => {
|
|
2290
|
+
var _a2, _b;
|
|
2291
|
+
if (this.bookCheckedAt.get(outcomeId) !== checkedAt.get(outcomeId)) return;
|
|
2292
|
+
const server = (_a2 = body.data) == null ? void 0 : _a2[i];
|
|
2293
|
+
if (!server) {
|
|
2294
|
+
this.bookCheckedAt.set(outcomeId, Date.now());
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
const book = this.books.get(outcomeId);
|
|
2298
|
+
if (book && !this.resyncing.has(outcomeId) && server.seq === book.seq) {
|
|
2299
|
+
this.bookCheckedAt.set(outcomeId, Date.now());
|
|
2300
|
+
this.watchdogResnapshotted.delete(outcomeId);
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
const action = this.watchdogResnapshotted.has(outcomeId) ? "resubscribe" : "resnapshot";
|
|
2304
|
+
this.emitDiagnostic({
|
|
2305
|
+
type: "book_watchdog_resync",
|
|
2306
|
+
outcomeId,
|
|
2307
|
+
localSeq: (_b = book == null ? void 0 : book.seq) != null ? _b : null,
|
|
2308
|
+
serverSeq: server.seq,
|
|
2309
|
+
action
|
|
2310
|
+
});
|
|
2311
|
+
this.bookCheckedAt.set(outcomeId, Date.now());
|
|
2312
|
+
if (action === "resubscribe") {
|
|
2313
|
+
this.watchdogResnapshotted.delete(outcomeId);
|
|
2314
|
+
this.books.delete(outcomeId);
|
|
2315
|
+
this.resyncing.add(outcomeId);
|
|
2316
|
+
this.send({ action: "unsubscribe", channel: "orderbook", outcomeIds: [outcomeId] });
|
|
2317
|
+
this.sendSubscribe([outcomeId]);
|
|
2318
|
+
} else {
|
|
2319
|
+
this.watchdogResnapshotted.add(outcomeId);
|
|
2320
|
+
this.requestResnapshot(outcomeId, true);
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
} catch (e) {
|
|
2324
|
+
if (!this.destroyed) this.emitDiagnostic({ type: "book_watchdog_error", status: null });
|
|
2325
|
+
} finally {
|
|
2326
|
+
clearTimeout(timeout);
|
|
2327
|
+
if (this.watchdogAbort === abort) this.watchdogAbort = null;
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2205
2331
|
// ── Resnapshot ──
|
|
2206
2332
|
requestResnapshot(outcomeId, force = false) {
|
|
2207
2333
|
if (this.resyncing.has(outcomeId) && !force) return;
|
|
@@ -3158,23 +3284,38 @@ Issued At: ${issuedAt}`;
|
|
|
3158
3284
|
getLeaderboard() {
|
|
3159
3285
|
return __async(this, arguments, function* (params = {}) {
|
|
3160
3286
|
const query = {};
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3287
|
+
for (const key of [
|
|
3288
|
+
"from",
|
|
3289
|
+
"to",
|
|
3290
|
+
"metric",
|
|
3291
|
+
"cursor",
|
|
3292
|
+
"userId",
|
|
3293
|
+
"externalId",
|
|
3294
|
+
"username",
|
|
3295
|
+
"walletAddress"
|
|
3296
|
+
]) {
|
|
3297
|
+
const value = params[key];
|
|
3298
|
+
if (value) query[key] = value;
|
|
3299
|
+
}
|
|
3164
3300
|
if (params.limit != null) query.limit = String(params.limit);
|
|
3165
|
-
|
|
3301
|
+
for (const key of ["categoryIds", "venueEventIds", "userIds"]) {
|
|
3302
|
+
const value = params[key];
|
|
3303
|
+
if (value == null ? void 0 : value.length) query[key] = value;
|
|
3304
|
+
}
|
|
3166
3305
|
return this.request("/leaderboard", {
|
|
3167
3306
|
query: Object.keys(query).length ? query : void 0
|
|
3168
3307
|
});
|
|
3169
3308
|
});
|
|
3170
3309
|
}
|
|
3171
3310
|
/**
|
|
3172
|
-
* One user's
|
|
3173
|
-
* most 366) with a running cumulative
|
|
3311
|
+
* One user's (or, with no user, the whole app's) leaderboard stats per UTC
|
|
3312
|
+
* day (default the last 30 days, at most 366) with a running cumulative
|
|
3313
|
+
* realized P&L, optionally for a single category. Gross of fees;
|
|
3174
3314
|
* unrealized P&L is not included.
|
|
3175
3315
|
*/
|
|
3176
3316
|
getLeaderboardSeries(params) {
|
|
3177
3317
|
return __async(this, null, function* () {
|
|
3318
|
+
var _a;
|
|
3178
3319
|
const query = {};
|
|
3179
3320
|
for (const key of [
|
|
3180
3321
|
"from",
|
|
@@ -3187,17 +3328,21 @@ Issued At: ${issuedAt}`;
|
|
|
3187
3328
|
const value = params[key];
|
|
3188
3329
|
if (value) query[key] = value;
|
|
3189
3330
|
}
|
|
3331
|
+
if ((_a = params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
3190
3332
|
return this.request("/leaderboard/series", { query });
|
|
3191
3333
|
});
|
|
3192
3334
|
}
|
|
3193
3335
|
/** List execution positions for the authenticated user (cursor pagination). */
|
|
3194
3336
|
getExecutionPositions() {
|
|
3195
3337
|
return __async(this, arguments, function* (params = {}) {
|
|
3338
|
+
var _a;
|
|
3196
3339
|
const query = {};
|
|
3197
3340
|
if (params.cursor) query.cursor = params.cursor;
|
|
3198
3341
|
if (params.limit != null) query.limit = String(params.limit);
|
|
3199
3342
|
if (params.status) query.status = params.status;
|
|
3200
3343
|
if (params.mode) query.mode = params.mode;
|
|
3344
|
+
if ((_a = params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
3345
|
+
if (params.sort) query.sort = params.sort;
|
|
3201
3346
|
return this.request("/execution/positions", {
|
|
3202
3347
|
query: Object.keys(query).length ? query : void 0
|
|
3203
3348
|
});
|
|
@@ -3993,11 +4138,15 @@ Issued At: ${issuedAt}`;
|
|
|
3993
4138
|
const url = new URL(this.wsUrl);
|
|
3994
4139
|
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
3995
4140
|
const createSocket = (_a = this.webSocketFactory) != null ? _a : ((socketOptions) => new AggWebSocket(socketOptions));
|
|
4141
|
+
const watchdogHeaders = {};
|
|
4142
|
+
if (this._appId) watchdogHeaders["x-app-id"] = this._appId;
|
|
4143
|
+
if (this.apiKey) watchdogHeaders["x-app-api-key"] = this.apiKey;
|
|
3996
4144
|
return createSocket({
|
|
3997
4145
|
url: url.toString(),
|
|
3998
4146
|
callbacks,
|
|
3999
4147
|
initialToken: this.accessToken,
|
|
4000
|
-
enableLogs: (_b = options == null ? void 0 : options.enableLogs) != null ? _b : false
|
|
4148
|
+
enableLogs: (_b = options == null ? void 0 : options.enableLogs) != null ? _b : false,
|
|
4149
|
+
bookWatchdog: (options == null ? void 0 : options.bookWatchdog) === false ? void 0 : __spreadValues({ baseUrl: this.baseUrl, headers: watchdogHeaders }, options == null ? void 0 : options.bookWatchdog)
|
|
4001
4150
|
});
|
|
4002
4151
|
}
|
|
4003
4152
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
@@ -4265,11 +4414,14 @@ Issued At: ${issuedAt}`;
|
|
|
4265
4414
|
/** Get open positions grouped by matched market with per-venue breakdown. */
|
|
4266
4415
|
getPositions(params) {
|
|
4267
4416
|
return __async(this, null, function* () {
|
|
4417
|
+
var _a;
|
|
4268
4418
|
const query = {};
|
|
4269
4419
|
if (params == null ? void 0 : params.cursor) query.cursor = params.cursor;
|
|
4270
4420
|
if ((params == null ? void 0 : params.limit) != null) query.limit = String(params.limit);
|
|
4271
4421
|
if (params == null ? void 0 : params.status) query.status = params.status;
|
|
4272
4422
|
if (params == null ? void 0 : params.mode) query.mode = params.mode;
|
|
4423
|
+
if ((_a = params == null ? void 0 : params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
4424
|
+
if (params == null ? void 0 : params.sort) query.sort = params.sort;
|
|
4273
4425
|
return this.request("/execution/positions", {
|
|
4274
4426
|
query: Object.keys(query).length > 0 ? query : void 0
|
|
4275
4427
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
safeParse,
|
|
60
60
|
snapshotToOrderbook,
|
|
61
61
|
sortVenues
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-CPMSVNBO.mjs";
|
|
63
63
|
import {
|
|
64
64
|
__async,
|
|
65
65
|
__objRest,
|
|
@@ -1074,23 +1074,38 @@ Issued At: ${issuedAt}`;
|
|
|
1074
1074
|
getLeaderboard() {
|
|
1075
1075
|
return __async(this, arguments, function* (params = {}) {
|
|
1076
1076
|
const query = {};
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1077
|
+
for (const key of [
|
|
1078
|
+
"from",
|
|
1079
|
+
"to",
|
|
1080
|
+
"metric",
|
|
1081
|
+
"cursor",
|
|
1082
|
+
"userId",
|
|
1083
|
+
"externalId",
|
|
1084
|
+
"username",
|
|
1085
|
+
"walletAddress"
|
|
1086
|
+
]) {
|
|
1087
|
+
const value = params[key];
|
|
1088
|
+
if (value) query[key] = value;
|
|
1089
|
+
}
|
|
1080
1090
|
if (params.limit != null) query.limit = String(params.limit);
|
|
1081
|
-
|
|
1091
|
+
for (const key of ["categoryIds", "venueEventIds", "userIds"]) {
|
|
1092
|
+
const value = params[key];
|
|
1093
|
+
if (value == null ? void 0 : value.length) query[key] = value;
|
|
1094
|
+
}
|
|
1082
1095
|
return this.request("/leaderboard", {
|
|
1083
1096
|
query: Object.keys(query).length ? query : void 0
|
|
1084
1097
|
});
|
|
1085
1098
|
});
|
|
1086
1099
|
}
|
|
1087
1100
|
/**
|
|
1088
|
-
* One user's
|
|
1089
|
-
* most 366) with a running cumulative
|
|
1101
|
+
* One user's (or, with no user, the whole app's) leaderboard stats per UTC
|
|
1102
|
+
* day (default the last 30 days, at most 366) with a running cumulative
|
|
1103
|
+
* realized P&L, optionally for a single category. Gross of fees;
|
|
1090
1104
|
* unrealized P&L is not included.
|
|
1091
1105
|
*/
|
|
1092
1106
|
getLeaderboardSeries(params) {
|
|
1093
1107
|
return __async(this, null, function* () {
|
|
1108
|
+
var _a;
|
|
1094
1109
|
const query = {};
|
|
1095
1110
|
for (const key of [
|
|
1096
1111
|
"from",
|
|
@@ -1103,17 +1118,21 @@ Issued At: ${issuedAt}`;
|
|
|
1103
1118
|
const value = params[key];
|
|
1104
1119
|
if (value) query[key] = value;
|
|
1105
1120
|
}
|
|
1121
|
+
if ((_a = params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
1106
1122
|
return this.request("/leaderboard/series", { query });
|
|
1107
1123
|
});
|
|
1108
1124
|
}
|
|
1109
1125
|
/** List execution positions for the authenticated user (cursor pagination). */
|
|
1110
1126
|
getExecutionPositions() {
|
|
1111
1127
|
return __async(this, arguments, function* (params = {}) {
|
|
1128
|
+
var _a;
|
|
1112
1129
|
const query = {};
|
|
1113
1130
|
if (params.cursor) query.cursor = params.cursor;
|
|
1114
1131
|
if (params.limit != null) query.limit = String(params.limit);
|
|
1115
1132
|
if (params.status) query.status = params.status;
|
|
1116
1133
|
if (params.mode) query.mode = params.mode;
|
|
1134
|
+
if ((_a = params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
1135
|
+
if (params.sort) query.sort = params.sort;
|
|
1117
1136
|
return this.request("/execution/positions", {
|
|
1118
1137
|
query: Object.keys(query).length ? query : void 0
|
|
1119
1138
|
});
|
|
@@ -1909,11 +1928,15 @@ Issued At: ${issuedAt}`;
|
|
|
1909
1928
|
const url = new URL(this.wsUrl);
|
|
1910
1929
|
if (this._appId) url.searchParams.set("appId", this._appId);
|
|
1911
1930
|
const createSocket = (_a = this.webSocketFactory) != null ? _a : ((socketOptions) => new AggWebSocket(socketOptions));
|
|
1931
|
+
const watchdogHeaders = {};
|
|
1932
|
+
if (this._appId) watchdogHeaders["x-app-id"] = this._appId;
|
|
1933
|
+
if (this.apiKey) watchdogHeaders["x-app-api-key"] = this.apiKey;
|
|
1912
1934
|
return createSocket({
|
|
1913
1935
|
url: url.toString(),
|
|
1914
1936
|
callbacks,
|
|
1915
1937
|
initialToken: this.accessToken,
|
|
1916
|
-
enableLogs: (_b = options == null ? void 0 : options.enableLogs) != null ? _b : false
|
|
1938
|
+
enableLogs: (_b = options == null ? void 0 : options.enableLogs) != null ? _b : false,
|
|
1939
|
+
bookWatchdog: (options == null ? void 0 : options.bookWatchdog) === false ? void 0 : __spreadValues({ baseUrl: this.baseUrl, headers: watchdogHeaders }, options == null ? void 0 : options.bookWatchdog)
|
|
1917
1940
|
});
|
|
1918
1941
|
}
|
|
1919
1942
|
/** Execute a previously quoted managed trade. Returns pending order IDs. */
|
|
@@ -2181,11 +2204,14 @@ Issued At: ${issuedAt}`;
|
|
|
2181
2204
|
/** Get open positions grouped by matched market with per-venue breakdown. */
|
|
2182
2205
|
getPositions(params) {
|
|
2183
2206
|
return __async(this, null, function* () {
|
|
2207
|
+
var _a;
|
|
2184
2208
|
const query = {};
|
|
2185
2209
|
if (params == null ? void 0 : params.cursor) query.cursor = params.cursor;
|
|
2186
2210
|
if ((params == null ? void 0 : params.limit) != null) query.limit = String(params.limit);
|
|
2187
2211
|
if (params == null ? void 0 : params.status) query.status = params.status;
|
|
2188
2212
|
if (params == null ? void 0 : params.mode) query.mode = params.mode;
|
|
2213
|
+
if ((_a = params == null ? void 0 : params.categoryIds) == null ? void 0 : _a.length) query.categoryIds = params.categoryIds;
|
|
2214
|
+
if (params == null ? void 0 : params.sort) query.sort = params.sort;
|
|
2189
2215
|
return this.request("/execution/positions", {
|
|
2190
2216
|
query: Object.keys(query).length > 0 ? query : void 0
|
|
2191
2217
|
});
|
package/dist/market-data.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChartBarsResponse } from './agg-websocket-
|
|
2
|
-
export {
|
|
1
|
+
import { C as ChartBarsResponse } from './agg-websocket-x_U4-orL.mjs';
|
|
2
|
+
export { bE as CandleTail, cj as HistoryRangeRequest, M as MarketDataEngine, cr as MarketView, cs as MarketViewBatch } from './agg-websocket-x_U4-orL.mjs';
|
|
3
3
|
|
|
4
4
|
/** Decode bounded dynamic history where processing lives; retain milliseconds and optional mean. */
|
|
5
5
|
declare function decodeChartHistory(payload: string): ChartBarsResponse;
|
package/dist/market-data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChartBarsResponse } from './agg-websocket-
|
|
2
|
-
export {
|
|
1
|
+
import { C as ChartBarsResponse } from './agg-websocket-x_U4-orL.js';
|
|
2
|
+
export { bE as CandleTail, cj as HistoryRangeRequest, M as MarketDataEngine, cr as MarketView, cs as MarketViewBatch } from './agg-websocket-x_U4-orL.js';
|
|
3
3
|
|
|
4
4
|
/** Decode bounded dynamic history where processing lives; retain milliseconds and optional mean. */
|
|
5
5
|
declare function decodeChartHistory(payload: string): ChartBarsResponse;
|