@skinpricer/sdk 0.2.0 → 0.4.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.cts CHANGED
@@ -65,6 +65,14 @@ interface ClientConfig {
65
65
  apiKey: string;
66
66
  /** Base URL including the version prefix. */
67
67
  baseUrl?: string;
68
+ /**
69
+ * Base URL (incl. version prefix) for the keyless public-service endpoints
70
+ * that live off the pricing host — currently only `markets.health`. Defaults
71
+ * to deriving the `api.` host from {@link baseUrl} (e.g.
72
+ * `pricing.skinpricer.com` → `api.skinpricer.com`), falling back to
73
+ * `https://api.skinpricer.com/v1`.
74
+ */
75
+ publicBaseUrl?: string;
68
76
  /** Custom `fetch` implementation. Defaults to the global `fetch`. */
69
77
  fetch?: FetchLike;
70
78
  /** Per-request timeout in ms. Defaults to 30000; `0` disables it. */
@@ -84,6 +92,7 @@ interface ClientConfig {
84
92
  interface ResolvedConfig {
85
93
  apiKey: string;
86
94
  baseUrl: string;
95
+ publicBaseUrl: string;
87
96
  fetch: FetchLike;
88
97
  timeoutMs: number;
89
98
  retry: RetryConfig | null;
@@ -94,6 +103,7 @@ interface ResolvedConfig {
94
103
  hooks: ClientHooks;
95
104
  }
96
105
  declare const DEFAULT_BASE_URL = "https://pricing.skinpricer.com/v1";
106
+ declare const DEFAULT_PUBLIC_BASE_URL = "https://api.skinpricer.com/v1";
97
107
  declare const DEFAULT_TIMEOUT_MS = 30000;
98
108
  declare const DEFAULT_RETRY: RetryConfig;
99
109
  declare function resolveConfig(config: ClientConfig): ResolvedConfig;
@@ -121,10 +131,14 @@ type QueryValue = QueryScalar | QueryScalar[] | Date | null | undefined;
121
131
  type QueryParams = Record<string, QueryValue>;
122
132
 
123
133
  interface BuildRequestInput {
134
+ authenticated?: boolean;
135
+ ifNoneMatch?: string;
124
136
  method: HttpMethod;
125
137
  path: string;
126
138
  query?: QueryParams;
127
139
  body?: unknown;
140
+ /** Overrides `config.baseUrl` for this request (e.g. keyless public-service endpoints). */
141
+ baseUrl?: string;
128
142
  }
129
143
 
130
144
  interface RequestOptions {
@@ -136,33 +150,103 @@ declare class HttpClient {
136
150
  private readonly config;
137
151
  private throttleUntil;
138
152
  constructor(config: ResolvedConfig);
153
+ /** Base URL for keyless public-service endpoints (see {@link ResolvedConfig.publicBaseUrl}). */
154
+ get publicBaseUrl(): string;
155
+ /** Selects an API version while retaining a configured gateway prefix. */
156
+ versionedBaseUrl(version: "v2", baseUrl?: string): string;
139
157
  request<T>(input: BuildRequestInput, options?: RequestOptions): Promise<HttpResponse<T>>;
140
158
  private recordRateLimit;
141
159
  private awaitThrottle;
142
160
  }
143
161
 
144
- /** Market ids the API integrates. */
145
- declare const KNOWN_MARKETS: readonly ["skinport", "skindeck", "buff163", "csfloat", "marketcsgo", "cstrade", "dmarket", "itrade", "lis-skins", "swapgg", "whitemarket", "waxpeer", "lootfarm", "tradeit-store", "tradeit-trade", "steamcommunity"];
162
+ /** Market identifiers used in pricing responses. Availability differs by game. */
163
+ declare const KNOWN_MARKETS: readonly ["skinport", "skindeck", "buff163", "csfloat", "csdeals", "marketcsgo", "cstrade", "dmarket", "itrade", "lis-skins", "swapgg", "whitemarket", "waxpeer", "lootfarm", "rapidskins", "avanmarket", "tradeit-store", "tradeit-trade", "steamcommunity", "youpin", "mannco-store", "rusttm", "rustskins"];
146
164
  /** A known market id, or any other string. */
147
165
  type KnownMarket = (typeof KNOWN_MARKETS)[number] | (string & Record<never, never>);
148
166
  /** Markets that expose attribute (float/fade/tag) bucket pricing. */
149
167
  declare const ATTRIBUTE_MARKETS: readonly ["buff163", "steamcommunity", "marketcsgo", "csfloat", "dmarket"];
150
168
  type AttributeMarket = (typeof ATTRIBUTE_MARKETS)[number] | (string & Record<never, never>);
169
+ /**
170
+ * Per-market ingest status reported by `GET /v1/markets/health`. Distinct from
171
+ * the freshness endpoint's `MarketHealthStatus` (`healthy | degraded | stale`)
172
+ * in `./status` — the registry uses `live | warn | stale`.
173
+ */
174
+ type MarketRegistryStatus = "live" | "warn" | "stale";
175
+ /**
176
+ * One market's health row from `GET /v1/markets/health`. The `id` is the
177
+ * canonical join key used across pricing / nbbo / aggregation responses (see
178
+ * {@link KNOWN_MARKETS}). A market appears here once integrated, at any status.
179
+ */
180
+ interface MarketHealthRow {
181
+ id: string;
182
+ status: MarketRegistryStatus;
183
+ /** ISO timestamp of the latest ingest event from this marketplace. */
184
+ lastEventAt: string | null;
185
+ /** Null when the source does not establish an inventory count. */
186
+ listingsCount: number | null;
187
+ /** Percentage (0-100) of the market's quotes that are fresh. Null when it has none. */
188
+ freshnessCoveragePct: number | null;
189
+ listingsCountBasis?: "observed-listings" | "observed-units" | "observed-listings-subset" | "observed-empty" | null;
190
+ freshnessCoverageBasis?: {
191
+ kind: "observed-active-quote-identities";
192
+ activeWindowHours: number;
193
+ freshWindowMinutes: number;
194
+ activeQuotes: number;
195
+ freshQuotes: number;
196
+ collectionMode: "rolling-catalogue" | "snapshot-feed" | "unspecified";
197
+ };
198
+ /** CS2 coverage of the market's known item catalog. Absent without a reference. */
199
+ catalogCompleteness?: {
200
+ basis: "known-market-catalog";
201
+ referenceItems: number;
202
+ coveredItems: number;
203
+ percentage: number;
204
+ measuredAt: string;
205
+ };
206
+ /**
207
+ * 48 half-hour bars covering the trailing 24 hours, oldest first. Values are
208
+ * 0 (stale), 1 (degraded), 2 (fresh), or null (unknown). Not provider uptime.
209
+ */
210
+ healthBars: readonly (number | null)[];
211
+ }
212
+ /** `GET /v1/markets/health` — a plain array of per-market health rows. */
213
+ type MarketHealthResponse = MarketHealthRow[];
151
214
 
152
215
  /** An ISO-8601 timestamp string. */
153
216
  type IsoDateString = string;
154
217
  /** A monetary value in integer USD cents. */
155
218
  type Cents = number;
219
+ /** Evidence for a source time: the payload's own timestamp, a `Last-Modified` header, or CDN cache age. */
220
+ type SourceTimeKind = "payload" | "last_modified" | "cdn_age" | "none";
156
221
  interface MarketPricePoint {
157
222
  market: string;
158
223
  price: Cents;
159
224
  currency: string;
225
+ /** Source price in minor units of `originalCurrency`, before conversion and fees. */
226
+ originalPriceCents?: number | null;
227
+ originalCurrency?: string | null;
228
+ /** When the price was last read or confirmed still current. Not the age of the data. */
160
229
  fetchedAt: IsoDateString;
161
230
  ingestedAt?: IsoDateString;
162
- quoteSize?: number;
163
- totalQuantity?: number;
231
+ /** Count the source reports for this quote. Null when unknown, which is not zero. */
232
+ quoteSize?: number | null;
233
+ /** Quantity across bid price levels. Null when unknown. */
234
+ totalQuantity?: number | null;
235
+ /** Order count across bid price levels, where the source reports one. */
236
+ totalOrdersCount?: number | null;
237
+ /** False when the source's book was read only in part, so quantities are lower bounds. */
238
+ orderBookComplete?: boolean | null;
164
239
  ingestLatencyMs?: number;
165
240
  isStale?: boolean;
241
+ /** When the source produced this data. Absent or null when unknown. */
242
+ sourceUpdatedAt?: IsoDateString | null;
243
+ sourceTimeKind?: SourceTimeKind;
244
+ /** Age of the source's data when it was read, in seconds. */
245
+ sourceAgeSeconds?: number | null;
246
+ /** Whether the source's data is older than 30 minutes. Absent when its age is unknown. */
247
+ isSourceStale?: boolean;
248
+ /** True for a placeholder ask left out of the aggregate's average, median and deviation. It is still a real listing. */
249
+ outlier?: boolean;
166
250
  }
167
251
  interface AggregatePriceData {
168
252
  minPrice: Cents | null;
@@ -170,6 +254,8 @@ interface AggregatePriceData {
170
254
  avgPrice: Cents | null;
171
255
  medianPrice: Cents | null;
172
256
  stdDev: number | null;
257
+ /** `corroborated_low_cluster` when placeholder asks were left out of the average, median and deviation. */
258
+ basis?: "all_venues" | "corroborated_low_cluster";
173
259
  marketCount?: number;
174
260
  freshMarketCount?: number;
175
261
  listingCount?: number;
@@ -198,141 +284,723 @@ interface PaginationMeta {
198
284
  nextPage: number | null;
199
285
  }
200
286
 
201
- interface AggregationsParams {
202
- /** Canonical item ids (1–100). */
203
- ids: string[];
287
+ type HistoryListingType = "SELL_OFFER" | "BUY_ORDER" | "SALE_HISTORY";
288
+ /** Accepted on input; the backend also normalizes `SELL`/`BUY`/`SALES`. */
289
+ type HistoryListingTypeInput = HistoryListingType | "SELL" | "BUY" | "SALES";
290
+ type SalesHistoryWindow = "24h" | "7d" | "30d" | "90d";
291
+ type PriceHistoryInterval = "MINUTE_5" | "MINUTE_15" | "HOUR_1" | "HOUR_6" | "DAY_1";
292
+ interface PriceHistoryParams {
293
+ /** Start of the range (Date or ISO string). */
294
+ from?: Date | string;
295
+ /** End of the range (Date or ISO string). */
296
+ to?: Date | string;
297
+ /** Markets to include; when set, `byMarket` returns per-market series. */
204
298
  markets?: KnownMarket[];
299
+ listingType?: HistoryListingTypeInput;
300
+ salesWindow?: SalesHistoryWindow;
301
+ interval?: PriceHistoryInterval;
205
302
  }
206
- /** Per-market minimum sell price (snake_case). */
207
- interface MarketMinPrice {
208
- market_name: string;
209
- offers: number;
210
- price: Cents;
211
- updated_at: IsoDateString;
212
- is_stale?: boolean;
213
- ingested_at?: IsoDateString;
214
- ingest_latency_ms?: number;
215
- }
216
- interface ItemMinPrices {
217
- canonical_item_id: string;
218
- market_hash_name: string;
219
- prices: MarketMinPrice[];
220
- }
221
- /** `GET /v1/aggregations/min-prices` (snake_case). */
222
- interface MinPricesResponse {
223
- items: ItemMinPrices[];
303
+ interface PriceHistoryPoint {
304
+ timestamp: IsoDateString;
305
+ avgPrice: Cents | null;
306
+ medianPrice: Cents | null;
307
+ minPrice: Cents | null;
308
+ maxPrice: Cents | null;
309
+ listingCount: number | null;
310
+ totalQuantity: number | null;
311
+ volume: number | null;
312
+ bestBidCents: Cents | null;
313
+ bestAskCents: Cents | null;
314
+ spreadBps: number | null;
224
315
  }
225
- /** Per-market maximum buy order (snake_case). */
226
- interface MarketMaxOrder {
227
- market_name: string;
228
- offers: number;
229
- price: Cents;
230
- updated_at: IsoDateString;
231
- is_stale: boolean;
232
- total_quantity?: number;
233
- ingested_at?: IsoDateString;
234
- ingest_latency_ms?: number;
316
+ /** `GET /v1/pricing/:marketHashName/history` (camelCase). */
317
+ interface PriceHistoryResponse {
318
+ canonicalItemId: string;
319
+ name: string;
320
+ history: PriceHistoryPoint[];
321
+ listingType: HistoryListingType;
322
+ salesWindow: SalesHistoryWindow | null;
323
+ /** Actual returned bucket width, which may differ from the requested interval. */
324
+ effectiveInterval: "10m" | "1h" | "1d";
235
325
  }
236
- interface ItemMaxOrders {
237
- canonical_item_id: string;
238
- market_hash_name: string;
239
- orders: MarketMaxOrder[];
326
+ interface MarketSeries {
327
+ market: string;
328
+ history: PriceHistoryPoint[];
240
329
  }
241
- /** `GET /v1/aggregations/max-orders` (snake_case). */
242
- interface MaxOrdersResponse {
243
- items: ItemMaxOrders[];
330
+ /** `GET /v1/pricing/:marketHashName/history/markets` (camelCase). */
331
+ interface PriceHistoryByMarketResponse {
332
+ canonicalItemId: string;
333
+ name: string;
334
+ series: MarketSeries[];
335
+ listingType: HistoryListingType;
336
+ salesWindow: SalesHistoryWindow | null;
337
+ /** Actual returned bucket width, which may differ from the requested interval. */
338
+ effectiveInterval: "10m" | "1h" | "1d";
244
339
  }
245
340
 
341
+ /** Games supported by the v2 pricing API. */
342
+ type Game = "cs2" | "rust";
343
+
246
344
  /** Shared base for resource namespaces. Holds the {@link HttpClient}. */
247
345
  declare abstract class BaseResource {
248
346
  protected readonly http: HttpClient;
249
- constructor(http: HttpClient);
347
+ private readonly game?;
348
+ constructor(http: HttpClient, game?: Game | undefined);
250
349
  /** Performs a request and returns the data with {@link ResponseMeta} attached. */
251
350
  protected call<T>(input: BuildRequestInput, options?: RequestOptions): Promise<T>;
252
351
  }
253
352
 
254
- interface AggregationsBatchParams {
353
+ /** Historical price series for an item. */
354
+ declare class HistoryResource extends BaseResource {
355
+ /** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
356
+ get(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryResponse>;
357
+ /** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
358
+ byMarket(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryByMarketResponse>;
359
+ }
360
+
361
+ interface CurrentPriceParams {
362
+ /** Restrict the response to these market ids. */
255
363
  markets?: KnownMarket[];
256
- concurrency?: number;
257
364
  }
258
- declare class AggregationsResource extends BaseResource {
259
- /** GET /v1/aggregations/min-prices — minimum sell price per market (max 100 ids). */
260
- minPrices(params: AggregationsParams, options?: RequestOptions): Promise<MinPricesResponse>;
261
- /** GET /v1/aggregations/max-orders — maximum buy order per market (max 100 ids). */
262
- maxOrders(params: AggregationsParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
263
- /** Like `minPrices` but splits more than 100 ids into batches and merges them. */
264
- minPricesAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MinPricesResponse>;
265
- /** Like `maxOrders` but splits more than 100 ids into batches and merges them. */
266
- maxOrdersAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
267
- private runBatched;
365
+ /** `GET /v1/pricing/:marketHashName` (camelCase). */
366
+ interface CurrentPriceResponse {
367
+ canonicalItemId: string;
368
+ name: string;
369
+ aggregate?: AggregatePriceData;
370
+ markets: MarketPricePoint[];
371
+ buyOrders?: MarketPricePoint[];
372
+ bestAsk?: NbboBestPrice | null;
373
+ bestBid?: NbboBestPrice | null;
374
+ spreadBps?: number | null;
375
+ marketCount?: number;
376
+ freshMarketCount?: number;
377
+ calculatedAt: IsoDateString;
268
378
  }
269
-
270
- type ArbitrageSort = "estimatedNetCents" | "spreadBps";
271
- interface ArbitrageParams {
272
- /** Max opportunities to return (1–100, default 50). */
379
+ interface PricingListingsParams {
380
+ /** Max listing samples to return (1–2000, default 500). */
273
381
  limit?: number;
274
- /** Minimum cross-market spread in basis points (default 200). */
275
- minSpreadBps?: number;
276
- /** Minimum estimated buy-side notional in integer USD cents (default 1000). */
277
- minNotionalCents?: number;
278
- /** @deprecated Alias for {@link ArbitrageParams.minNotionalCents}. */
279
- minNotional?: number;
280
- sort?: ArbitrageSort;
281
382
  markets?: KnownMarket[];
282
- /** Internal shortlist size (50–2000, default 500). */
283
- candidateLimit?: number;
284
383
  }
285
- interface ArbitrageQuote {
384
+ interface PricingListing {
385
+ listingId: string | null;
286
386
  market: string;
287
387
  price: Cents;
288
- quoteSize: number;
388
+ currency: "USD";
389
+ floatValue: number | null;
390
+ paintSeed: number | null;
391
+ paintIndex: number | null;
392
+ inspectLink: string | null;
393
+ stickers: unknown[];
394
+ isStatTrak: boolean;
395
+ fetchedAt: IsoDateString;
396
+ }
397
+ interface PricingListingFloatCoverage {
398
+ coverage: "none" | "partial" | "complete";
399
+ sampledListings: number;
400
+ listingsWithFloat: number;
401
+ marketsWithFloat: string[];
402
+ marketsWithoutFloat: string[];
403
+ }
404
+ interface PricingListingObservedFloatSource {
405
+ market: string;
406
+ price: Cents;
407
+ fetchedAt: IsoDateString;
408
+ }
409
+ interface PricingListingFloatSummary {
410
+ observed: number;
411
+ itemMin: number | null;
412
+ itemMax: number | null;
413
+ observedSource: PricingListingObservedFloatSource;
414
+ }
415
+ /** `GET /v1/pricing/:marketHashName/listings` (camelCase). */
416
+ interface PricingListingsResponse {
417
+ marketHashName: string;
418
+ canonicalItemId: string;
419
+ totalListings: number;
420
+ sampledListings: number;
421
+ floatCoverage: PricingListingFloatCoverage;
422
+ floatSummary: PricingListingFloatSummary | null;
423
+ listings: PricingListing[];
424
+ calculatedAt: IsoDateString;
425
+ }
426
+
427
+ interface ItemSearchParams {
428
+ /** Case-insensitive contains match on item name. */
429
+ search?: string;
430
+ markets?: KnownMarket[];
431
+ /** 1-based page number (default 1). */
432
+ page?: number;
433
+ /** Items per page (1–100, default 10). */
434
+ perPage?: number;
435
+ }
436
+ /** `GET /v1/items` — paginated (camelCase). */
437
+ interface ItemPriceListResponse {
438
+ data: CurrentPriceResponse[];
439
+ pagination: PaginationMeta;
440
+ }
441
+ interface AllItemsLatestPrice {
442
+ market: string;
443
+ effectiveUsdCents: Cents;
444
+ fetchedAt: IsoDateString;
445
+ originalCurrency: string;
446
+ }
447
+ interface AllItemsPriceAggregates {
448
+ minPrice: Cents | null;
449
+ maxPrice: Cents | null;
450
+ avgPrice: Cents | null;
451
+ medianPrice: Cents | null;
452
+ stdDev: number | null;
289
453
  updatedAt: IsoDateString;
290
- isStale: boolean;
291
454
  }
292
- interface ArbitrageFreshness {
293
- buyAgeMs: number;
294
- sellAgeMs: number;
455
+ interface AllItemsItem {
456
+ id: string;
457
+ name: string;
458
+ latestPrices: AllItemsLatestPrice[];
459
+ priceAggregates: AllItemsPriceAggregates | null;
295
460
  }
296
- interface ArbitrageOpportunity {
461
+ /** `GET /v1/items/all` — a plain array (camelCase). */
462
+ type AllItemsResponse = AllItemsItem[];
463
+
464
+ /** Item discovery / search. */
465
+ declare class ItemSearchResource extends BaseResource {
466
+ /** GET /v1/items — paginated item search with current pricing. */
467
+ search(params?: ItemSearchParams, options?: RequestOptions): Promise<ItemPriceListResponse>;
468
+ /** Async iterator over every matching item, walking pages. */
469
+ searchEach(params?: ItemSearchParams, options?: RequestOptions): AsyncGenerator<CurrentPriceResponse>;
470
+ }
471
+ /** CS2 item discovery and full-catalog export. */
472
+ declare class ItemsResource extends ItemSearchResource {
473
+ /** GET /v1/items/all — every tracked item with latest prices (capped, unpaginated). */
474
+ all(options?: RequestOptions): Promise<AllItemsResponse>;
475
+ }
476
+
477
+ declare const LIQUIDITY_BADGES: readonly ["EXTREMELY_LIQUID", "VERY_LIQUID", "LIQUID", "ILLIQUID", "VERY_ILLIQUID", "EXTREMELY_ILLIQUID", "UNTRADED", "INSUFFICIENT_DATA"];
478
+ type LiquidityBadge = (typeof LIQUIDITY_BADGES)[number];
479
+ declare const LIQUIDITY_CONFIDENCE: readonly ["HIGH", "MEDIUM", "LOW", "CRITICAL"];
480
+ type LiquidityConfidence = (typeof LIQUIDITY_CONFIDENCE)[number];
481
+ type LiquidityCoverage = "full" | "partial" | "none";
482
+ /** Lowercase label form of the badge; `UNTRADED` maps to `"unknown"`, no `"moderate"` tier. */
483
+ declare const LIQUIDITY_LABELS: readonly ["extremely_liquid", "very_liquid", "liquid", "illiquid", "very_illiquid", "extremely_illiquid", "unknown"];
484
+ type LiquidityLabel = (typeof LIQUIDITY_LABELS)[number];
485
+ declare const SUPPORTED_LIQUIDITY_MARKETS: readonly ["skinport", "marketcsgo", "dmarket", "steamcommunity", "csfloat"];
486
+ type SupportedLiquidityMarket = (typeof SUPPORTED_LIQUIDITY_MARKETS)[number];
487
+ declare const SUPPORTED_RUST_LIQUIDITY_MARKETS: readonly ["rusttm", "skinport"];
488
+ type SupportedRustLiquidityMarket = (typeof SUPPORTED_RUST_LIQUIDITY_MARKETS)[number];
489
+ type LiquidityMarketForGame<G extends Game> = G extends "rust" ? SupportedRustLiquidityMarket : SupportedLiquidityMarket;
490
+ interface LiquidityParams<Market extends string = SupportedLiquidityMarket> {
491
+ /** Hypothetical ask (USD cents) to estimate against; defaults to the best ask. */
492
+ askPrice?: Cents;
493
+ market?: Market;
494
+ }
495
+ /** Per-market row; every metric is null when that market has no data. */
496
+ interface LiquidityMarketMetric {
497
+ market: string;
498
+ salesPerDay: number | null;
499
+ activeListings: number | null;
500
+ bestAskUsdCents: Cents | null;
501
+ medianTimeToSellHours: number | null;
502
+ p90TimeToSellHours: number | null;
503
+ salesDataAgeMinutes: number | null;
504
+ listingsDataAgeMinutes: number | null;
505
+ }
506
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
507
+ interface LiquidityResponse {
297
508
  canonicalItemId: string;
298
509
  marketHashName: string;
299
- slug: string;
300
- imageUrl: string | null;
301
- buy: ArbitrageQuote;
302
- sell: ArbitrageQuote;
303
- spreadBps: number;
304
- spreadCents: Cents;
305
- estimatedNetCents: Cents;
306
- maxTradableQuantity: number;
307
- estimatedNotionalCents: Cents;
308
- feeNotes: string;
309
- freshness: ArbitrageFreshness;
510
+ liquidityBadge: LiquidityBadge;
511
+ confidence: LiquidityConfidence;
512
+ coverage: LiquidityCoverage;
513
+ medianTimeToSellHours: number | null;
514
+ p90TimeToSellHours: number | null;
515
+ bestMarketToList: string | null;
516
+ salesPerDay: number | null;
517
+ activeListings: number | null;
518
+ referenceAskUsdCents: Cents | null;
519
+ marketWideSalesPerDay: number | null;
520
+ marketWideListings: number | null;
521
+ marketsWithSales: number;
522
+ marketsWithDepth: number;
523
+ /** Whole-market saturation (hours), NOT a per-listing estimate. */
524
+ marketWideMedianTimeToSellHours: number | null;
525
+ marketWideP90TimeToSellHours: number | null;
526
+ metrics: LiquidityMarketMetric[];
527
+ /** Data-quality flags, e.g. `sales_data_stale:marketcsgo`. */
528
+ notes: string[];
310
529
  calculatedAt: IsoDateString;
311
530
  }
312
- /** `GET /v1/arbitrage/opportunities` (camelCase). */
313
- interface ArbitrageOpportunitiesResponse {
314
- opportunities: ArbitrageOpportunity[];
315
- totalCandidates: number;
531
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
532
+ interface LiquiditySummaryResponse {
533
+ marketHashName: string;
534
+ liquidityBadge: LiquidityBadge;
535
+ liquidity: LiquidityLabel;
536
+ /** Human time-to-sell, e.g. `"2 - 6 hours"` (`"Insufficient data"` when no estimate is available). */
537
+ estimatedSaleTime: string;
538
+ confidence: LiquidityConfidence;
539
+ /** 0-100, higher sells faster; null when untraded. */
540
+ score: number | null;
541
+ bestMarketToList: string | null;
542
+ calculatedAt: IsoDateString;
543
+ }
544
+ /** Request body for `POST /v1/liquidity/batch` (1-100 names). */
545
+ interface LiquidityBatchBody<Market extends string = SupportedLiquidityMarket> {
546
+ marketHashNames: string[];
547
+ market?: Market;
548
+ }
549
+ /** `POST /v1/liquidity/batch` — up to 100 full results in one call. */
550
+ interface LiquidityBatchResponse {
551
+ results: LiquidityResponse[];
552
+ notFound: string[];
553
+ requested: number;
554
+ calculatedAt: IsoDateString;
555
+ }
556
+ /** Bulk-map entry. `market_hash_name` and `estimated_sale_time` are snake_case on the wire. */
557
+ interface LiquidityBulkItem {
558
+ market_hash_name: string;
559
+ liquidity: LiquidityLabel;
560
+ estimated_sale_time: string;
561
+ liquidityBadge: LiquidityBadge;
562
+ confidence: LiquidityConfidence;
563
+ score: number | null;
564
+ bestMarketToList: string | null;
565
+ /** Reserved; always `{}` for now. */
566
+ variants: Record<string, never>;
567
+ }
568
+ interface LiquidityBulkParams {
569
+ /** ETag from the preceding response. HTTP 304 returns null. */
570
+ ifNoneMatch?: string;
571
+ }
572
+ /** `GET /v1/liquidity/items/manifest` — cheap change-probe; compare `version` before refetching. */
573
+ interface LiquidityBulkManifest {
574
+ /** Snapshot version / ETag. */
575
+ version: string;
316
576
  calculatedAt: IsoDateString;
577
+ /** Recompute cadence as an ISO-8601 duration, e.g. `"PT10M"`. */
578
+ cadence: string;
579
+ markets: string[];
580
+ itemCount: number;
581
+ }
582
+ /** `GET /v1/liquidity/items` — Enterprise: whole-catalog map keyed by market_hash_name. */
583
+ interface LiquidityBulkResponse extends LiquidityBulkManifest {
584
+ items: Record<string, LiquidityBulkItem>;
317
585
  }
318
586
 
319
- /** Cross-market arbitrage opportunities. */
320
- declare class ArbitrageResource extends BaseResource {
321
- /** `GET /v1/arbitrage/opportunities` — ranked cross-market opportunities. */
322
- opportunities(params?: ArbitrageParams, options?: RequestOptions): Promise<ArbitrageOpportunitiesResponse>;
587
+ /**
588
+ * Liquidity & expected time-to-sell, from cross-market order-book depth and
589
+ * sales velocity. The single + summary + batch endpoints are Pro; the bulk map
590
+ * + manifest are Enterprise.
591
+ */
592
+ declare class ItemLiquidityResource<Market extends string = SupportedLiquidityMarket> extends BaseResource {
593
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
594
+ get(marketHashName: string, params?: LiquidityParams<Market>, options?: RequestOptions): Promise<LiquidityResponse>;
595
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
596
+ summary(marketHashName: string, params?: LiquidityParams<Market>, options?: RequestOptions): Promise<LiquiditySummaryResponse>;
597
+ /** `POST /v1/liquidity/batch` — score up to 100 items in one call. */
598
+ batch(body: LiquidityBatchBody<Market>, options?: RequestOptions): Promise<LiquidityBatchResponse>;
599
+ }
600
+ /** CS2 liquidity, including Enterprise bulk exports. */
601
+ declare class LiquidityResource extends ItemLiquidityResource {
602
+ /** `GET /v1/liquidity/:marketHashName`. `"items"` is reserved for {@link bulk}. */
603
+ get(marketHashName: string, params?: LiquidityParams<SupportedLiquidityMarket>, options?: RequestOptions): Promise<LiquidityResponse>;
604
+ /**
605
+ * `GET /v1/liquidity/items`. Enterprise: the whole-catalog liquidity map,
606
+ * rematerialized every ~10 minutes. Poll {@link manifest} and compare
607
+ * `version` before refetching this heavier payload.
608
+ */
609
+ bulk(params?: undefined, options?: RequestOptions): Promise<LiquidityBulkResponse>;
610
+ /** A matching conditional ETag returns null. */
611
+ bulk(params: LiquidityBulkParams, options?: RequestOptions): Promise<LiquidityBulkResponse | null>;
612
+ /**
613
+ * `GET /v1/liquidity/items/manifest`. Enterprise: a cheap change-probe for
614
+ * the {@link bulk} map (`version`, `calculatedAt`, `cadence`, `markets`,
615
+ * `itemCount`). Refetch the bulk map only when `version` changes.
616
+ */
617
+ manifest(params?: undefined, options?: RequestOptions): Promise<LiquidityBulkManifest>;
618
+ /** A matching conditional ETag returns null. */
619
+ manifest(params: LiquidityBulkParams, options?: RequestOptions): Promise<LiquidityBulkManifest | null>;
323
620
  }
324
621
 
325
- type AttributeType = "float" | "fade" | "tag";
326
- type AttributeGranularity = "10m" | "1h" | "1d";
327
- interface AttributeRangeDimension {
328
- min: number;
329
- max: number;
330
- minInclusive: boolean;
331
- maxInclusive: boolean;
622
+ /** Market registry health & integration status. */
623
+ declare class MarketsResource extends BaseResource {
624
+ /**
625
+ * `GET /v1/markets/health` — per-market ingest status, last event time, and
626
+ * listing counts for every integrated market. Returns a plain array of
627
+ * {@link import("../types/markets").MarketHealthRow}.
628
+ */
629
+ health(options?: RequestOptions): Promise<MarketHealthResponse>;
332
630
  }
333
- interface AttributeBucketDimensions {
334
- variant: string | null;
335
- float: AttributeRangeDimension | null;
631
+
632
+ interface NbboParams {
633
+ /** Canonical item id. Provide this or `marketHashName`. */
634
+ id?: string;
635
+ /** Market hash name. Sent as the `market_hash_name` query param. */
636
+ marketHashName?: string;
637
+ markets?: KnownMarket[];
638
+ }
639
+ /** 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. */
640
+ interface ExecutionAdjustedBestPrice {
641
+ market: string;
642
+ price: Cents;
643
+ rawPrice: Cents;
644
+ appliedFeeBps: number;
645
+ withdrawalFlatUsdCents?: Cents;
646
+ executability: number;
647
+ updatedAt: IsoDateString;
648
+ isStale: boolean;
649
+ reasons: string[];
650
+ }
651
+ /** Execution-adjusted NBBO block: fee-aware best bid/ask re-ranked by executability. */
652
+ interface ExecutionAdjustedNbbo {
653
+ bestAsk: ExecutionAdjustedBestPrice | null;
654
+ bestBid: ExecutionAdjustedBestPrice | null;
655
+ spreadBps: number | null;
656
+ locked: boolean;
657
+ crossed: boolean;
658
+ executableConfidence: number;
659
+ reasons: string[];
660
+ feeModelVersion: string;
661
+ calculatedAt: IsoDateString;
662
+ }
663
+ /** `GET /v1/nbbo` (camelCase). */
664
+ interface NbboResponse {
665
+ marketHashName: string;
666
+ canonicalItemId: string;
667
+ bestAsk: NbboBestPrice | null;
668
+ bestBid: NbboBestPrice | null;
669
+ spreadBps: number | null;
670
+ marketCount: number;
671
+ freshMarketCount: number;
672
+ locked: boolean;
673
+ crossed: boolean;
674
+ confidence: number;
675
+ calculatedAt: IsoDateString;
676
+ /** Execution-adjusted "real best market"; null when no quotes. */
677
+ executionAdjusted: ExecutionAdjustedNbbo | null;
678
+ }
679
+ interface NbboDepthParams extends NbboParams {
680
+ /** Aggregated depth levels per side (1–50, default 10). */
681
+ depth?: number;
682
+ }
683
+ interface NbboDepthQuote {
684
+ market: string;
685
+ level: number;
686
+ price: Cents;
687
+ quantity: number;
688
+ ordersCount: number;
689
+ updatedAt: IsoDateString;
690
+ isStale: boolean;
691
+ }
692
+ interface NbboDepthLevel {
693
+ rank: number;
694
+ price: Cents;
695
+ quantity: number;
696
+ ordersCount: number;
697
+ marketCount: number;
698
+ cumulativeQuantity: number;
699
+ updatedAt: IsoDateString;
700
+ isStale: boolean;
701
+ quotes: NbboDepthQuote[];
702
+ }
703
+ /** `GET /v1/nbbo/depth` (camelCase). */
704
+ interface NbboDepthResponse {
705
+ marketHashName: string;
706
+ canonicalItemId: string;
707
+ depth: number;
708
+ marketCount: number;
709
+ asks: NbboDepthLevel[];
710
+ bids: NbboDepthLevel[];
711
+ spreadBps: number | null;
712
+ locked: boolean;
713
+ crossed: boolean;
714
+ calculatedAt: IsoDateString;
715
+ }
716
+
717
+ /** National Best Bid and Offer (top of book) and aggregated depth. */
718
+ declare class NbboResource extends BaseResource {
719
+ /** `GET /v1/nbbo` — best bid/ask across markets. Pass `id` or `marketHashName`. */
720
+ get(params: NbboParams, options?: RequestOptions): Promise<NbboResponse>;
721
+ /** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
722
+ depth(params: NbboDepthParams, options?: RequestOptions): Promise<NbboDepthResponse>;
723
+ }
724
+
725
+ /** Current cross-market pricing for a single item. */
726
+ declare class PricingResource extends BaseResource {
727
+ /** `GET /v1/pricing/:marketHashName` — full cross-market pricing snapshot. */
728
+ get(marketHashName: string, params?: CurrentPriceParams, options?: RequestOptions): Promise<CurrentPriceResponse>;
729
+ /** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
730
+ listings(marketHashName: string, params?: PricingListingsParams, options?: RequestOptions): Promise<PricingListingsResponse>;
731
+ }
732
+
733
+ interface SchemaRarity {
734
+ key: string;
735
+ name: string;
736
+ tier: number;
737
+ color?: string;
738
+ }
739
+ interface SchemaCollection {
740
+ name: string;
741
+ image?: string;
742
+ }
743
+ interface SchemaContainer {
744
+ name: string;
745
+ type: string;
746
+ releaseDate?: IsoDateString;
747
+ image?: string;
748
+ }
749
+ interface SchemaRegistries {
750
+ rarities: SchemaRarity[];
751
+ collections: Record<string, SchemaCollection>;
752
+ containers: Record<string, SchemaContainer>;
753
+ }
754
+ interface SchemaVariant {
755
+ marketHashName: string;
756
+ family: string;
757
+ name: string;
758
+ phase?: number;
759
+ image?: string;
760
+ }
761
+ /** Schema fields that do not apply to the item or game are omitted. */
762
+ interface SchemaItem {
763
+ id: string;
764
+ marketHashName: string;
765
+ slug: string;
766
+ category: string;
767
+ baseName?: string;
768
+ weapon?: string;
769
+ finish?: string;
770
+ paintIndex?: string;
771
+ rarity?: string;
772
+ wear?: string;
773
+ wears?: string[];
774
+ stattrak?: boolean;
775
+ souvenir?: boolean;
776
+ hasStattrak?: boolean;
777
+ hasSouvenir?: boolean;
778
+ stattrakOf?: string;
779
+ souvenirOf?: string;
780
+ floatRange?: {
781
+ min: number;
782
+ max: number;
783
+ };
784
+ variants?: SchemaVariant[];
785
+ variant?: {
786
+ base: string;
787
+ family: string;
788
+ name: string;
789
+ };
790
+ collections?: string[];
791
+ containers?: string[];
792
+ image?: string;
793
+ releaseDate?: IsoDateString;
794
+ ids: Record<string, string>;
795
+ aliases?: Record<string, string>;
796
+ }
797
+ interface SchemaSnapshotResponse extends SchemaRegistries {
798
+ schemaVersion: number;
799
+ generatedAt: IsoDateString;
800
+ itemCount: number;
801
+ items: Record<string, SchemaItem>;
802
+ }
803
+ interface SchemaItemResponse {
804
+ schemaVersion: number;
805
+ item: SchemaItem;
806
+ registries?: SchemaRegistries;
807
+ }
808
+ interface SchemaSnapshotParams {
809
+ /** ETag from the preceding snapshot. HTTP 304 returns null. */
810
+ ifNoneMatch?: string;
811
+ }
812
+ interface SchemaChangesParams {
813
+ /** Schema version or ISO timestamp. Keep this value unchanged while paging. */
814
+ since: number | string | Date;
815
+ /** Opaque cursor returned by this game's previous delta page. */
816
+ cursor?: string;
817
+ /** Items per page, from 1 to 5000. */
818
+ limit?: number;
819
+ }
820
+ interface SchemaChangesResponse {
821
+ schemaVersion: number;
822
+ since: number;
823
+ count: number;
824
+ hasMore: boolean;
825
+ nextCursor: string | null;
826
+ items: SchemaItem[];
827
+ registries?: SchemaRegistries;
828
+ }
829
+
830
+ /** Item catalog snapshots, single-item lookup, and incremental changes. */
831
+ declare class SchemaResource extends BaseResource {
832
+ snapshot(params?: undefined, options?: RequestOptions): Promise<SchemaSnapshotResponse>;
833
+ snapshot(params: SchemaSnapshotParams, options?: RequestOptions): Promise<SchemaSnapshotResponse | null>;
834
+ /** Look up one item by canonical id or exact name; v2 also accepts its game-scoped slug. */
835
+ get(idOrName: string, options?: RequestOptions): Promise<SchemaItemResponse>;
836
+ /** One page of items changed after a catalog version or timestamp. */
837
+ changes(params: SchemaChangesParams, options?: RequestOptions): Promise<SchemaChangesResponse>;
838
+ /** Iterate changes without moving the original version boundary while paging. */
839
+ changesEach(params: SchemaChangesParams, options?: RequestOptions): AsyncGenerator<SchemaItem>;
840
+ }
841
+
842
+ /** Game-scoped v2 resources. Construct with `client.forGame(game)`. */
843
+ declare class GameClient<G extends Game> {
844
+ readonly game: G;
845
+ readonly pricing: PricingResource;
846
+ readonly history: HistoryResource;
847
+ readonly items: ItemSearchResource;
848
+ readonly nbbo: NbboResource;
849
+ readonly liquidity: ItemLiquidityResource<LiquidityMarketForGame<G>>;
850
+ readonly schema: SchemaResource;
851
+ readonly markets: MarketsResource;
852
+ constructor(http: HttpClient, game: G);
853
+ }
854
+
855
+ interface AggregationsParams {
856
+ /** Canonical item ids (1–100). Provide this or {@link AggregationsParams.marketHashNames}. */
857
+ ids?: string[];
858
+ /** Market hash names (1–100). Provide this or {@link AggregationsParams.ids}. */
859
+ marketHashNames?: string[];
860
+ markets?: KnownMarket[];
861
+ }
862
+ /** Per-market minimum sell price (snake_case). */
863
+ interface MarketMinPrice {
864
+ market_name: string;
865
+ offers: number;
866
+ price: Cents;
867
+ updated_at: IsoDateString;
868
+ is_stale?: boolean;
869
+ ingested_at?: IsoDateString;
870
+ ingest_latency_ms?: number;
871
+ }
872
+ interface ItemMinPrices {
873
+ canonical_item_id: string;
874
+ market_hash_name: string;
875
+ prices: MarketMinPrice[];
876
+ }
877
+ /** `GET /v1/aggregations/min-prices` (snake_case). */
878
+ interface MinPricesResponse {
879
+ items: ItemMinPrices[];
880
+ }
881
+ /** Per-market maximum buy order (snake_case). */
882
+ interface MarketMaxOrder {
883
+ market_name: string;
884
+ offers: number;
885
+ price: Cents;
886
+ updated_at: IsoDateString;
887
+ is_stale: boolean;
888
+ total_quantity?: number;
889
+ ingested_at?: IsoDateString;
890
+ ingest_latency_ms?: number;
891
+ }
892
+ interface ItemMaxOrders {
893
+ canonical_item_id: string;
894
+ market_hash_name: string;
895
+ orders: MarketMaxOrder[];
896
+ }
897
+ /** `GET /v1/aggregations/max-orders` (snake_case). */
898
+ interface MaxOrdersResponse {
899
+ items: ItemMaxOrders[];
900
+ }
901
+
902
+ interface AggregationsBatchParams {
903
+ markets?: KnownMarket[];
904
+ concurrency?: number;
905
+ }
906
+ declare class AggregationsResource extends BaseResource {
907
+ /** GET /v1/aggregations/min-prices — minimum sell price per market. Pass up to 100 `ids` or `marketHashNames`. */
908
+ minPrices(params: AggregationsParams, options?: RequestOptions): Promise<MinPricesResponse>;
909
+ /** GET /v1/aggregations/max-orders — maximum buy order per market. Pass up to 100 `ids` or `marketHashNames`. */
910
+ maxOrders(params: AggregationsParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
911
+ /** Like `minPrices` but splits more than 100 ids into batches and merges them. */
912
+ minPricesAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MinPricesResponse>;
913
+ /** Like `maxOrders` but splits more than 100 ids into batches and merges them. */
914
+ maxOrdersAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
915
+ private runBatched;
916
+ }
917
+
918
+ /** Sorting by spreadBps ranks opportunities by netSpreadBps after seller commission. */
919
+ type ArbitrageSort = "estimatedNetCents" | "spreadBps";
920
+ interface ArbitrageParams {
921
+ /** Max opportunities to return (1–100, default 50). */
922
+ limit?: number;
923
+ /** Minimum spread after estimated seller commission, in basis points (default 200). */
924
+ minSpreadBps?: number;
925
+ /**
926
+ * Minimum verified buy-side notional in integer USD cents (default 1000).
927
+ * Positive values require verified capacity; 0 also includes indicative price pairs.
928
+ */
929
+ minNotionalCents?: number;
930
+ /** @deprecated Alias for {@link ArbitrageParams.minNotionalCents}. */
931
+ minNotional?: number;
932
+ sort?: ArbitrageSort;
933
+ markets?: KnownMarket[];
934
+ /** Maximum candidate items to consider (50–2000, default 500). */
935
+ candidateLimit?: number;
936
+ }
937
+ interface ArbitrageQuote {
938
+ market: string;
939
+ price: Cents;
940
+ /** Aggregate quantity reported by the market; it does not verify availability at this price. */
941
+ quoteSize: number;
942
+ /** Verified observed quantity at this quote's price; null when unavailable. */
943
+ priceLevelQuantity: number | null;
944
+ updatedAt: IsoDateString;
945
+ isStale: boolean;
946
+ }
947
+ interface ArbitrageFreshness {
948
+ buyAgeMs: number;
949
+ sellAgeMs: number;
950
+ }
951
+ interface ArbitrageOpportunity {
952
+ canonicalItemId: string;
953
+ marketHashName: string;
954
+ slug: string;
955
+ imageUrl: string | null;
956
+ buy: ArbitrageQuote;
957
+ sell: ArbitrageQuote;
958
+ /** Gross spread relative to the buy price, in basis points, before seller fees. */
959
+ spreadBps: number;
960
+ /** Gross per-unit sell price minus buy price, before seller fees. */
961
+ spreadCents: Cents;
962
+ /** Spread after estimated seller commission, relative to the buy price, in basis points. */
963
+ netSpreadBps: number;
964
+ /** Estimated per-unit proceeds after seller commission minus the buy price; excludes withdrawal and transfer costs. */
965
+ estimatedNetCents: Cents;
966
+ /** Estimated seller commission applied to the sell quote, in basis points. */
967
+ sellerFeeBps: number;
968
+ /** Version identifier of the estimated fee model. */
969
+ feeModelVersion: string;
970
+ /** Whether the seller commission uses an assumed default rate. */
971
+ assumedFees?: boolean;
972
+ /** Matched capacity at the displayed buy and sell prices; null when either leg is unverified. */
973
+ maxTradableQuantity: number | null;
974
+ /** Buy-side notional for verified capacity in USD cents; null when unknown. */
975
+ estimatedNotionalCents: Cents | null;
976
+ feeNotes: string;
977
+ freshness: ArbitrageFreshness;
978
+ calculatedAt: IsoDateString;
979
+ }
980
+ /** `GET /v1/arbitrage/opportunities` (camelCase). */
981
+ interface ArbitrageOpportunitiesResponse {
982
+ opportunities: ArbitrageOpportunity[];
983
+ totalCandidates: number;
984
+ calculatedAt: IsoDateString;
985
+ }
986
+
987
+ /** Cross-market arbitrage opportunities. */
988
+ declare class ArbitrageResource extends BaseResource {
989
+ /** `GET /v1/arbitrage/opportunities` — ranked cross-market opportunities. */
990
+ opportunities(params?: ArbitrageParams, options?: RequestOptions): Promise<ArbitrageOpportunitiesResponse>;
991
+ }
992
+
993
+ type AttributeType = "float" | "fade" | "tag";
994
+ type AttributeGranularity = "10m" | "1h" | "1d";
995
+ interface AttributeRangeDimension {
996
+ min: number;
997
+ max: number;
998
+ minInclusive: boolean;
999
+ maxInclusive: boolean;
1000
+ }
1001
+ interface AttributeBucketDimensions {
1002
+ variant: string | null;
1003
+ float: AttributeRangeDimension | null;
336
1004
  fade: AttributeRangeDimension | null;
337
1005
  pattern: number | null;
338
1006
  finishCatalog: number | null;
@@ -494,177 +1162,6 @@ declare class Buff163Resource extends BaseResource {
494
1162
  latestEach(params?: Buff163LatestParams, options?: RequestOptions): AsyncGenerator<AttributePriceItem>;
495
1163
  }
496
1164
 
497
- type HistoryListingType = "SELL_OFFER" | "BUY_ORDER" | "SALE_HISTORY";
498
- /** Accepted on input; the backend also normalizes `SELL`/`BUY`/`SALES`. */
499
- type HistoryListingTypeInput = HistoryListingType | "SELL" | "BUY" | "SALES";
500
- type SalesHistoryWindow = "24h" | "7d" | "30d" | "90d";
501
- type PriceHistoryInterval = "MINUTE_5" | "MINUTE_15" | "HOUR_1" | "HOUR_6" | "DAY_1";
502
- interface PriceHistoryParams {
503
- /** Start of the range (Date or ISO string). */
504
- from?: Date | string;
505
- /** End of the range (Date or ISO string). */
506
- to?: Date | string;
507
- /** Markets to include; when set, `byMarket` returns per-market series. */
508
- markets?: KnownMarket[];
509
- listingType?: HistoryListingTypeInput;
510
- salesWindow?: SalesHistoryWindow;
511
- interval?: PriceHistoryInterval;
512
- }
513
- interface PriceHistoryPoint {
514
- timestamp: IsoDateString;
515
- avgPrice: Cents | null;
516
- medianPrice: Cents | null;
517
- minPrice: Cents | null;
518
- maxPrice: Cents | null;
519
- listingCount: number | null;
520
- totalQuantity: number | null;
521
- volume: number | null;
522
- bestBidCents: Cents | null;
523
- bestAskCents: Cents | null;
524
- spreadBps: number | null;
525
- }
526
- /** `GET /v1/pricing/:marketHashName/history` (camelCase). */
527
- interface PriceHistoryResponse {
528
- canonicalItemId: string;
529
- name: string;
530
- history: PriceHistoryPoint[];
531
- listingType: HistoryListingType;
532
- salesWindow: SalesHistoryWindow | null;
533
- }
534
- interface MarketSeries {
535
- market: string;
536
- history: PriceHistoryPoint[];
537
- }
538
- /** `GET /v1/pricing/:marketHashName/history/markets` (camelCase). */
539
- interface PriceHistoryByMarketResponse {
540
- canonicalItemId: string;
541
- name: string;
542
- series: MarketSeries[];
543
- listingType: HistoryListingType;
544
- salesWindow: SalesHistoryWindow | null;
545
- }
546
-
547
- /** Historical price series for an item. */
548
- declare class HistoryResource extends BaseResource {
549
- /** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
550
- get(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryResponse>;
551
- /** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
552
- byMarket(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryByMarketResponse>;
553
- }
554
-
555
- interface CurrentPriceParams {
556
- /** Restrict the response to these market ids. */
557
- markets?: KnownMarket[];
558
- }
559
- /** `GET /v1/pricing/:marketHashName` (camelCase). */
560
- interface CurrentPriceResponse {
561
- canonicalItemId: string;
562
- name: string;
563
- aggregate?: AggregatePriceData;
564
- markets: MarketPricePoint[];
565
- buyOrders?: MarketPricePoint[];
566
- bestAsk?: NbboBestPrice | null;
567
- bestBid?: NbboBestPrice | null;
568
- spreadBps?: number | null;
569
- marketCount?: number;
570
- freshMarketCount?: number;
571
- calculatedAt: IsoDateString;
572
- }
573
- interface PricingListingsParams {
574
- /** Max listing samples to return (1–2000, default 500). */
575
- limit?: number;
576
- markets?: KnownMarket[];
577
- }
578
- interface PricingListing {
579
- listingId: string | null;
580
- market: string;
581
- price: Cents;
582
- currency: "USD";
583
- floatValue: number | null;
584
- paintSeed: number | null;
585
- paintIndex: number | null;
586
- inspectLink: string | null;
587
- stickers: unknown[];
588
- isStatTrak: boolean;
589
- fetchedAt: IsoDateString;
590
- }
591
- interface PricingListingFloatCoverage {
592
- coverage: "none" | "partial" | "complete";
593
- sampledListings: number;
594
- listingsWithFloat: number;
595
- marketsWithFloat: string[];
596
- marketsWithoutFloat: string[];
597
- }
598
- interface PricingListingObservedFloatSource {
599
- market: string;
600
- price: Cents;
601
- fetchedAt: IsoDateString;
602
- }
603
- interface PricingListingFloatSummary {
604
- observed: number;
605
- itemMin: number | null;
606
- itemMax: number | null;
607
- observedSource: PricingListingObservedFloatSource;
608
- }
609
- /** `GET /v1/pricing/:marketHashName/listings` (camelCase). */
610
- interface PricingListingsResponse {
611
- marketHashName: string;
612
- canonicalItemId: string;
613
- totalListings: number;
614
- sampledListings: number;
615
- floatCoverage: PricingListingFloatCoverage;
616
- floatSummary: PricingListingFloatSummary | null;
617
- listings: PricingListing[];
618
- calculatedAt: IsoDateString;
619
- }
620
-
621
- interface ItemSearchParams {
622
- /** Case-insensitive contains match on item name. */
623
- search?: string;
624
- markets?: KnownMarket[];
625
- /** 1-based page number (default 1). */
626
- page?: number;
627
- /** Items per page (1–100, default 10). */
628
- perPage?: number;
629
- }
630
- /** `GET /v1/items` — paginated (camelCase). */
631
- interface ItemPriceListResponse {
632
- data: CurrentPriceResponse[];
633
- pagination: PaginationMeta;
634
- }
635
- interface AllItemsLatestPrice {
636
- market: string;
637
- effectiveUsdCents: Cents;
638
- fetchedAt: IsoDateString;
639
- originalCurrency: string;
640
- }
641
- interface AllItemsPriceAggregates {
642
- minPrice: Cents | null;
643
- maxPrice: Cents | null;
644
- avgPrice: Cents | null;
645
- medianPrice: Cents | null;
646
- stdDev: number | null;
647
- updatedAt: IsoDateString;
648
- }
649
- interface AllItemsItem {
650
- id: string;
651
- name: string;
652
- latestPrices: AllItemsLatestPrice[];
653
- priceAggregates: AllItemsPriceAggregates | null;
654
- }
655
- /** `GET /v1/items/all` — a plain array (camelCase). */
656
- type AllItemsResponse = AllItemsItem[];
657
-
658
- /** Item discovery / search. */
659
- declare class ItemsResource extends BaseResource {
660
- /** GET /v1/items — paginated item search with current pricing. */
661
- search(params?: ItemSearchParams, options?: RequestOptions): Promise<ItemPriceListResponse>;
662
- /** GET /v1/items/all — every tracked item with latest prices (capped, unpaginated). */
663
- all(options?: RequestOptions): Promise<AllItemsResponse>;
664
- /** Async iterator over every matching item, walking pages. */
665
- searchEach(params?: ItemSearchParams, options?: RequestOptions): AsyncGenerator<CurrentPriceResponse>;
666
- }
667
-
668
1165
  interface MarketAnalyticsParams {
669
1166
  markets?: KnownMarket[];
670
1167
  /** Historical analytics window in hours (1–168, default 24). */
@@ -705,105 +1202,74 @@ declare class MarketAnalyticsResource extends BaseResource {
705
1202
  get(marketHashName: string, params?: MarketAnalyticsParams, options?: RequestOptions): Promise<MarketAnalyticsResponse>;
706
1203
  }
707
1204
 
708
- interface NbboParams {
709
- /** Canonical item id. Provide this or `marketHashName`. */
710
- id?: string;
711
- /** Market hash name. Sent as the `market_hash_name` query param. */
712
- marketHashName?: string;
713
- markets?: KnownMarket[];
1205
+ interface LatestPricesParams {
1206
+ game: Game;
1207
+ /** ETag from the preceding snapshot. HTTP 304 returns null. */
1208
+ ifNoneMatch?: string;
714
1209
  }
715
- /** 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. */
716
- interface ExecutionAdjustedBestPrice {
1210
+ /** Fields shared by every quote in the all-item snapshot. */
1211
+ interface LatestPricePoint {
717
1212
  market: string;
718
1213
  price: Cents;
719
- rawPrice: Cents;
720
- appliedFeeBps: number;
721
- withdrawalFlatUsdCents?: Cents;
722
- executability: number;
723
- updatedAt: IsoDateString;
1214
+ /** When the price was last read or confirmed still current. Not the age of the data. */
1215
+ fetchedAt: IsoDateString;
1216
+ /** Whether the quote was older than 30 minutes when the snapshot was built. */
724
1217
  isStale: boolean;
725
- reasons: string[];
1218
+ /** Source price in minor units of `originalCurrency`, before conversion and fees. */
1219
+ originalPriceCents?: number;
1220
+ originalCurrency?: string;
1221
+ /** When the source produced this data. Absent when unknown. */
1222
+ sourceUpdatedAt?: IsoDateString;
726
1223
  }
727
- /** Execution-adjusted NBBO block: fee-aware best bid/ask re-ranked by executability. */
728
- interface ExecutionAdjustedNbbo {
729
- bestAsk: ExecutionAdjustedBestPrice | null;
730
- bestBid: ExecutionAdjustedBestPrice | null;
731
- spreadBps: number | null;
732
- locked: boolean;
733
- crossed: boolean;
734
- executableConfidence: number;
735
- reasons: string[];
736
- feeModelVersion: string;
737
- calculatedAt: IsoDateString;
1224
+ interface LatestPriceAskPoint extends LatestPricePoint {
1225
+ quoteSize: number;
1226
+ /** True for a placeholder ask far above the corroborated cheaper asks. It is still a real listing. */
1227
+ outlier?: boolean;
738
1228
  }
739
- /** `GET /v1/nbbo` (camelCase). */
740
- interface NbboResponse {
741
- marketHashName: string;
1229
+ interface LatestPriceBidPoint extends LatestPricePoint {
1230
+ /** Null when unknown, which is not zero. */
1231
+ quoteSize: number | null;
1232
+ /** Quantity across bid price levels. Null when unknown. */
1233
+ totalQuantity: number | null;
1234
+ totalOrdersCount?: number;
1235
+ /** False when the source's book was read only in part, so quantities are lower bounds. */
1236
+ orderBookComplete?: boolean;
1237
+ sourceTimeKind?: SourceTimeKind;
1238
+ /** Age of the source's data when it was read, in seconds. */
1239
+ sourceAgeSeconds?: number;
1240
+ /** Whether the source's data was older than 30 minutes when the snapshot was built. */
1241
+ isSourceStale?: boolean;
1242
+ }
1243
+ interface LatestPriceItem {
1244
+ /** Market hash name. */
1245
+ name: string;
742
1246
  canonicalItemId: string;
743
1247
  bestAsk: NbboBestPrice | null;
1248
+ /** Best bid among markets that pay out in cash. */
744
1249
  bestBid: NbboBestPrice | null;
745
- spreadBps: number | null;
746
- marketCount: number;
747
- freshMarketCount: number;
748
- locked: boolean;
749
- crossed: boolean;
750
- confidence: number;
751
- calculatedAt: IsoDateString;
752
- /** Execution-adjusted "real best market"; null when no quotes. */
753
- executionAdjusted: ExecutionAdjustedNbbo | null;
754
- }
755
- interface NbboDepthParams extends NbboParams {
756
- /** Aggregated depth levels per side (1–50, default 10). */
757
- depth?: number;
758
- }
759
- interface NbboDepthQuote {
760
- market: string;
761
- level: number;
762
- price: Cents;
763
- quantity: number;
764
- ordersCount: number;
765
- updatedAt: IsoDateString;
766
- isStale: boolean;
767
- }
768
- interface NbboDepthLevel {
769
- rank: number;
770
- price: Cents;
771
- quantity: number;
772
- ordersCount: number;
773
- marketCount: number;
774
- cumulativeQuantity: number;
775
- updatedAt: IsoDateString;
776
- isStale: boolean;
777
- quotes: NbboDepthQuote[];
778
- }
779
- /** `GET /v1/nbbo/depth` (camelCase). */
780
- interface NbboDepthResponse {
781
- marketHashName: string;
782
- canonicalItemId: string;
783
- depth: number;
784
- marketCount: number;
785
- asks: NbboDepthLevel[];
786
- bids: NbboDepthLevel[];
787
- spreadBps: number | null;
788
- locked: boolean;
789
- crossed: boolean;
790
- calculatedAt: IsoDateString;
791
- }
792
-
793
- /** National Best Bid and Offer (top of book) and aggregated depth. */
794
- declare class NbboResource extends BaseResource {
795
- /** `GET /v1/nbbo` — best bid/ask across markets. Pass `id` or `marketHashName`. */
796
- get(params: NbboParams, options?: RequestOptions): Promise<NbboResponse>;
797
- /** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
798
- depth(params: NbboDepthParams, options?: RequestOptions): Promise<NbboDepthResponse>;
1250
+ markets: LatestPriceAskPoint[];
1251
+ buyOrders: LatestPriceBidPoint[];
1252
+ }
1253
+ /** `GET /v2/prices/latest`: every item of one game that has a servable quote. */
1254
+ interface LatestPricesResponse {
1255
+ /** When the oldest read in the snapshot started. A quote's `fetchedAt` can be later. */
1256
+ generatedAt: IsoDateString;
1257
+ game: Game;
1258
+ currency: "USD";
1259
+ /** Ordered by `canonicalItemId`. */
1260
+ items: LatestPriceItem[];
1261
+ itemCount: number;
799
1262
  }
800
1263
 
801
- /** Current cross-market pricing for a single item. */
802
- declare class PricingResource extends BaseResource {
803
- /** `GET /v1/pricing/:marketHashName` — full cross-market pricing snapshot. */
804
- get(marketHashName: string, params?: CurrentPriceParams, options?: RequestOptions): Promise<CurrentPriceResponse>;
805
- /** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
806
- listings(marketHashName: string, params?: PricingListingsParams, options?: RequestOptions): Promise<PricingListingsResponse>;
1264
+ /** All-item price snapshots. */
1265
+ declare class PricesResource extends BaseResource {
1266
+ /** `GET /v2/prices/latest`. Enterprise: every item of one game with each market's ask and bid. */
1267
+ latestAll(params: {
1268
+ game: Game;
1269
+ ifNoneMatch?: undefined;
1270
+ }, options?: RequestOptions): Promise<LatestPricesResponse>;
1271
+ /** A matching conditional ETag returns null. */
1272
+ latestAll(params: LatestPricesParams, options?: RequestOptions): Promise<LatestPricesResponse | null>;
807
1273
  }
808
1274
 
809
1275
  interface RecommendationParams {
@@ -884,6 +1350,12 @@ declare class SkinpricerClient {
884
1350
  readonly marketAnalytics: MarketAnalyticsResource;
885
1351
  readonly attributePrices: AttributePricesResource;
886
1352
  readonly buff163: Buff163Resource;
1353
+ readonly liquidity: LiquidityResource;
1354
+ readonly markets: MarketsResource;
1355
+ readonly schema: SchemaResource;
1356
+ readonly prices: PricesResource;
1357
+ /** Access the v2 endpoints supported by the selected game. */
1358
+ forGame<G extends Game>(game: G): GameClient<G>;
887
1359
  private readonly httpClient;
888
1360
  constructor(config: ClientConfig);
889
1361
  }
@@ -968,6 +1440,6 @@ declare function chunk<T>(items: readonly T[], size: number): T[][];
968
1440
  /** Runs `fn` over `items` with at most `limit` concurrent executions, keeping order. */
969
1441
  declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
970
1442
 
971
- declare const VERSION = "0.1.0";
1443
+ declare const VERSION = "0.4.0";
972
1444
 
973
- 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_RETRY, DEFAULT_TIMEOUT_MS, type ErrorResponseInput, type ExecutionAdjustedBestPrice, type ExecutionAdjustedNbbo, FeatureNotAvailableError, type FormatUsdOptions, type FreshnessResponse, type HistoryListingType, type HistoryListingTypeInput, HistoryResource, type IsoDateString, type ItemMaxOrders, type ItemMinPrices, type ItemPriceListResponse, type ItemSearchParams, ItemsResource, KNOWN_MARKETS, type KnownMarket, type MarketAnalyticsParams, type MarketAnalyticsPoint, MarketAnalyticsResource, type MarketAnalyticsResponse, type MarketFreshness, type MarketHealthStatus, type MarketLatency, type MarketLatencyResponse, type MarketMaxOrder, type MarketMinPrice, type MarketPricePoint, type MarketSeries, 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, type PricingListing, type PricingListingFloatCoverage, type PricingListingFloatSummary, type PricingListingObservedFloatSource, type PricingListingsParams, type PricingListingsResponse, PricingResource, 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 SalesHistoryWindow, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, StatusResource, TimeoutError, VERSION, ValidationError, type ValidationErrorOptions, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };
1445
+ 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 FormatUsdOptions, type FreshnessResponse, type Game, GameClient, type HistoryListingType, type HistoryListingTypeInput, 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, 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, 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, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, type SourceTimeKind, StatusResource, type SupportedLiquidityMarket, type SupportedRustLiquidityMarket, TimeoutError, VERSION, ValidationError, type ValidationErrorOptions, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };