@skinpricer/sdk 0.5.0 → 0.6.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/index.d.ts CHANGED
@@ -31,6 +31,19 @@ declare class SkinpricerError extends Error {
31
31
 
32
32
  type HttpMethod = "GET" | "POST";
33
33
  type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
34
+ /** The part of a WebSocket the SDK uses: the global `WebSocket` and the ws package both fit. */
35
+ interface WebSocketLike {
36
+ addEventListener(type: "open" | "message" | "close" | "error", listener: (event: WebSocketEventLike) => void): void;
37
+ close(code?: number, reason?: string): void;
38
+ }
39
+ interface WebSocketEventLike {
40
+ /** A message's payload. */
41
+ data?: unknown;
42
+ /** A close event's code. */
43
+ code?: number;
44
+ }
45
+ /** Opens a WebSocket that sends `headers` with its upgrade request. */
46
+ type WebSocketFactory = (url: string, headers: Record<string, string>) => WebSocketLike;
34
47
 
35
48
  interface RequestHookContext {
36
49
  method: HttpMethod;
@@ -75,6 +88,12 @@ interface ClientConfig {
75
88
  publicBaseUrl?: string;
76
89
  /** Custom `fetch` implementation. Defaults to the global `fetch`. */
77
90
  fetch?: FetchLike;
91
+ /**
92
+ * Opens WebSockets for `prices.stream()`. Defaults to the global `WebSocket`
93
+ * (Node.js 22 and later), which must accept `{ headers }` as its second
94
+ * argument, as Node.js and the ws package do. Browsers cannot send the key.
95
+ */
96
+ webSocket?: WebSocketFactory;
78
97
  /** Per-request timeout in ms. Defaults to 30000; `0` disables it. */
79
98
  timeoutMs?: number;
80
99
  /** Retry behavior, or `false` to disable. */
@@ -94,6 +113,7 @@ interface ResolvedConfig {
94
113
  baseUrl: string;
95
114
  publicBaseUrl: string;
96
115
  fetch: FetchLike;
116
+ webSocket?: WebSocketFactory;
97
117
  timeoutMs: number;
98
118
  retry: RetryConfig | null;
99
119
  headers: Record<string, string>;
@@ -125,6 +145,8 @@ interface HttpResponse<T> {
125
145
  data: T;
126
146
  meta: ResponseMeta;
127
147
  }
148
+ /** Reads a successful response body that is not JSON. */
149
+ type BodyReader<T> = (response: Response, meta: ResponseMeta, signal: AbortSignal) => Promise<T>;
128
150
 
129
151
  type QueryScalar = string | number | boolean;
130
152
  type QueryValue = QueryScalar | QueryScalar[] | Date | null | undefined;
@@ -154,7 +176,9 @@ declare class HttpClient {
154
176
  get publicBaseUrl(): string;
155
177
  /** Selects an API version while retaining a configured gateway prefix. */
156
178
  versionedBaseUrl(version: "v2", baseUrl?: string): string;
157
- request<T>(input: BuildRequestInput, options?: RequestOptions): Promise<HttpResponse<T>>;
179
+ /** Opens a WebSocket to a GET route, sending the request's headers. */
180
+ openWebSocket(input: BuildRequestInput): WebSocketLike;
181
+ request<T>(input: BuildRequestInput, options?: RequestOptions, readBody?: BodyReader<T>): Promise<HttpResponse<T>>;
158
182
  private recordRateLimit;
159
183
  private awaitThrottle;
160
184
  }
@@ -224,7 +248,36 @@ type QuotePriceKind = "ask" | "bid";
224
248
  type ValueKind = "cash" | "wallet" | "bot_rate" | "unknown";
225
249
  /** Whether a sell average and maximum come from the market's own listing statistics or from observed lowest asks. */
226
250
  type SellBasis = "listing_statistic" | "lowest_ask";
227
- interface MarketPricePoint {
251
+ /** Currencies the v2 price and history reads can serve prices in. */
252
+ type Currency = "USD" | "EUR" | "GBP" | "CHF" | "RUB" | "PLN" | "BRL" | "JPY" | "NOK" | "IDR" | "MYR" | "PHP" | "SGD" | "THB" | "VND" | "KRW" | "TRY" | "UAH" | "MXN" | "CAD" | "AUD" | "NZD" | "CNY" | "INR" | "CLP" | "PEN" | "COP" | "ZAR" | "HKD" | "TWD" | "SAR" | "AED" | "SEK" | "ARS" | "ILS" | "BYN" | "KZT" | "KWD" | "QAR" | "CRC" | "UYU" | "BGN" | "HRK" | "CZK" | "DKK" | "HUF" | "RON";
253
+ /**
254
+ * The one rate every converted price in a response uses. Each converted amount
255
+ * is the USD-cent value / 100 x `rate`, rounded half up to an integer in the
256
+ * minor unit of `quote`; `stdDev` is rounded to 2 decimals instead. Fields
257
+ * named `...Usd...`, `originalPriceCents` and `originalCurrency` are not
258
+ * converted.
259
+ */
260
+ interface PriceFx {
261
+ base: "USD";
262
+ quote: Currency;
263
+ /** Units of `quote` per 1 USD. */
264
+ rate: number;
265
+ source: string;
266
+ rateTime: IsoDateString | null;
267
+ /** Converted amounts are integers in this many decimal places of `quote`. */
268
+ minorUnitDigits: number;
269
+ rounding: "half_up";
270
+ }
271
+ /** When the current price level started, and the level before it. Each field is absent when unknown. */
272
+ interface PriceLevel {
273
+ /** When this price was first observed on this market and side: the start of the current price level, not the listing time. */
274
+ priceSince?: IsoDateString;
275
+ /** The price of the level before the current one, on the same market and side. */
276
+ previousPrice?: Cents;
277
+ /** When `previousPrice` was first observed. */
278
+ previousPriceSince?: IsoDateString;
279
+ }
280
+ interface MarketPricePoint extends PriceLevel {
228
281
  market: string;
229
282
  price: Cents;
230
283
  currency: string;
@@ -249,8 +302,6 @@ interface MarketPricePoint {
249
302
  sourceTimeKind?: SourceTimeKind;
250
303
  /** Age of the source's data when it was read, in seconds. */
251
304
  sourceAgeSeconds?: number | null;
252
- /** Whether the source's data is older than 30 minutes. Absent when its age is unknown. */
253
- isSourceStale?: boolean;
254
305
  /** True for a placeholder ask left out of the aggregate's average, median and deviation. It is still a real listing. */
255
306
  outlier?: boolean;
256
307
  priceKind?: QuotePriceKind;
@@ -259,6 +310,12 @@ interface MarketPricePoint {
259
310
  /** Bids only. */
260
311
  valueKind?: ValueKind;
261
312
  }
313
+ interface MarketAskPricePoint extends MarketPricePoint {
314
+ /** CS2 `swapgg` and `itrade` only: the second-cheapest listing as fresh as this ask. Equal to `price` when two listings share the best price. Absent when only one listing is quoted. */
315
+ secondBestPrice?: Cents;
316
+ /** CS2 `swapgg` and `itrade` only: listings as fresh as this ask priced at most 2% above it, this one included. */
317
+ listingsWithin2Percent?: number;
318
+ }
262
319
  interface AggregatePriceData {
263
320
  minPrice: Cents | null;
264
321
  maxPrice: Cents | null;
@@ -273,7 +330,8 @@ interface AggregatePriceData {
273
330
  updatedAt: IsoDateString;
274
331
  priceKind?: "ask_statistic";
275
332
  }
276
- interface NbboBestPrice {
333
+ /** A best ask or bid in the all-item snapshot. */
334
+ interface LatestBestPrice {
277
335
  market: string;
278
336
  price: Cents;
279
337
  updatedAt: IsoDateString;
@@ -282,15 +340,13 @@ interface NbboBestPrice {
282
340
  /** True only for an ask you can buy at now. Always false on a bid. */
283
341
  purchasable?: boolean;
284
342
  }
343
+ interface NbboBestPrice extends LatestBestPrice, PriceLevel {
344
+ }
285
345
  interface BestPrice {
286
346
  market: string;
287
347
  price: Cents;
288
348
  updatedAt: IsoDateString;
289
349
  isStale: boolean;
290
- /** @deprecated Use `updatedAt`. The API stops sending it on 2027-01-15. */
291
- updated_at: IsoDateString;
292
- /** @deprecated Use `isStale`. The API stops sending it on 2027-01-15. */
293
- is_stale: boolean;
294
350
  priceKind?: QuotePriceKind;
295
351
  /** True only for an ask you can buy at now. Always false on a bid. */
296
352
  purchasable?: boolean;
@@ -323,6 +379,13 @@ interface PriceHistoryParams {
323
379
  listingType?: HistoryListingTypeInput;
324
380
  salesWindow?: SalesHistoryWindow;
325
381
  interval?: PriceHistoryInterval;
382
+ /** `SALE_HISTORY` only. Not accepted by `byMarket`. */
383
+ basis?: SaleHistoryBasis;
384
+ }
385
+ /** History options of a game-scoped client, which can also convert prices. */
386
+ interface GamePriceHistoryParams extends PriceHistoryParams {
387
+ /** Serve prices in this currency instead of USD cents; see {@link PriceFx}. */
388
+ currency?: Currency;
326
389
  }
327
390
  interface PriceHistoryPoint {
328
391
  timestamp: IsoDateString;
@@ -336,6 +399,26 @@ interface PriceHistoryPoint {
336
399
  bestBidCents: Cents | null;
337
400
  bestAskCents: Cents | null;
338
401
  spreadBps: number | null;
402
+ /** Seller-net cash bid after the venue commission. Null for combined `SALE_HISTORY`. */
403
+ netBestBidCents?: Cents | null;
404
+ /** Spread between `bestAskCents` and `netBestBidCents`. Null for combined `SALE_HISTORY`. */
405
+ netSpreadBps?: number | null;
406
+ /** Combined `SALE_HISTORY` only: the venues contributing to this point. */
407
+ contributingMarkets?: string[];
408
+ /** Combined `SALE_HISTORY` only: each contributing venue's latest snapshot in the bucket. */
409
+ observations?: SaleHistoryObservation[];
410
+ /**
411
+ * Per-market `SELL_OFFER` only: `minPrice` in the venue's own currency and
412
+ * minor units, before conversion and fees.
413
+ */
414
+ originalPriceCents?: number | null;
415
+ /** ISO currency of `originalPriceCents`; null exactly when it is null. */
416
+ originalCurrency?: string | null;
417
+ }
418
+ /** When one venue's trailing sales window was fetched. */
419
+ interface SaleHistoryObservation {
420
+ market: string;
421
+ observedAt: IsoDateString;
339
422
  }
340
423
  /** `GET /v1/pricing/:marketHashName/history` (camelCase). */
341
424
  interface PriceHistoryResponse {
@@ -343,13 +426,53 @@ interface PriceHistoryResponse {
343
426
  name: string;
344
427
  history: PriceHistoryPoint[];
345
428
  listingType: HistoryListingType;
346
- priceKind?: HistoryPriceKind;
429
+ priceKind: HistoryPriceKind;
347
430
  salesWindow: SalesHistoryWindow | null;
348
431
  /** Actual returned bucket width, which may differ from the requested interval. */
349
432
  effectiveInterval: "10m" | "1h" | "1d";
433
+ /** Combined `SALE_HISTORY` only. */
434
+ basis?: SaleHistoryBasis;
435
+ /**
436
+ * Combined `SALE_HISTORY` only: an equally weighted index of venues, so
437
+ * `medianPrice` is the median of venue medians, not of individual sales.
438
+ */
439
+ statistic?: "venue_price_index";
440
+ /**
441
+ * Combined `SALE_HISTORY` only: `volume` sums each venue's latest trailing
442
+ * window, so adding it across buckets counts sales more than once.
443
+ */
444
+ volumeBasis?: "trailing_window_count";
445
+ /** Combined `SALE_HISTORY` only. Steam sales are never part of `history`. */
446
+ steamWallet?: SteamWalletHistory;
447
+ /** Present only when stored history known to be wrong was left out. */
448
+ corrections?: HistoryCorrection[];
449
+ /** Present only when `currency` is not USD. */
450
+ fx?: HistoryFx;
451
+ }
452
+ /**
453
+ * A range of one market's stored history left out because it is known to be
454
+ * wrong. The market contributes nothing to a point whose bucket overlaps it.
455
+ */
456
+ interface HistoryCorrection {
457
+ market: string;
458
+ /** Inclusive. */
459
+ from: IsoDateString;
460
+ /** Exclusive. */
461
+ to: IsoDateString;
462
+ reason: string;
463
+ }
464
+ /** Steam Community Market sales in gross wallet value, never converted to cash. */
465
+ interface SteamWalletHistory {
466
+ basis: "steam_wallet_gross";
467
+ history: PriceHistoryPoint[];
350
468
  }
351
469
  interface MarketSeries {
352
470
  market: string;
471
+ /**
472
+ * `native`: the market quotes USD. `historical`: each value was converted to
473
+ * USD at the rate when it was observed, so the series also moves with FX.
474
+ */
475
+ fxBasis: "historical" | "native";
353
476
  history: PriceHistoryPoint[];
354
477
  /** `SELL_OFFER` series only. */
355
478
  sellBasis?: SellBasis;
@@ -362,10 +485,61 @@ interface PriceHistoryByMarketResponse {
362
485
  name: string;
363
486
  series: MarketSeries[];
364
487
  listingType: HistoryListingType;
365
- priceKind?: HistoryPriceKind;
488
+ priceKind: HistoryPriceKind;
366
489
  salesWindow: SalesHistoryWindow | null;
367
490
  /** Actual returned bucket width, which may differ from the requested interval. */
368
491
  effectiveInterval: "10m" | "1h" | "1d";
492
+ /** Present only when stored history known to be wrong was left out. */
493
+ corrections?: HistoryCorrection[];
494
+ /** Present only when `currency` is not USD. */
495
+ fx?: HistoryFx;
496
+ }
497
+ /** Economic basis of combined `SALE_HISTORY`. */
498
+ type SaleHistoryBasis = "cash_venue_windows_v1";
499
+ interface PriceHistoryBatchParams {
500
+ /**
501
+ * 1 to 100 items of the game, each an exact market hash name, a slug or a
502
+ * canonical item id. A repeated entry is read once.
503
+ */
504
+ items: string[];
505
+ /** Start of the range (Date or ISO string). */
506
+ from?: Date | string;
507
+ /** End of the range (Date or ISO string). */
508
+ to?: Date | string;
509
+ interval?: PriceHistoryInterval;
510
+ listingType?: HistoryListingTypeInput;
511
+ salesWindow?: SalesHistoryWindow;
512
+ /** `SALE_HISTORY` only. */
513
+ basis?: SaleHistoryBasis;
514
+ /** Serve prices in this currency instead of USD cents; see {@link PriceFx}. */
515
+ currency?: Currency;
516
+ }
517
+ /** An entry of a history batch that did not resolve to one item. */
518
+ interface PriceHistoryBatchError {
519
+ /** `ambiguous`: two items share the name or slug; use the canonical item id. */
520
+ error: "not_found" | "ambiguous";
521
+ /** The status a single history read of the entry returns. */
522
+ status: 404 | 409;
523
+ message: string;
524
+ }
525
+ /** The rate of a converted history read, applied to every point. */
526
+ interface HistoryFx extends PriceFx {
527
+ fxBasis: "current";
528
+ }
529
+ /** `POST /v2/pricing/history/batch`. */
530
+ interface PriceHistoryBatchResponse {
531
+ listingType: HistoryListingType;
532
+ priceKind: HistoryPriceKind;
533
+ salesWindow?: SalesHistoryWindow | null;
534
+ effectiveInterval: "10m" | "1h" | "1d";
535
+ from: IsoDateString;
536
+ to: IsoDateString;
537
+ /** Each resolved entry, keyed exactly as sent. */
538
+ items: Record<string, PriceHistoryResponse>;
539
+ /** Each entry that did not resolve, keyed exactly as sent. */
540
+ errors: Record<string, PriceHistoryBatchError>;
541
+ /** Present only when `currency` is not USD. */
542
+ fx?: HistoryFx;
369
543
  }
370
544
 
371
545
  /** Games supported by the v2 pricing API. */
@@ -377,7 +551,7 @@ declare abstract class BaseResource {
377
551
  private readonly game?;
378
552
  constructor(http: HttpClient, game?: Game | undefined);
379
553
  /** Performs a request and returns the data with {@link ResponseMeta} attached. */
380
- protected call<T>(input: BuildRequestInput, options?: RequestOptions): Promise<T>;
554
+ protected call<T>(input: BuildRequestInput, options?: RequestOptions, readBody?: BodyReader<T>): Promise<T>;
381
555
  }
382
556
 
383
557
  /** Historical price series for an item. */
@@ -385,19 +559,40 @@ declare class HistoryResource extends BaseResource {
385
559
  /** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
386
560
  get(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryResponse>;
387
561
  /** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
388
- byMarket(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryByMarketResponse>;
562
+ byMarket(marketHashName: string, params?: Omit<PriceHistoryParams, "basis">, options?: RequestOptions): Promise<PriceHistoryByMarketResponse>;
563
+ }
564
+ /** Game-scoped history, which adds `currency` and the batch read. */
565
+ declare class GameHistoryResource extends HistoryResource {
566
+ get(marketHashName: string, params?: GamePriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryResponse>;
567
+ byMarket(marketHashName: string, params?: Omit<GamePriceHistoryParams, "basis">, options?: RequestOptions): Promise<PriceHistoryByMarketResponse>;
568
+ /**
569
+ * `POST /v2/pricing/history/batch` — the aggregate series of {@link get} for
570
+ * up to 100 items. Entries that do not resolve are listed in `errors` and
571
+ * the rest are still served.
572
+ *
573
+ * Items x buckets may not exceed 10,000 points (twice the buckets for
574
+ * `SALE_HISTORY`), and a batch in 10m buckets takes at most 25 items; the
575
+ * API rejects a larger batch with a 400 error. Each distinct item costs 5
576
+ * rate-limit units.
577
+ */
578
+ batch(params: PriceHistoryBatchParams, options?: RequestOptions): Promise<PriceHistoryBatchResponse>;
389
579
  }
390
580
 
391
581
  interface CurrentPriceParams {
392
582
  /** Restrict the response to these market ids. */
393
583
  markets?: KnownMarket[];
394
584
  }
585
+ /** Current price options of a game-scoped client, which can also convert prices. */
586
+ interface GameCurrentPriceParams extends CurrentPriceParams {
587
+ /** Serve prices in this currency instead of USD cents; see {@link PriceFx}. */
588
+ currency?: Currency;
589
+ }
395
590
  /** `GET /v1/pricing/:marketHashName` (camelCase). */
396
591
  interface CurrentPriceResponse {
397
592
  canonicalItemId: string;
398
593
  name: string;
399
594
  aggregate?: AggregatePriceData;
400
- markets: MarketPricePoint[];
595
+ markets: MarketAskPricePoint[];
401
596
  buyOrders?: MarketPricePoint[];
402
597
  bestAsk?: NbboBestPrice | null;
403
598
  bestBid?: NbboBestPrice | null;
@@ -405,6 +600,8 @@ interface CurrentPriceResponse {
405
600
  marketCount?: number;
406
601
  freshMarketCount?: number;
407
602
  calculatedAt: IsoDateString;
603
+ /** Present only when `currency` is not USD. */
604
+ fx?: PriceFx;
408
605
  }
409
606
  interface PricingListingsParams {
410
607
  /** Max listing samples to return (1–2000, default 500). */
@@ -540,6 +737,67 @@ interface LiquidityMarketMetric {
540
737
  salesDataAgeMinutes: number | null;
541
738
  listingsDataAgeMinutes: number | null;
542
739
  }
740
+ type BuyOrderEstimateMarket = "dmarket" | "steamcommunity" | "csfloat";
741
+ /** `estimate`: DMarket labels buy-order fills. `upper_bound`: Steam gives a new listing to the oldest eligible buy order, so a new order fills at most this often. */
742
+ type BuyOrderEstimateKind = "estimate" | "upper_bound";
743
+ /** `calibration_failed` carries the failing cohort in `calibration`. */
744
+ type BuyOrderEstimateUnavailableReason = "no_bid" | "stale_book" | "unsupported_item" | "unsupported_market" | "no_recent_history" | "source_unavailable" | "not_calibrated" | "calibration_failed";
745
+ /** Items grouped by `salesAtOrBelowPriceCount`. */
746
+ type BuyOrderCohort = "0" | "1-2" | "3-9" | "10-49" | "50+";
747
+ /** Out-of-time check of the item's cohort against a baseline that counts every sale. */
748
+ interface BuyOrderCalibration {
749
+ cohort: BuyOrderCohort;
750
+ horizonHours: number;
751
+ samples: number;
752
+ predicted: number;
753
+ observed: number;
754
+ /** `upper_bound` only: share with an hour that could hold a sale at or below the price. */
755
+ possible?: number;
756
+ /** `predicted - observed`. */
757
+ error: number;
758
+ baselinePredicted: number;
759
+ tolerance: number;
760
+ passed: boolean;
761
+ calibratedAt: IsoDateString;
762
+ }
763
+ interface BuyOrderEvidence {
764
+ basis: "labeled_buy_order_sales_at_or_below_price" | "hourly_sales_at_or_below_price_upper_bound";
765
+ /** Hours of sale history read, up to 168. */
766
+ windowHours: number;
767
+ salesAtOrBelowPriceCount: number;
768
+ }
769
+ interface BuyOrderFillProbability {
770
+ horizonHours: 1 | 24;
771
+ /** 0-1; with `kind: "upper_bound"` the fill probability is at most this. */
772
+ probability: number;
773
+ }
774
+ interface AvailableBuyOrderEstimate {
775
+ market: BuyOrderEstimateMarket;
776
+ available: true;
777
+ kind: BuyOrderEstimateKind;
778
+ model: string;
779
+ /** Hourly. */
780
+ calculatedAt: IsoDateString;
781
+ /** When the best bid was read. */
782
+ quoteAt: IsoDateString;
783
+ bestBidCents: Cents;
784
+ bestAskCents: Cents | null;
785
+ /** The order scored: one cent above the best bid. */
786
+ orderPriceCents: Cents;
787
+ evidence: BuyOrderEvidence;
788
+ fillProbability: BuyOrderFillProbability[];
789
+ /** An upper bound is at most `MEDIUM`. */
790
+ confidence: "LOW" | "MEDIUM" | "HIGH";
791
+ calibration: BuyOrderCalibration;
792
+ }
793
+ interface UnavailableBuyOrderEstimate {
794
+ market: BuyOrderEstimateMarket;
795
+ available: false;
796
+ reason: BuyOrderEstimateUnavailableReason;
797
+ calibration?: BuyOrderCalibration;
798
+ }
799
+ /** How likely a buy order one cent above a market's best bid is to fill, from sale history alone. Check `available` before reading the estimate. */
800
+ type BuyOrderEstimate = AvailableBuyOrderEstimate | UnavailableBuyOrderEstimate;
543
801
  /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
544
802
  interface LiquidityResponse {
545
803
  canonicalItemId: string;
@@ -565,6 +823,8 @@ interface LiquidityResponse {
565
823
  metrics: LiquidityMarketMetric[];
566
824
  /** Data-quality flags, e.g. `sales_data_stale:marketcsgo`. */
567
825
  notes: string[];
826
+ /** CS2 only, advisory, one entry per market; absent when the API has no estimates to serve. */
827
+ buyOrderEstimates?: BuyOrderEstimate[];
568
828
  calculatedAt: IsoDateString;
569
829
  }
570
830
  /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
@@ -597,12 +857,8 @@ interface LiquidityBatchResponse {
597
857
  /** Bulk-map entry. */
598
858
  interface LiquidityBulkItem {
599
859
  marketHashName: string;
600
- /** @deprecated Use `marketHashName`. The API stops sending it on 2027-01-15. */
601
- market_hash_name: string;
602
860
  liquidity: LiquidityLabel;
603
861
  estimatedSaleTime: string;
604
- /** @deprecated Use `estimatedSaleTime`. The API stops sending it on 2027-01-15. */
605
- estimated_sale_time: string;
606
862
  liquidityBadge: LiquidityBadge;
607
863
  confidence: LiquidityConfidence;
608
864
  score: number | null;
@@ -685,6 +941,11 @@ interface NbboParams {
685
941
  marketHashName?: string;
686
942
  markets?: KnownMarket[];
687
943
  }
944
+ /** NBBO options of a game-scoped client, which can also convert prices. */
945
+ interface GameNbboParams extends NbboParams {
946
+ /** Serve prices in this currency instead of USD cents; see {@link PriceFx}. */
947
+ currency?: Currency;
948
+ }
688
949
  /** Fee-aware, executability-ranked best price for one side. Ask `price` is the total a buyer pays; bid `price` is the net a seller receives after fees. */
689
950
  interface ExecutionAdjustedBestPrice {
690
951
  market: string;
@@ -731,6 +992,8 @@ interface NbboResponse {
731
992
  calculatedAt: IsoDateString;
732
993
  /** Execution-adjusted "real best market"; null when no quotes. */
733
994
  executionAdjusted: ExecutionAdjustedNbbo | null;
995
+ /** Present only when `currency` is not USD. */
996
+ fx?: PriceFx;
734
997
  }
735
998
  interface NbboDepthParams extends NbboParams {
736
999
  /** Aggregated depth levels per side (1–50, default 10). */
@@ -781,6 +1044,10 @@ declare class NbboResource extends BaseResource {
781
1044
  /** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
782
1045
  depth(params: NbboDepthParams, options?: RequestOptions): Promise<NbboDepthResponse>;
783
1046
  }
1047
+ /** Game-scoped NBBO, which adds `currency` to {@link get}. */
1048
+ declare class GameNbboResource extends NbboResource {
1049
+ get(params: GameNbboParams, options?: RequestOptions): Promise<NbboResponse>;
1050
+ }
784
1051
 
785
1052
  /** Current cross-market pricing for a single item. */
786
1053
  declare class PricingResource extends BaseResource {
@@ -789,6 +1056,10 @@ declare class PricingResource extends BaseResource {
789
1056
  /** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
790
1057
  listings(marketHashName: string, params?: PricingListingsParams, options?: RequestOptions): Promise<PricingListingsResponse>;
791
1058
  }
1059
+ /** Game-scoped pricing, which adds `currency` to {@link get}. */
1060
+ declare class GamePricingResource extends PricingResource {
1061
+ get(marketHashName: string, params?: GameCurrentPriceParams, options?: RequestOptions): Promise<CurrentPriceResponse>;
1062
+ }
792
1063
 
793
1064
  interface SchemaRarity {
794
1065
  key: string;
@@ -902,10 +1173,10 @@ declare class SchemaResource extends BaseResource {
902
1173
  /** Game-scoped v2 resources. Construct with `client.forGame(game)`. */
903
1174
  declare class GameClient<G extends Game> {
904
1175
  readonly game: G;
905
- readonly pricing: PricingResource;
906
- readonly history: HistoryResource;
1176
+ readonly pricing: GamePricingResource;
1177
+ readonly history: GameHistoryResource;
907
1178
  readonly items: ItemSearchResource;
908
- readonly nbbo: NbboResource;
1179
+ readonly nbbo: GameNbboResource;
909
1180
  readonly liquidity: ItemLiquidityResource<LiquidityMarketForGame<G>>;
910
1181
  readonly schema: SchemaResource;
911
1182
  readonly markets: MarketsResource;
@@ -931,25 +1202,11 @@ interface MarketMinPrice {
931
1202
  priceKind?: "ask";
932
1203
  /** True only when you can buy at this price now. */
933
1204
  purchasable?: boolean;
934
- /** @deprecated Use `marketName`. The API stops sending it on 2027-01-15. */
935
- market_name: string;
936
- /** @deprecated Use `updatedAt`. The API stops sending it on 2027-01-15. */
937
- updated_at: IsoDateString;
938
- /** @deprecated Use `isStale`. The API stops sending it on 2027-01-15. */
939
- is_stale?: boolean;
940
- /** @deprecated Use `ingestedAt`. The API stops sending it on 2027-01-15. */
941
- ingested_at?: IsoDateString;
942
- /** @deprecated Use `ingestLatencyMs`. The API stops sending it on 2027-01-15. */
943
- ingest_latency_ms?: number;
944
1205
  }
945
1206
  interface ItemMinPrices {
946
1207
  canonicalItemId: string;
947
1208
  marketHashName: string;
948
1209
  prices: MarketMinPrice[];
949
- /** @deprecated Use `canonicalItemId`. The API stops sending it on 2027-01-15. */
950
- canonical_item_id: string;
951
- /** @deprecated Use `marketHashName`. The API stops sending it on 2027-01-15. */
952
- market_hash_name: string;
953
1210
  }
954
1211
  /** `GET /v1/aggregations/min-prices`. */
955
1212
  interface MinPricesResponse {
@@ -968,27 +1225,11 @@ interface MarketMaxOrder {
968
1225
  valueKind?: ValueKind;
969
1226
  priceKind?: "bid";
970
1227
  purchasable?: false;
971
- /** @deprecated Use `marketName`. The API stops sending it on 2027-01-15. */
972
- market_name: string;
973
- /** @deprecated Use `updatedAt`. The API stops sending it on 2027-01-15. */
974
- updated_at: IsoDateString;
975
- /** @deprecated Use `isStale`. The API stops sending it on 2027-01-15. */
976
- is_stale: boolean;
977
- /** @deprecated Use `totalQuantity`. The API stops sending it on 2027-01-15. */
978
- total_quantity?: number;
979
- /** @deprecated Use `ingestedAt`. The API stops sending it on 2027-01-15. */
980
- ingested_at?: IsoDateString;
981
- /** @deprecated Use `ingestLatencyMs`. The API stops sending it on 2027-01-15. */
982
- ingest_latency_ms?: number;
983
1228
  }
984
1229
  interface ItemMaxOrders {
985
1230
  canonicalItemId: string;
986
1231
  marketHashName: string;
987
1232
  orders: MarketMaxOrder[];
988
- /** @deprecated Use `canonicalItemId`. The API stops sending it on 2027-01-15. */
989
- canonical_item_id: string;
990
- /** @deprecated Use `marketHashName`. The API stops sending it on 2027-01-15. */
991
- market_hash_name: string;
992
1233
  }
993
1234
  /** `GET /v1/aggregations/max-orders`. */
994
1235
  interface MaxOrdersResponse {
@@ -1291,38 +1532,6 @@ interface MarketAnalyticsPoint {
1291
1532
  sellBasis?: SellBasis;
1292
1533
  /** Settlement kind of this market's bids: `currentBid`, `buyAvgPrice` and `buyMaxPrice`. */
1293
1534
  valueKind?: ValueKind;
1294
- /** @deprecated Use `currentAsk`. The API stops sending it on 2027-01-15. */
1295
- current_ask: Cents | null;
1296
- /** @deprecated Use `currentBid`. The API stops sending it on 2027-01-15. */
1297
- current_bid: Cents | null;
1298
- /** @deprecated Use `spreadBps`. The API stops sending it on 2027-01-15. */
1299
- spread_bps: number | null;
1300
- /** @deprecated Use `askIsStale`. The API stops sending it on 2027-01-15. */
1301
- ask_is_stale: boolean | null;
1302
- /** @deprecated Use `bidIsStale`. The API stops sending it on 2027-01-15. */
1303
- bid_is_stale: boolean | null;
1304
- /** @deprecated Use `currentListingCount`. The API stops sending it on 2027-01-15. */
1305
- current_listing_count: number | null;
1306
- /** @deprecated Use `currentBuyOrderCount`. The API stops sending it on 2027-01-15. */
1307
- current_buy_order_count: number | null;
1308
- /** @deprecated Use `currentBidQuantity`. The API stops sending it on 2027-01-15. */
1309
- current_bid_quantity: number | null;
1310
- /** @deprecated Use `sellAvgPrice`. The API stops sending it on 2027-01-15. */
1311
- sell_avg_price: Cents | null;
1312
- /** @deprecated Use `sellMinPrice`. The API stops sending it on 2027-01-15. */
1313
- sell_min_price: Cents | null;
1314
- /** @deprecated Use `sellMaxPrice`. The API stops sending it on 2027-01-15. */
1315
- sell_max_price: Cents | null;
1316
- /** @deprecated Use `sellAvgListingCount`. The API stops sending it on 2027-01-15. */
1317
- sell_avg_listing_count: number | null;
1318
- /** @deprecated Use `buyAvgPrice`. The API stops sending it on 2027-01-15. */
1319
- buy_avg_price: Cents | null;
1320
- /** @deprecated Use `buyMaxPrice`. The API stops sending it on 2027-01-15. */
1321
- buy_max_price: Cents | null;
1322
- /** @deprecated Use `buyAvgOrderCount`. The API stops sending it on 2027-01-15. */
1323
- buy_avg_order_count: number | null;
1324
- /** @deprecated Use `buyAvgTotalQuantity`. The API stops sending it on 2027-01-15. */
1325
- buy_avg_total_quantity: number | null;
1326
1535
  }
1327
1536
  /** `GET /v1/market-analytics/:marketHashName`. */
1328
1537
  interface MarketAnalyticsResponse {
@@ -1331,14 +1540,6 @@ interface MarketAnalyticsResponse {
1331
1540
  windowHours: number;
1332
1541
  markets: MarketAnalyticsPoint[];
1333
1542
  calculatedAt: IsoDateString;
1334
- /** @deprecated Use `canonicalItemId`. The API stops sending it on 2027-01-15. */
1335
- canonical_item_id: string;
1336
- /** @deprecated Use `marketHashName`. The API stops sending it on 2027-01-15. */
1337
- market_hash_name: string;
1338
- /** @deprecated Use `windowHours`. The API stops sending it on 2027-01-15. */
1339
- window_hours: number;
1340
- /** @deprecated Use `calculatedAt`. The API stops sending it on 2027-01-15. */
1341
- calculated_at: IsoDateString;
1342
1543
  }
1343
1544
 
1344
1545
  /** Per-market current + historical analytics for an item. */
@@ -1349,11 +1550,15 @@ declare class MarketAnalyticsResource extends BaseResource {
1349
1550
 
1350
1551
  interface LatestPricesParams {
1351
1552
  game: Game;
1352
- /** ETag from the preceding snapshot. HTTP 304 returns null. */
1553
+ /** Serve prices in this currency instead of USD cents; see {@link PriceFx}. */
1554
+ currency?: Currency;
1555
+ /** `priceLevels` adds the {@link PriceLevel} fields to every `markets[]` and `buyOrders[]` point. */
1556
+ include?: "priceLevels";
1557
+ /** ETag from the preceding snapshot of the same currency and `include`. HTTP 304 returns null. */
1353
1558
  ifNoneMatch?: string;
1354
1559
  }
1355
- /** Fields shared by every quote in the all-item snapshot. */
1356
- interface LatestPricePoint {
1560
+ /** Fields shared by every quote in the all-item snapshot. The {@link PriceLevel} fields come only with `include: "priceLevels"`. */
1561
+ interface LatestPricePoint extends PriceLevel {
1357
1562
  market: string;
1358
1563
  price: Cents;
1359
1564
  /** When the price was last read or confirmed still current. Not the age of the data. */
@@ -1384,17 +1589,15 @@ interface LatestPriceBidPoint extends LatestPricePoint {
1384
1589
  sourceTimeKind?: SourceTimeKind;
1385
1590
  /** Age of the source's data when it was read, in seconds. */
1386
1591
  sourceAgeSeconds?: number;
1387
- /** Whether the source's data was older than 30 minutes when the snapshot was built. */
1388
- isSourceStale?: boolean;
1389
1592
  valueKind?: ValueKind;
1390
1593
  }
1391
1594
  interface LatestPriceItem {
1392
1595
  /** Market hash name. */
1393
1596
  name: string;
1394
1597
  canonicalItemId: string;
1395
- bestAsk: NbboBestPrice | null;
1598
+ bestAsk: LatestBestPrice | null;
1396
1599
  /** Best bid among markets that pay out in cash. */
1397
- bestBid: NbboBestPrice | null;
1600
+ bestBid: LatestBestPrice | null;
1398
1601
  markets: LatestPriceAskPoint[];
1399
1602
  buyOrders: LatestPriceBidPoint[];
1400
1603
  }
@@ -1403,21 +1606,284 @@ interface LatestPricesResponse {
1403
1606
  /** When the oldest read in the snapshot started. A quote's `fetchedAt` can be later. */
1404
1607
  generatedAt: IsoDateString;
1405
1608
  game: Game;
1406
- currency: "USD";
1609
+ /** Currency of every price: USD, or the requested currency. */
1610
+ currency: Currency;
1611
+ /** Present only when `currency` is not USD. */
1612
+ fx?: PriceFx;
1407
1613
  /** Ordered by `canonicalItemId`. */
1408
1614
  items: LatestPriceItem[];
1409
1615
  itemCount: number;
1410
1616
  }
1617
+ interface PricesRollingParams {
1618
+ game: Game;
1619
+ /** ETag of a file you already hold. HTTP 304 returns null. */
1620
+ ifNoneMatch?: string;
1621
+ }
1622
+ /**
1623
+ * `complete`: the window lies inside what is captured for the source.
1624
+ * `lower_bound`: the source was watched for the whole window, but markets do
1625
+ * not report every sale. `partial_window`: the window starts before capture
1626
+ * began, so it holds only what the market's history still returned.
1627
+ */
1628
+ type RollingCompleteness = "complete" | "lower_bound" | "partial_window";
1629
+ interface RollingWindow {
1630
+ /** Days with an ask, sales or units, as the row's `countBasis` says. */
1631
+ count: number;
1632
+ /** The native median in the row's `currency`, as exact decimal text. Null is unknown, not zero. */
1633
+ median: string | null;
1634
+ /** The median in USD cents at the rate of `fxDate`. Null without a value or a rate. */
1635
+ usdCentsMedian: Cents | null;
1636
+ completeness: RollingCompleteness;
1637
+ }
1638
+ type RollingAskWindow = "7d" | "30d" | "90d";
1639
+ type RollingSaleWindow = RollingAskWindow | "180d" | "365d";
1640
+ interface RollingRowBase {
1641
+ game: Game;
1642
+ /** The last closed UTC day every window includes, `YYYY-MM-DD`. */
1643
+ windowEnd: string;
1644
+ itemId: string | null;
1645
+ itemName: string | null;
1646
+ phase: string | null;
1647
+ paintIndex: number | null;
1648
+ market: string;
1649
+ currency: string;
1650
+ /** The UTC day of the rate a non-USD median was converted at. */
1651
+ fxDate: string | null;
1652
+ }
1653
+ /** One market's daily lowest asks: each window is the median of those days. */
1654
+ interface RollingAskRow extends RollingRowBase {
1655
+ kind: "ask";
1656
+ evidence: "quotes";
1657
+ basis: "daily_lowest_ask";
1658
+ countBasis: "days";
1659
+ lanes: null;
1660
+ side: null;
1661
+ economicBasis: null;
1662
+ windows: Record<RollingAskWindow, RollingWindow>;
1663
+ }
1664
+ /** One market lane group and side: each window is the exact median of its sales. */
1665
+ interface RollingSalesRow extends RollingRowBase {
1666
+ kind: "sale";
1667
+ evidence: "sales";
1668
+ basis: "sale_prices";
1669
+ countBasis: "sales";
1670
+ lanes: string[];
1671
+ side: string;
1672
+ economicBasis: string;
1673
+ windows: Record<RollingSaleWindow, RollingWindow>;
1674
+ }
1675
+ /** A market's own median series: each window is the unit-weighted median of its points. */
1676
+ interface RollingPointsRow extends RollingRowBase {
1677
+ kind: "sale";
1678
+ evidence: "points";
1679
+ basis: "unit_weighted_point_medians";
1680
+ countBasis: "units";
1681
+ lanes: string[];
1682
+ side: null;
1683
+ economicBasis: string;
1684
+ windows: Record<RollingSaleWindow, RollingWindow>;
1685
+ }
1686
+ /**
1687
+ * One line of the rolling statistics file. Markets and evidence are never
1688
+ * combined; an item or market without a row is unknown.
1689
+ */
1690
+ type PricesRollingRow = RollingAskRow | RollingSalesRow | RollingPointsRow;
1691
+ interface PricesRollingFile {
1692
+ /** Send it as `ifNoneMatch` to skip an unchanged file. */
1693
+ etag: string | null;
1694
+ /** The last closed UTC day the windows include. */
1695
+ windowEnd: string | null;
1696
+ /** Archive receipts after this time are not in the file. */
1697
+ receivedThrough: IsoDateString | null;
1698
+ rows: PricesRollingRow[];
1699
+ }
1700
+ type LatestPricesFeedSide = "ask" | "bid";
1701
+ /** Which changes a change feed sends. Every field left out selects everything. */
1702
+ interface LatestPricesFeedFilter {
1703
+ /** Changes to `markets` and `buyOrders` of these markets only. */
1704
+ markets?: string[];
1705
+ /** canonicalItemIds, at most 1,000. */
1706
+ items?: string[];
1707
+ /** `ask` covers `markets` and `bestAsk`, `bid` covers `buyOrders` and `bestBid`. */
1708
+ sides?: LatestPricesFeedSide[];
1709
+ /** Whether `bestAsk` and `bestBid` changes are sent. Defaults to true without `markets`, false with it. */
1710
+ best?: boolean;
1711
+ }
1712
+ interface LatestPricesChangesParams extends LatestPricesFeedFilter {
1713
+ game: Game;
1714
+ /** The ETag of a default `latestAll()` snapshot, or the `to` of the last link applied. */
1715
+ since: string;
1716
+ }
1717
+ interface LatestPricesChangeBase {
1718
+ /** `<chain>:<seq>:<index>`, the same in every replay and under every filter. */
1719
+ id: string;
1720
+ /** canonicalItemId of the item. */
1721
+ item: string;
1722
+ }
1723
+ /** One replaced field of one item. A null value removes it; a null name removes the item. */
1724
+ type LatestPricesChange = LatestPricesChangeBase & ({
1725
+ field: "name";
1726
+ value: string | null;
1727
+ } | {
1728
+ field: "bestAsk" | "bestBid";
1729
+ value: LatestBestPrice | null;
1730
+ } | {
1731
+ field: "markets";
1732
+ market: string;
1733
+ value: LatestPriceAskPoint | null;
1734
+ } | {
1735
+ field: "buyOrders";
1736
+ market: string;
1737
+ value: LatestPriceBidPoint | null;
1738
+ });
1739
+ /** Every change between two consecutive published snapshots. */
1740
+ interface LatestPricesLink {
1741
+ type: "link";
1742
+ game: Game;
1743
+ seq: number;
1744
+ /** The snapshot version this link applies to. */
1745
+ from: string;
1746
+ /** The snapshot version this link produces: the next cursor. */
1747
+ to: string;
1748
+ /** `generatedAt` of the snapshot `to`. */
1749
+ generatedAt: IsoDateString;
1750
+ /** The snapshot's top-level fields other than `generatedAt`, `game`, `items` and `itemCount`, when they changed. */
1751
+ envelope?: Record<string, unknown>;
1752
+ changes: LatestPricesChange[];
1753
+ }
1754
+ /** `GET /v2/prices/latest/changes`: at most 20 links after `since`. */
1755
+ interface LatestPricesChangesResponse {
1756
+ game: Game;
1757
+ since: string;
1758
+ /** The cursor after the last link returned. */
1759
+ head: string;
1760
+ /** False while more links follow: call again with `head`. */
1761
+ complete: boolean;
1762
+ retentionSeconds: number;
1763
+ links: LatestPricesLink[];
1764
+ }
1765
+ /** Why a feed sent a reset: the cursor cannot be resumed and a new snapshot is needed. */
1766
+ type LatestPricesFeedResetReason = "cursor_unknown" | "chain_break" | "gap";
1767
+
1768
+ interface LatestPricesSyncResult {
1769
+ /** Whether a new snapshot was loaded, first or after a reset. */
1770
+ snapshot: boolean;
1771
+ /** The links applied after the last snapshot loaded. */
1772
+ links: LatestPricesLink[];
1773
+ }
1774
+ interface LatestPricesStreamOptions {
1775
+ /** Aborting it closes the stream, and `stream()` resolves. */
1776
+ signal?: AbortSignal;
1777
+ /** Called after each link is applied. */
1778
+ onLink?: (link: LatestPricesLink) => void;
1779
+ /** Called after a snapshot loads, with the reason when a reset caused it. */
1780
+ onSnapshot?: (reason: LatestPricesFeedResetReason | null) => void;
1781
+ }
1782
+ /**
1783
+ * A local copy of `GET /v2/prices/latest` for one game, kept current from
1784
+ * the change feed. Items and points it returns are live: read them, do not
1785
+ * modify them.
1786
+ *
1787
+ * With a filter the copy holds only what the filter selects: the selected
1788
+ * items, and in each the selected markets and sides. `bestAsk` and `bestBid`
1789
+ * are null when the filter does not send their changes.
1790
+ */
1791
+ declare class LatestPricesMirror {
1792
+ private readonly prices;
1793
+ readonly game: Game;
1794
+ private readonly filter;
1795
+ private readonly marketSet?;
1796
+ private readonly itemSet?;
1797
+ private readonly asks;
1798
+ private readonly bids;
1799
+ private readonly best;
1800
+ private readonly byId;
1801
+ private readonly applied;
1802
+ private envelope;
1803
+ private generatedAt;
1804
+ private version;
1805
+ constructor(prices: PricesResource, params: {
1806
+ game: Game;
1807
+ } & LatestPricesFeedFilter);
1808
+ /** The version of the snapshot the copy equals, or null before a snapshot loads. */
1809
+ get cursor(): string | null;
1810
+ get size(): number;
1811
+ item(canonicalItemId: string): LatestPriceItem | undefined;
1812
+ items(): IterableIterator<LatestPriceItem>;
1813
+ /** The copy in snapshot form, items ordered by `canonicalItemId`. */
1814
+ toSnapshot(): LatestPricesResponse;
1815
+ /**
1816
+ * Replaces the copy with a `latestAll()` snapshot read without `currency`
1817
+ * or `include`. `cursor` is its
1818
+ * ETag, or the `to` of the last link applied to a copy saved earlier.
1819
+ */
1820
+ load(snapshot: LatestPricesResponse, cursor: string): void;
1821
+ /**
1822
+ * Applies one link and moves the cursor to its `to`. Returns false for a
1823
+ * link already applied. A link that does not start at the cursor throws,
1824
+ * and the copy then needs a new snapshot.
1825
+ */
1826
+ apply(link: LatestPricesLink): boolean;
1827
+ /** Loads a new default snapshot of the game. */
1828
+ reset(options?: RequestOptions): Promise<void>;
1829
+ /**
1830
+ * Brings the copy up to date over HTTP: loads a snapshot when there is
1831
+ * none or the feed answers with a reset, then applies every link after
1832
+ * the cursor.
1833
+ */
1834
+ sync(options?: RequestOptions): Promise<LatestPricesSyncResult>;
1835
+ /**
1836
+ * Keeps the copy current over the WebSocket until `signal` aborts. It
1837
+ * resumes from the cursor after a disconnect and loads a new snapshot
1838
+ * after a reset. It rejects when the key is no longer admitted, when the
1839
+ * stream cannot be opened 10 times in a row, or when a callback throws.
1840
+ */
1841
+ stream(options?: LatestPricesStreamOptions): Promise<void>;
1842
+ private connect;
1843
+ private selected;
1844
+ private cursorOrThrow;
1845
+ private itemOf;
1846
+ private applyChange;
1847
+ }
1411
1848
 
1412
- /** All-item price snapshots. */
1849
+ /** All-item price snapshots and their change feed. */
1413
1850
  declare class PricesResource extends BaseResource {
1414
1851
  /** `GET /v2/prices/latest`. Enterprise: every item of one game with each market's ask and bid. */
1415
1852
  latestAll(params: {
1416
1853
  game: Game;
1854
+ currency?: Currency;
1855
+ include?: "priceLevels";
1417
1856
  ifNoneMatch?: undefined;
1418
1857
  }, options?: RequestOptions): Promise<LatestPricesResponse>;
1419
1858
  /** A matching conditional ETag returns null. */
1420
1859
  latestAll(params: LatestPricesParams, options?: RequestOptions): Promise<LatestPricesResponse | null>;
1860
+ /**
1861
+ * `GET /v2/prices/rolling`. Pro and Enterprise: every item's 7 to 90-day
1862
+ * ask medians and 7 to 365-day sale medians per market, downloaded and
1863
+ * decompressed.
1864
+ */
1865
+ rolling(params: {
1866
+ game: Game;
1867
+ ifNoneMatch?: undefined;
1868
+ }, options?: RequestOptions): Promise<PricesRollingFile>;
1869
+ /** A matching conditional ETag returns null. */
1870
+ rolling(params: PricesRollingParams, options?: RequestOptions): Promise<PricesRollingFile | null>;
1871
+ /**
1872
+ * `GET /v2/prices/latest/changes`: up to 20 links after `since`. A cursor
1873
+ * that can no longer be resumed is an `APIError` with status 410 and code
1874
+ * `FEED_RESET`; take a new snapshot then.
1875
+ */
1876
+ changes(params: LatestPricesChangesParams, options?: RequestOptions): Promise<LatestPricesChangesResponse>;
1877
+ /**
1878
+ * Opens the WebSocket at `/v2/prices/stream`. It sends one `hello`, then a
1879
+ * `link` message per published snapshot, or a `reset` before closing with
1880
+ * code 4009. {@link mirror} handles the protocol.
1881
+ */
1882
+ stream(params: LatestPricesChangesParams): WebSocketLike;
1883
+ /** A local copy of the snapshot that the change feed keeps current. */
1884
+ mirror(params: {
1885
+ game: Game;
1886
+ } & LatestPricesFeedFilter): LatestPricesMirror;
1421
1887
  }
1422
1888
 
1423
1889
  interface RecommendationParams {
@@ -1443,34 +1909,6 @@ interface RecommendationResponse {
1443
1909
  buyOrderCount: number;
1444
1910
  totalBidQuantity: number;
1445
1911
  calculatedAt: IsoDateString;
1446
- /** @deprecated Use `canonicalItemId`. The API stops sending it on 2027-01-15. */
1447
- canonical_item_id: string;
1448
- /** @deprecated Use `marketHashName`. The API stops sending it on 2027-01-15. */
1449
- market_hash_name: string;
1450
- /** @deprecated Use `suggestedPrice`. The API stops sending it on 2027-01-15. */
1451
- suggested_price: Cents | null;
1452
- /** @deprecated Use `liquidityScore`. The API stops sending it on 2027-01-15. */
1453
- liquidity_score: number;
1454
- /** @deprecated Use `unstableReasons`. The API stops sending it on 2027-01-15. */
1455
- unstable_reasons: string[];
1456
- /** @deprecated Use `bestAsk`. The API stops sending it on 2027-01-15. */
1457
- best_ask: BestPrice | null;
1458
- /** @deprecated Use `bestBid`. The API stops sending it on 2027-01-15. */
1459
- best_bid: BestPrice | null;
1460
- /** @deprecated Use `spreadBps`. The API stops sending it on 2027-01-15. */
1461
- spread_bps: number | null;
1462
- /** @deprecated Use `marketCount`. The API stops sending it on 2027-01-15. */
1463
- market_count: number;
1464
- /** @deprecated Use `freshMarketCount`. The API stops sending it on 2027-01-15. */
1465
- fresh_market_count: number;
1466
- /** @deprecated Use `listingCount`. The API stops sending it on 2027-01-15. */
1467
- listing_count: number;
1468
- /** @deprecated Use `buyOrderCount`. The API stops sending it on 2027-01-15. */
1469
- buy_order_count: number;
1470
- /** @deprecated Use `totalBidQuantity`. The API stops sending it on 2027-01-15. */
1471
- total_bid_quantity: number;
1472
- /** @deprecated Use `calculatedAt`. The API stops sending it on 2027-01-15. */
1473
- calculated_at: IsoDateString;
1474
1912
  }
1475
1913
 
1476
1914
  /** Suggested executable price and liquidity signals for an item. */
@@ -1479,26 +1917,101 @@ declare class RecommendationsResource extends BaseResource {
1479
1917
  get(marketHashName: string, params?: RecommendationParams, options?: RequestOptions): Promise<RecommendationResponse>;
1480
1918
  }
1481
1919
 
1920
+ interface SalesDailyParams {
1921
+ game: Game;
1922
+ /** A closed UTC day, `YYYY-MM-DD`: yesterday or earlier. */
1923
+ date: string;
1924
+ /** ETag of a file you already hold. HTTP 304 returns null. */
1925
+ ifNoneMatch?: string;
1926
+ }
1927
+ /**
1928
+ * One line of the daily sales file. Every field is present; null is unknown,
1929
+ * never zero. An item or market without a row is unknown for the day.
1930
+ */
1931
+ interface SalesDailyRow {
1932
+ /** The UTC day, `YYYY-MM-DD`. */
1933
+ date: string;
1934
+ game: Game;
1935
+ /** The item's title as the market reported it. */
1936
+ itemName: string;
1937
+ phase: string | null;
1938
+ paintIndex: number | null;
1939
+ /** The catalog item id when exactly one item matches `itemName`. */
1940
+ itemId: string | null;
1941
+ market: string;
1942
+ /** The market's lanes in this row. Several when the market's sale feeds are merged. */
1943
+ lanes: string[];
1944
+ /** `sales`: counted sales. `points`: the market's own statistics for the day. */
1945
+ evidence: "sales" | "points";
1946
+ /** Set on `sales` rows. */
1947
+ side: string | null;
1948
+ /** The market's statistic, set on `points` rows. */
1949
+ statistic: string | null;
1950
+ /** Point resolutions, set on `points` rows. */
1951
+ resolutions: string[] | null;
1952
+ /** Number of points, set on `points` rows. */
1953
+ points: number | null;
1954
+ count: number | null;
1955
+ /** What `count` counts. Null exactly when `count` is null. */
1956
+ countBasis: "sales" | "units" | null;
1957
+ /** The count is a lower bound: the source may have more sales that day. */
1958
+ completeness: "lower_bound";
1959
+ economicBasis: string;
1960
+ currency: string;
1961
+ /** Native amounts in `currency`, as exact decimal strings. */
1962
+ priceMin: string;
1963
+ priceMax: string;
1964
+ priceMedian: string | null;
1965
+ priceMean: string | null;
1966
+ /** USD cents at the historical rate of `fxDate`. Null without a rate. */
1967
+ usdCentsMin: Cents | null;
1968
+ usdCentsMax: Cents | null;
1969
+ usdCentsMedian: Cents | null;
1970
+ usdCentsMean: Cents | null;
1971
+ fxDate: string | null;
1972
+ firstAt: IsoDateString;
1973
+ lastAt: IsoDateString;
1974
+ }
1975
+ interface SalesDailyFile {
1976
+ /** Send it as `ifNoneMatch` to skip an unchanged file. */
1977
+ etag: string | null;
1978
+ /**
1979
+ * False while the day is provisional. The final build adds late sales and
1980
+ * changes the ETag.
1981
+ */
1982
+ final: boolean;
1983
+ /** Archive receipts after this time are not in the file. */
1984
+ receivedThrough: IsoDateString | null;
1985
+ rows: SalesDailyRow[];
1986
+ }
1987
+
1988
+ /** Observed sales archive files. */
1989
+ declare class SalesResource extends BaseResource {
1990
+ /**
1991
+ * `GET /v2/sales/daily`. Pro and Enterprise: every item's observed sales
1992
+ * for one closed UTC day, downloaded and decompressed.
1993
+ */
1994
+ daily(params: {
1995
+ game: Game;
1996
+ date: string;
1997
+ ifNoneMatch?: undefined;
1998
+ }, options?: RequestOptions): Promise<SalesDailyFile>;
1999
+ /** A matching conditional ETag returns null. */
2000
+ daily(params: SalesDailyParams, options?: RequestOptions): Promise<SalesDailyFile | null>;
2001
+ }
2002
+
1482
2003
  type MarketHealthStatus = "healthy" | "degraded" | "stale";
1483
2004
  interface MarketFreshness {
1484
2005
  market: string;
1485
2006
  delaySeconds: number;
1486
2007
  lastUpdate: IsoDateString;
1487
2008
  status: MarketHealthStatus;
1488
- /** @deprecated Use `delaySeconds`. The API stops sending it on 2027-01-15. */
1489
- delay_seconds: number;
1490
- /** @deprecated Use `lastUpdate`. The API stops sending it on 2027-01-15. */
1491
- last_update: IsoDateString;
1492
2009
  }
1493
2010
  /** `GET /v1/status/freshness`. */
1494
2011
  interface FreshnessResponse {
1495
2012
  markets: MarketFreshness[];
1496
2013
  overallStatus: MarketHealthStatus;
1497
2014
  checkedAt: IsoDateString;
1498
- /** @deprecated Use `overallStatus`. The API stops sending it on 2027-01-15. */
1499
- overall_status: MarketHealthStatus;
1500
- /** @deprecated Use `checkedAt`. The API stops sending it on 2027-01-15. */
1501
- checked_at: IsoDateString;
1502
2015
  }
1503
2016
  interface MarketLatency {
1504
2017
  market: string;
@@ -1508,28 +2021,12 @@ interface MarketLatency {
1508
2021
  fetchCount: number;
1509
2022
  errorRate: number;
1510
2023
  sloBreachRate: number;
1511
- /** @deprecated Use `avgLatencyMs`. The API stops sending it on 2027-01-15. */
1512
- avg_latency_ms: number;
1513
- /** @deprecated Use `p95LatencyMs`. The API stops sending it on 2027-01-15. */
1514
- p95_latency_ms: number;
1515
- /** @deprecated Use `p99LatencyMs`. The API stops sending it on 2027-01-15. */
1516
- p99_latency_ms: number;
1517
- /** @deprecated Use `fetchCount`. The API stops sending it on 2027-01-15. */
1518
- fetch_count: number;
1519
- /** @deprecated Use `errorRate`. The API stops sending it on 2027-01-15. */
1520
- error_rate: number;
1521
- /** @deprecated Use `sloBreachRate`. The API stops sending it on 2027-01-15. */
1522
- slo_breach_rate: number;
1523
2024
  }
1524
2025
  /** `GET /v1/status/market-latency`. */
1525
2026
  interface MarketLatencyResponse {
1526
2027
  markets: MarketLatency[];
1527
2028
  windowHours: number;
1528
2029
  measuredAt: IsoDateString;
1529
- /** @deprecated Use `windowHours`. The API stops sending it on 2027-01-15. */
1530
- window_hours: number;
1531
- /** @deprecated Use `measuredAt`. The API stops sending it on 2027-01-15. */
1532
- measured_at: IsoDateString;
1533
2030
  }
1534
2031
 
1535
2032
  /** Pipeline health and latency metrics. */
@@ -1556,6 +2053,7 @@ declare class SkinpricerClient {
1556
2053
  readonly markets: MarketsResource;
1557
2054
  readonly schema: SchemaResource;
1558
2055
  readonly prices: PricesResource;
2056
+ readonly sales: SalesResource;
1559
2057
  /** Access the v2 endpoints supported by the selected game. */
1560
2058
  forGame<G extends Game>(game: G): GameClient<G>;
1561
2059
  private readonly httpClient;
@@ -1642,6 +2140,6 @@ declare function chunk<T>(items: readonly T[], size: number): T[][];
1642
2140
  /** Runs `fn` over `items` with at most `limit` concurrent executions, keeping order. */
1643
2141
  declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
1644
2142
 
1645
- declare const VERSION = "0.5.0";
2143
+ declare const VERSION = "0.6.0";
1646
2144
 
1647
- export { APIError, ATTRIBUTE_MARKETS, type AggregatePriceData, type AggregationsBatchParams, type AggregationsParams, AggregationsResource, type AllItemsItem, type AllItemsLatestPrice, type AllItemsPriceAggregates, type AllItemsResponse, type ArbitrageFreshness, type ArbitrageOpportunitiesResponse, type ArbitrageOpportunity, type ArbitrageParams, type ArbitrageQuote, ArbitrageResource, type ArbitrageSort, type AttributeBucketDimensions, type AttributeGranularity, type AttributeHistoryBucket, type AttributeHistoryItem, type AttributeHistoryParams, type AttributeHistoryPoint, type AttributeHistoryResponse, type AttributeLatestParams, type AttributeLatestResponse, type AttributeMarket, type AttributePriceBucket, type AttributePriceItem, AttributePricesResource, type AttributeRangeDimension, type AttributeType, type AuthScheme, AuthenticationError, BaseResource, type BestPrice, type Buff163AttributeHistoryResponse, type Buff163AttributeLatestResponse, type Buff163HistoryParams, type Buff163LatestParams, Buff163Resource, type Cents, type ClientConfig, type ClientHooks, ConfigurationError, type CurrentPriceParams, type CurrentPriceResponse, DEFAULT_BASE_URL, DEFAULT_PUBLIC_BASE_URL, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, type ErrorResponseInput, type ExecutionAdjustedBestPrice, type ExecutionAdjustedNbbo, FeatureNotAvailableError, type FeeStatus, type FormatUsdOptions, type FreshnessResponse, type Game, GameClient, type HistoryListingType, type HistoryListingTypeInput, type HistoryPriceKind, HistoryResource, type IsoDateString, type ItemMaxOrders, type ItemMinPrices, type ItemPriceListResponse, type ItemSearchParams, ItemsResource, KNOWN_MARKETS, type KnownMarket, LIQUIDITY_BADGES, LIQUIDITY_CONFIDENCE, LIQUIDITY_LABELS, type LatestPriceAskPoint, type LatestPriceBidPoint, type LatestPriceItem, type LatestPricePoint, type LatestPricesParams, type LatestPricesResponse, type LiquidityBadge, type LiquidityBatchBody, type LiquidityBatchResponse, type LiquidityBulkItem, type LiquidityBulkManifest, type LiquidityBulkParams, type LiquidityBulkResponse, type LiquidityConfidence, type LiquidityCoverage, type LiquidityLabel, type LiquidityMarketForGame, type LiquidityMarketMetric, type LiquidityParams, type LiquidityPayout, LiquidityResource, type LiquidityResponse, type LiquiditySummaryResponse, type MarketAnalyticsParams, type MarketAnalyticsPoint, MarketAnalyticsResource, type MarketAnalyticsResponse, type MarketFreshness, type MarketHealthResponse, type MarketHealthRow, type MarketHealthStatus, type MarketLatency, type MarketLatencyResponse, type MarketMaxOrder, type MarketMinPrice, type MarketPricePoint, type MarketRegistryStatus, type MarketSeries, MarketsResource, type MaxOrdersResponse, type MinPricesResponse, type NbboBestPrice, type NbboDepthLevel, type NbboDepthParams, type NbboDepthQuote, type NbboDepthResponse, type NbboParams, NbboResource, type NbboResponse, NetworkError, NotFoundError, type PaginationMeta, ParseError, PermissionError, type PriceHistoryByMarketResponse, type PriceHistoryInterval, type PriceHistoryParams, type PriceHistoryPoint, type PriceHistoryResponse, PricesResource, type PricingListing, type PricingListingFloatCoverage, type PricingListingFloatSummary, type PricingListingObservedFloatSource, type PricingListingsParams, type PricingListingsResponse, PricingResource, type QuotePriceKind, RESPONSE_META, RateLimitError, type RateLimitErrorOptions, type RateLimitInfo, type RateLimitWindow, type RecommendationParams, type RecommendationResponse, RecommendationsResource, type RequestHookContext, type RequestOptions, type ResolvedConfig, type ResponseHookContext, type ResponseMeta, type RetryConfig, type RetryHookContext, SUPPORTED_LIQUIDITY_MARKETS, SUPPORTED_RUST_LIQUIDITY_MARKETS, type SalesHistoryWindow, type SchemaChangesParams, type SchemaChangesResponse, type SchemaCollection, type SchemaContainer, type SchemaItem, type SchemaItemResponse, type SchemaRarity, type SchemaRegistries, SchemaResource, type SchemaSnapshotParams, type SchemaSnapshotResponse, type SchemaVariant, type SellBasis, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, type SourceTimeKind, StatusResource, type SupportedLiquidityMarket, type SupportedRustLiquidityMarket, TimeoutError, VERSION, ValidationError, type ValidationErrorOptions, type ValueKind, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };
2145
+ export { APIError, ATTRIBUTE_MARKETS, type AggregatePriceData, type AggregationsBatchParams, type AggregationsParams, AggregationsResource, type AllItemsItem, type AllItemsLatestPrice, type AllItemsPriceAggregates, type AllItemsResponse, type ArbitrageFreshness, type ArbitrageOpportunitiesResponse, type ArbitrageOpportunity, type ArbitrageParams, type ArbitrageQuote, ArbitrageResource, type ArbitrageSort, type AttributeBucketDimensions, type AttributeGranularity, type AttributeHistoryBucket, type AttributeHistoryItem, type AttributeHistoryParams, type AttributeHistoryPoint, type AttributeHistoryResponse, type AttributeLatestParams, type AttributeLatestResponse, type AttributeMarket, type AttributePriceBucket, type AttributePriceItem, AttributePricesResource, type AttributeRangeDimension, type AttributeType, type AuthScheme, AuthenticationError, type AvailableBuyOrderEstimate, BaseResource, type BestPrice, type Buff163AttributeHistoryResponse, type Buff163AttributeLatestResponse, type Buff163HistoryParams, type Buff163LatestParams, Buff163Resource, type BuyOrderCalibration, type BuyOrderCohort, type BuyOrderEstimate, type BuyOrderEstimateKind, type BuyOrderEstimateMarket, type BuyOrderEstimateUnavailableReason, type BuyOrderEvidence, type BuyOrderFillProbability, type Cents, type ClientConfig, type ClientHooks, ConfigurationError, type Currency, type CurrentPriceParams, type CurrentPriceResponse, DEFAULT_BASE_URL, DEFAULT_PUBLIC_BASE_URL, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, type ErrorResponseInput, type ExecutionAdjustedBestPrice, type ExecutionAdjustedNbbo, FeatureNotAvailableError, type FeeStatus, type FormatUsdOptions, type FreshnessResponse, type Game, GameClient, type GameCurrentPriceParams, type GameNbboParams, type GamePriceHistoryParams, type HistoryCorrection, type HistoryFx, type HistoryListingType, type HistoryListingTypeInput, type HistoryPriceKind, HistoryResource, type IsoDateString, type ItemMaxOrders, type ItemMinPrices, type ItemPriceListResponse, type ItemSearchParams, ItemsResource, KNOWN_MARKETS, type KnownMarket, LIQUIDITY_BADGES, LIQUIDITY_CONFIDENCE, LIQUIDITY_LABELS, type LatestBestPrice, type LatestPriceAskPoint, type LatestPriceBidPoint, type LatestPriceItem, type LatestPricePoint, type LatestPricesChange, type LatestPricesChangesParams, type LatestPricesChangesResponse, type LatestPricesFeedFilter, type LatestPricesFeedResetReason, type LatestPricesFeedSide, type LatestPricesLink, LatestPricesMirror, type LatestPricesParams, type LatestPricesResponse, type LatestPricesStreamOptions, type LatestPricesSyncResult, type LiquidityBadge, type LiquidityBatchBody, type LiquidityBatchResponse, type LiquidityBulkItem, type LiquidityBulkManifest, type LiquidityBulkParams, type LiquidityBulkResponse, type LiquidityConfidence, type LiquidityCoverage, type LiquidityLabel, type LiquidityMarketForGame, type LiquidityMarketMetric, type LiquidityParams, type LiquidityPayout, LiquidityResource, type LiquidityResponse, type LiquiditySummaryResponse, type MarketAnalyticsParams, type MarketAnalyticsPoint, MarketAnalyticsResource, type MarketAnalyticsResponse, type MarketAskPricePoint, type MarketFreshness, type MarketHealthResponse, type MarketHealthRow, type MarketHealthStatus, type MarketLatency, type MarketLatencyResponse, type MarketMaxOrder, type MarketMinPrice, type MarketPricePoint, type MarketRegistryStatus, type MarketSeries, MarketsResource, type MaxOrdersResponse, type MinPricesResponse, type NbboBestPrice, type NbboDepthLevel, type NbboDepthParams, type NbboDepthQuote, type NbboDepthResponse, type NbboParams, NbboResource, type NbboResponse, NetworkError, NotFoundError, type PaginationMeta, ParseError, PermissionError, type PriceFx, type PriceHistoryBatchError, type PriceHistoryBatchParams, type PriceHistoryBatchResponse, type PriceHistoryByMarketResponse, type PriceHistoryInterval, type PriceHistoryParams, type PriceHistoryPoint, type PriceHistoryResponse, type PriceLevel, PricesResource, type PricesRollingFile, type PricesRollingParams, type PricesRollingRow, type PricingListing, type PricingListingFloatCoverage, type PricingListingFloatSummary, type PricingListingObservedFloatSource, type PricingListingsParams, type PricingListingsResponse, PricingResource, type QuotePriceKind, RESPONSE_META, RateLimitError, type RateLimitErrorOptions, type RateLimitInfo, type RateLimitWindow, type RecommendationParams, type RecommendationResponse, RecommendationsResource, type RequestHookContext, type RequestOptions, type ResolvedConfig, type ResponseHookContext, type ResponseMeta, type RetryConfig, type RetryHookContext, type RollingAskRow, type RollingAskWindow, type RollingCompleteness, type RollingPointsRow, type RollingSaleWindow, type RollingSalesRow, type RollingWindow, SUPPORTED_LIQUIDITY_MARKETS, SUPPORTED_RUST_LIQUIDITY_MARKETS, type SaleHistoryBasis, type SaleHistoryObservation, type SalesDailyFile, type SalesDailyParams, type SalesDailyRow, type SalesHistoryWindow, SalesResource, type SchemaChangesParams, type SchemaChangesResponse, type SchemaCollection, type SchemaContainer, type SchemaItem, type SchemaItemResponse, type SchemaRarity, type SchemaRegistries, SchemaResource, type SchemaSnapshotParams, type SchemaSnapshotResponse, type SchemaVariant, type SellBasis, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, type SourceTimeKind, StatusResource, type SteamWalletHistory, type SupportedLiquidityMarket, type SupportedRustLiquidityMarket, TimeoutError, type UnavailableBuyOrderEstimate, VERSION, ValidationError, type ValidationErrorOptions, type ValueKind, type WebSocketEventLike, type WebSocketFactory, type WebSocketLike, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };