@skinpricer/sdk 0.4.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/CHANGELOG.md +47 -0
- package/README.md +230 -21
- package/dist/index.cjs +600 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +805 -105
- package/dist/index.d.ts +805 -105
- package/dist/index.js +599 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
}
|
|
@@ -218,7 +242,42 @@ type IsoDateString = string;
|
|
|
218
242
|
type Cents = number;
|
|
219
243
|
/** Evidence for a source time: the payload's own timestamp, a `Last-Modified` header, or CDN cache age. */
|
|
220
244
|
type SourceTimeKind = "payload" | "last_modified" | "cdn_age" | "none";
|
|
221
|
-
|
|
245
|
+
/** `ask` is a market's lowest sell price, `bid` its highest buy order. */
|
|
246
|
+
type QuotePriceKind = "ask" | "bid";
|
|
247
|
+
/** What a seller receives when a bid fills: withdrawable cash, Steam Wallet funds, or credit at the venue's own rate. */
|
|
248
|
+
type ValueKind = "cash" | "wallet" | "bot_rate" | "unknown";
|
|
249
|
+
/** Whether a sell average and maximum come from the market's own listing statistics or from observed lowest asks. */
|
|
250
|
+
type SellBasis = "listing_statistic" | "lowest_ask";
|
|
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 {
|
|
222
281
|
market: string;
|
|
223
282
|
price: Cents;
|
|
224
283
|
currency: string;
|
|
@@ -243,10 +302,19 @@ interface MarketPricePoint {
|
|
|
243
302
|
sourceTimeKind?: SourceTimeKind;
|
|
244
303
|
/** Age of the source's data when it was read, in seconds. */
|
|
245
304
|
sourceAgeSeconds?: number | null;
|
|
246
|
-
/** Whether the source's data is older than 30 minutes. Absent when its age is unknown. */
|
|
247
|
-
isSourceStale?: boolean;
|
|
248
305
|
/** True for a placeholder ask left out of the aggregate's average, median and deviation. It is still a real listing. */
|
|
249
306
|
outlier?: boolean;
|
|
307
|
+
priceKind?: QuotePriceKind;
|
|
308
|
+
/** True only for an ask you can buy at now. Always false on a bid. */
|
|
309
|
+
purchasable?: boolean;
|
|
310
|
+
/** Bids only. */
|
|
311
|
+
valueKind?: ValueKind;
|
|
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;
|
|
250
318
|
}
|
|
251
319
|
interface AggregatePriceData {
|
|
252
320
|
minPrice: Cents | null;
|
|
@@ -260,18 +328,28 @@ interface AggregatePriceData {
|
|
|
260
328
|
freshMarketCount?: number;
|
|
261
329
|
listingCount?: number;
|
|
262
330
|
updatedAt: IsoDateString;
|
|
331
|
+
priceKind?: "ask_statistic";
|
|
263
332
|
}
|
|
264
|
-
|
|
333
|
+
/** A best ask or bid in the all-item snapshot. */
|
|
334
|
+
interface LatestBestPrice {
|
|
265
335
|
market: string;
|
|
266
336
|
price: Cents;
|
|
267
337
|
updatedAt: IsoDateString;
|
|
268
338
|
isStale: boolean;
|
|
339
|
+
priceKind?: QuotePriceKind;
|
|
340
|
+
/** True only for an ask you can buy at now. Always false on a bid. */
|
|
341
|
+
purchasable?: boolean;
|
|
342
|
+
}
|
|
343
|
+
interface NbboBestPrice extends LatestBestPrice, PriceLevel {
|
|
269
344
|
}
|
|
270
345
|
interface BestPrice {
|
|
271
346
|
market: string;
|
|
272
347
|
price: Cents;
|
|
273
|
-
|
|
274
|
-
|
|
348
|
+
updatedAt: IsoDateString;
|
|
349
|
+
isStale: boolean;
|
|
350
|
+
priceKind?: QuotePriceKind;
|
|
351
|
+
/** True only for an ask you can buy at now. Always false on a bid. */
|
|
352
|
+
purchasable?: boolean;
|
|
275
353
|
}
|
|
276
354
|
interface PaginationMeta {
|
|
277
355
|
perPage: number;
|
|
@@ -284,6 +362,8 @@ interface PaginationMeta {
|
|
|
284
362
|
nextPage: number | null;
|
|
285
363
|
}
|
|
286
364
|
|
|
365
|
+
/** History values are statistics over asks, bids or sales, never a single quote. */
|
|
366
|
+
type HistoryPriceKind = "ask_statistic" | "bid_statistic" | "sale_statistic";
|
|
287
367
|
type HistoryListingType = "SELL_OFFER" | "BUY_ORDER" | "SALE_HISTORY";
|
|
288
368
|
/** Accepted on input; the backend also normalizes `SELL`/`BUY`/`SALES`. */
|
|
289
369
|
type HistoryListingTypeInput = HistoryListingType | "SELL" | "BUY" | "SALES";
|
|
@@ -299,6 +379,13 @@ interface PriceHistoryParams {
|
|
|
299
379
|
listingType?: HistoryListingTypeInput;
|
|
300
380
|
salesWindow?: SalesHistoryWindow;
|
|
301
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;
|
|
302
389
|
}
|
|
303
390
|
interface PriceHistoryPoint {
|
|
304
391
|
timestamp: IsoDateString;
|
|
@@ -312,6 +399,26 @@ interface PriceHistoryPoint {
|
|
|
312
399
|
bestBidCents: Cents | null;
|
|
313
400
|
bestAskCents: Cents | null;
|
|
314
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;
|
|
315
422
|
}
|
|
316
423
|
/** `GET /v1/pricing/:marketHashName/history` (camelCase). */
|
|
317
424
|
interface PriceHistoryResponse {
|
|
@@ -319,13 +426,58 @@ interface PriceHistoryResponse {
|
|
|
319
426
|
name: string;
|
|
320
427
|
history: PriceHistoryPoint[];
|
|
321
428
|
listingType: HistoryListingType;
|
|
429
|
+
priceKind: HistoryPriceKind;
|
|
322
430
|
salesWindow: SalesHistoryWindow | null;
|
|
323
431
|
/** Actual returned bucket width, which may differ from the requested interval. */
|
|
324
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[];
|
|
325
468
|
}
|
|
326
469
|
interface MarketSeries {
|
|
327
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";
|
|
328
476
|
history: PriceHistoryPoint[];
|
|
477
|
+
/** `SELL_OFFER` series only. */
|
|
478
|
+
sellBasis?: SellBasis;
|
|
479
|
+
/** `BUY_ORDER` series only. */
|
|
480
|
+
valueKind?: ValueKind;
|
|
329
481
|
}
|
|
330
482
|
/** `GET /v1/pricing/:marketHashName/history/markets` (camelCase). */
|
|
331
483
|
interface PriceHistoryByMarketResponse {
|
|
@@ -333,9 +485,61 @@ interface PriceHistoryByMarketResponse {
|
|
|
333
485
|
name: string;
|
|
334
486
|
series: MarketSeries[];
|
|
335
487
|
listingType: HistoryListingType;
|
|
488
|
+
priceKind: HistoryPriceKind;
|
|
336
489
|
salesWindow: SalesHistoryWindow | null;
|
|
337
490
|
/** Actual returned bucket width, which may differ from the requested interval. */
|
|
338
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;
|
|
339
543
|
}
|
|
340
544
|
|
|
341
545
|
/** Games supported by the v2 pricing API. */
|
|
@@ -347,7 +551,7 @@ declare abstract class BaseResource {
|
|
|
347
551
|
private readonly game?;
|
|
348
552
|
constructor(http: HttpClient, game?: Game | undefined);
|
|
349
553
|
/** Performs a request and returns the data with {@link ResponseMeta} attached. */
|
|
350
|
-
protected call<T>(input: BuildRequestInput, options?: RequestOptions): Promise<T>;
|
|
554
|
+
protected call<T>(input: BuildRequestInput, options?: RequestOptions, readBody?: BodyReader<T>): Promise<T>;
|
|
351
555
|
}
|
|
352
556
|
|
|
353
557
|
/** Historical price series for an item. */
|
|
@@ -355,19 +559,40 @@ declare class HistoryResource extends BaseResource {
|
|
|
355
559
|
/** `GET /v1/pricing/:marketHashName/history` — aggregated time series. */
|
|
356
560
|
get(marketHashName: string, params?: PriceHistoryParams, options?: RequestOptions): Promise<PriceHistoryResponse>;
|
|
357
561
|
/** `GET /v1/pricing/:marketHashName/history/markets` — per-market series. */
|
|
358
|
-
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>;
|
|
359
579
|
}
|
|
360
580
|
|
|
361
581
|
interface CurrentPriceParams {
|
|
362
582
|
/** Restrict the response to these market ids. */
|
|
363
583
|
markets?: KnownMarket[];
|
|
364
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
|
+
}
|
|
365
590
|
/** `GET /v1/pricing/:marketHashName` (camelCase). */
|
|
366
591
|
interface CurrentPriceResponse {
|
|
367
592
|
canonicalItemId: string;
|
|
368
593
|
name: string;
|
|
369
594
|
aggregate?: AggregatePriceData;
|
|
370
|
-
markets:
|
|
595
|
+
markets: MarketAskPricePoint[];
|
|
371
596
|
buyOrders?: MarketPricePoint[];
|
|
372
597
|
bestAsk?: NbboBestPrice | null;
|
|
373
598
|
bestBid?: NbboBestPrice | null;
|
|
@@ -375,6 +600,8 @@ interface CurrentPriceResponse {
|
|
|
375
600
|
marketCount?: number;
|
|
376
601
|
freshMarketCount?: number;
|
|
377
602
|
calculatedAt: IsoDateString;
|
|
603
|
+
/** Present only when `currency` is not USD. */
|
|
604
|
+
fx?: PriceFx;
|
|
378
605
|
}
|
|
379
606
|
interface PricingListingsParams {
|
|
380
607
|
/** Max listing samples to return (1–2000, default 500). */
|
|
@@ -393,6 +620,9 @@ interface PricingListing {
|
|
|
393
620
|
stickers: unknown[];
|
|
394
621
|
isStatTrak: boolean;
|
|
395
622
|
fetchedAt: IsoDateString;
|
|
623
|
+
/** `listing` for a single listing, `ask` for a market's lowest-ask row. */
|
|
624
|
+
priceKind?: "ask" | "listing";
|
|
625
|
+
purchasable?: boolean;
|
|
396
626
|
}
|
|
397
627
|
interface PricingListingFloatCoverage {
|
|
398
628
|
coverage: "none" | "partial" | "complete";
|
|
@@ -443,6 +673,8 @@ interface AllItemsLatestPrice {
|
|
|
443
673
|
effectiveUsdCents: Cents;
|
|
444
674
|
fetchedAt: IsoDateString;
|
|
445
675
|
originalCurrency: string;
|
|
676
|
+
/** Present, and false, only when the ask cannot be bought now. */
|
|
677
|
+
purchasable?: false;
|
|
446
678
|
}
|
|
447
679
|
interface AllItemsPriceAggregates {
|
|
448
680
|
minPrice: Cents | null;
|
|
@@ -479,6 +711,8 @@ type LiquidityBadge = (typeof LIQUIDITY_BADGES)[number];
|
|
|
479
711
|
declare const LIQUIDITY_CONFIDENCE: readonly ["HIGH", "MEDIUM", "LOW", "CRITICAL"];
|
|
480
712
|
type LiquidityConfidence = (typeof LIQUIDITY_CONFIDENCE)[number];
|
|
481
713
|
type LiquidityCoverage = "full" | "partial" | "none";
|
|
714
|
+
/** What a market pays the seller: `cash` (withdrawable), `wallet` (Steam Wallet funds), `bot_rate` (credit at the venue's own rate) or `unknown`. */
|
|
715
|
+
type LiquidityPayout = "cash" | "wallet" | "bot_rate" | "unknown";
|
|
482
716
|
/** Lowercase label form of the badge; `UNTRADED` maps to `"unknown"`, no `"moderate"` tier. */
|
|
483
717
|
declare const LIQUIDITY_LABELS: readonly ["extremely_liquid", "very_liquid", "liquid", "illiquid", "very_illiquid", "extremely_illiquid", "unknown"];
|
|
484
718
|
type LiquidityLabel = (typeof LIQUIDITY_LABELS)[number];
|
|
@@ -503,6 +737,67 @@ interface LiquidityMarketMetric {
|
|
|
503
737
|
salesDataAgeMinutes: number | null;
|
|
504
738
|
listingsDataAgeMinutes: number | null;
|
|
505
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;
|
|
506
801
|
/** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
|
|
507
802
|
interface LiquidityResponse {
|
|
508
803
|
canonicalItemId: string;
|
|
@@ -513,6 +808,8 @@ interface LiquidityResponse {
|
|
|
513
808
|
medianTimeToSellHours: number | null;
|
|
514
809
|
p90TimeToSellHours: number | null;
|
|
515
810
|
bestMarketToList: string | null;
|
|
811
|
+
/** What `bestMarketToList` pays; null exactly when it is null. Steam Community Market pays Steam Wallet funds, which cannot be withdrawn. */
|
|
812
|
+
bestMarketToListPayout?: LiquidityPayout | null;
|
|
516
813
|
salesPerDay: number | null;
|
|
517
814
|
activeListings: number | null;
|
|
518
815
|
referenceAskUsdCents: Cents | null;
|
|
@@ -526,6 +823,8 @@ interface LiquidityResponse {
|
|
|
526
823
|
metrics: LiquidityMarketMetric[];
|
|
527
824
|
/** Data-quality flags, e.g. `sales_data_stale:marketcsgo`. */
|
|
528
825
|
notes: string[];
|
|
826
|
+
/** CS2 only, advisory, one entry per market; absent when the API has no estimates to serve. */
|
|
827
|
+
buyOrderEstimates?: BuyOrderEstimate[];
|
|
529
828
|
calculatedAt: IsoDateString;
|
|
530
829
|
}
|
|
531
830
|
/** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
|
|
@@ -539,6 +838,8 @@ interface LiquiditySummaryResponse {
|
|
|
539
838
|
/** 0-100, higher sells faster; null when untraded. */
|
|
540
839
|
score: number | null;
|
|
541
840
|
bestMarketToList: string | null;
|
|
841
|
+
/** What `bestMarketToList` pays; null exactly when it is null. Steam Community Market pays Steam Wallet funds, which cannot be withdrawn. */
|
|
842
|
+
bestMarketToListPayout?: LiquidityPayout | null;
|
|
542
843
|
calculatedAt: IsoDateString;
|
|
543
844
|
}
|
|
544
845
|
/** Request body for `POST /v1/liquidity/batch` (1-100 names). */
|
|
@@ -553,15 +854,17 @@ interface LiquidityBatchResponse {
|
|
|
553
854
|
requested: number;
|
|
554
855
|
calculatedAt: IsoDateString;
|
|
555
856
|
}
|
|
556
|
-
/** Bulk-map entry.
|
|
857
|
+
/** Bulk-map entry. */
|
|
557
858
|
interface LiquidityBulkItem {
|
|
558
|
-
|
|
859
|
+
marketHashName: string;
|
|
559
860
|
liquidity: LiquidityLabel;
|
|
560
|
-
|
|
861
|
+
estimatedSaleTime: string;
|
|
561
862
|
liquidityBadge: LiquidityBadge;
|
|
562
863
|
confidence: LiquidityConfidence;
|
|
563
864
|
score: number | null;
|
|
564
865
|
bestMarketToList: string | null;
|
|
866
|
+
/** What `bestMarketToList` pays; null exactly when it is null. Steam Community Market pays Steam Wallet funds, which cannot be withdrawn. */
|
|
867
|
+
bestMarketToListPayout?: LiquidityPayout | null;
|
|
565
868
|
/** Reserved; always `{}` for now. */
|
|
566
869
|
variants: Record<string, never>;
|
|
567
870
|
}
|
|
@@ -579,7 +882,7 @@ interface LiquidityBulkManifest {
|
|
|
579
882
|
markets: string[];
|
|
580
883
|
itemCount: number;
|
|
581
884
|
}
|
|
582
|
-
/** `GET /v1/liquidity/items` — Enterprise: whole-catalog map keyed by
|
|
885
|
+
/** `GET /v1/liquidity/items` — Enterprise: whole-catalog map keyed by market hash name. */
|
|
583
886
|
interface LiquidityBulkResponse extends LiquidityBulkManifest {
|
|
584
887
|
items: Record<string, LiquidityBulkItem>;
|
|
585
888
|
}
|
|
@@ -629,24 +932,38 @@ declare class MarketsResource extends BaseResource {
|
|
|
629
932
|
health(options?: RequestOptions): Promise<MarketHealthResponse>;
|
|
630
933
|
}
|
|
631
934
|
|
|
935
|
+
/** How well the fees on one side of the trade are known. With `unknown`, an ask's `appliedFeeBps` is null and a bid assumes a default commission. */
|
|
936
|
+
type FeeStatus = "complete" | "partial" | "unknown";
|
|
632
937
|
interface NbboParams {
|
|
633
938
|
/** Canonical item id. Provide this or `marketHashName`. */
|
|
634
939
|
id?: string;
|
|
635
|
-
/** Market hash name.
|
|
940
|
+
/** Market hash name. */
|
|
636
941
|
marketHashName?: string;
|
|
637
942
|
markets?: KnownMarket[];
|
|
638
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
|
+
}
|
|
639
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. */
|
|
640
950
|
interface ExecutionAdjustedBestPrice {
|
|
641
951
|
market: string;
|
|
642
952
|
price: Cents;
|
|
643
953
|
rawPrice: Cents;
|
|
644
|
-
|
|
645
|
-
|
|
954
|
+
/** Null on an ask when `feeStatus` is `unknown`. */
|
|
955
|
+
appliedFeeBps: number | null;
|
|
956
|
+
/** Null rather than zero when the market is not in the fee model. */
|
|
957
|
+
withdrawalFlatUsdCents?: Cents | null;
|
|
958
|
+
feeStatus?: FeeStatus;
|
|
959
|
+
feeModelVersion?: string;
|
|
646
960
|
executability: number;
|
|
647
961
|
updatedAt: IsoDateString;
|
|
648
962
|
isStale: boolean;
|
|
649
963
|
reasons: string[];
|
|
964
|
+
priceKind?: QuotePriceKind;
|
|
965
|
+
/** True only for an ask you can buy at now. Always false on a bid. */
|
|
966
|
+
purchasable?: boolean;
|
|
650
967
|
}
|
|
651
968
|
/** Execution-adjusted NBBO block: fee-aware best bid/ask re-ranked by executability. */
|
|
652
969
|
interface ExecutionAdjustedNbbo {
|
|
@@ -675,6 +992,8 @@ interface NbboResponse {
|
|
|
675
992
|
calculatedAt: IsoDateString;
|
|
676
993
|
/** Execution-adjusted "real best market"; null when no quotes. */
|
|
677
994
|
executionAdjusted: ExecutionAdjustedNbbo | null;
|
|
995
|
+
/** Present only when `currency` is not USD. */
|
|
996
|
+
fx?: PriceFx;
|
|
678
997
|
}
|
|
679
998
|
interface NbboDepthParams extends NbboParams {
|
|
680
999
|
/** Aggregated depth levels per side (1–50, default 10). */
|
|
@@ -688,6 +1007,10 @@ interface NbboDepthQuote {
|
|
|
688
1007
|
ordersCount: number;
|
|
689
1008
|
updatedAt: IsoDateString;
|
|
690
1009
|
isStale: boolean;
|
|
1010
|
+
priceKind?: QuotePriceKind;
|
|
1011
|
+
/** True only for an ask level you can buy at now. Always false on a bid. */
|
|
1012
|
+
purchasable?: boolean;
|
|
1013
|
+
valueKind?: ValueKind;
|
|
691
1014
|
}
|
|
692
1015
|
interface NbboDepthLevel {
|
|
693
1016
|
rank: number;
|
|
@@ -721,6 +1044,10 @@ declare class NbboResource extends BaseResource {
|
|
|
721
1044
|
/** `GET /v1/nbbo/depth` — aggregated order-book depth per side. */
|
|
722
1045
|
depth(params: NbboDepthParams, options?: RequestOptions): Promise<NbboDepthResponse>;
|
|
723
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
|
+
}
|
|
724
1051
|
|
|
725
1052
|
/** Current cross-market pricing for a single item. */
|
|
726
1053
|
declare class PricingResource extends BaseResource {
|
|
@@ -729,6 +1056,10 @@ declare class PricingResource extends BaseResource {
|
|
|
729
1056
|
/** `GET /v1/pricing/:marketHashName/listings` — individual listing samples. */
|
|
730
1057
|
listings(marketHashName: string, params?: PricingListingsParams, options?: RequestOptions): Promise<PricingListingsResponse>;
|
|
731
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
|
+
}
|
|
732
1063
|
|
|
733
1064
|
interface SchemaRarity {
|
|
734
1065
|
key: string;
|
|
@@ -842,10 +1173,10 @@ declare class SchemaResource extends BaseResource {
|
|
|
842
1173
|
/** Game-scoped v2 resources. Construct with `client.forGame(game)`. */
|
|
843
1174
|
declare class GameClient<G extends Game> {
|
|
844
1175
|
readonly game: G;
|
|
845
|
-
readonly pricing:
|
|
846
|
-
readonly history:
|
|
1176
|
+
readonly pricing: GamePricingResource;
|
|
1177
|
+
readonly history: GameHistoryResource;
|
|
847
1178
|
readonly items: ItemSearchResource;
|
|
848
|
-
readonly nbbo:
|
|
1179
|
+
readonly nbbo: GameNbboResource;
|
|
849
1180
|
readonly liquidity: ItemLiquidityResource<LiquidityMarketForGame<G>>;
|
|
850
1181
|
readonly schema: SchemaResource;
|
|
851
1182
|
readonly markets: MarketsResource;
|
|
@@ -859,42 +1190,48 @@ interface AggregationsParams {
|
|
|
859
1190
|
marketHashNames?: string[];
|
|
860
1191
|
markets?: KnownMarket[];
|
|
861
1192
|
}
|
|
862
|
-
/** Per-market minimum sell price
|
|
1193
|
+
/** Per-market minimum sell price. */
|
|
863
1194
|
interface MarketMinPrice {
|
|
864
|
-
|
|
1195
|
+
marketName: string;
|
|
865
1196
|
offers: number;
|
|
866
1197
|
price: Cents;
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1198
|
+
updatedAt: IsoDateString;
|
|
1199
|
+
isStale?: boolean;
|
|
1200
|
+
ingestedAt?: IsoDateString;
|
|
1201
|
+
ingestLatencyMs?: number;
|
|
1202
|
+
priceKind?: "ask";
|
|
1203
|
+
/** True only when you can buy at this price now. */
|
|
1204
|
+
purchasable?: boolean;
|
|
871
1205
|
}
|
|
872
1206
|
interface ItemMinPrices {
|
|
873
|
-
|
|
874
|
-
|
|
1207
|
+
canonicalItemId: string;
|
|
1208
|
+
marketHashName: string;
|
|
875
1209
|
prices: MarketMinPrice[];
|
|
876
1210
|
}
|
|
877
|
-
/** `GET /v1/aggregations/min-prices
|
|
1211
|
+
/** `GET /v1/aggregations/min-prices`. */
|
|
878
1212
|
interface MinPricesResponse {
|
|
879
1213
|
items: ItemMinPrices[];
|
|
880
1214
|
}
|
|
881
|
-
/** Per-market maximum buy order
|
|
1215
|
+
/** Per-market maximum buy order. */
|
|
882
1216
|
interface MarketMaxOrder {
|
|
883
|
-
|
|
1217
|
+
marketName: string;
|
|
884
1218
|
offers: number;
|
|
885
1219
|
price: Cents;
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1220
|
+
updatedAt: IsoDateString;
|
|
1221
|
+
isStale: boolean;
|
|
1222
|
+
totalQuantity?: number;
|
|
1223
|
+
ingestedAt?: IsoDateString;
|
|
1224
|
+
ingestLatencyMs?: number;
|
|
1225
|
+
valueKind?: ValueKind;
|
|
1226
|
+
priceKind?: "bid";
|
|
1227
|
+
purchasable?: false;
|
|
891
1228
|
}
|
|
892
1229
|
interface ItemMaxOrders {
|
|
893
|
-
|
|
894
|
-
|
|
1230
|
+
canonicalItemId: string;
|
|
1231
|
+
marketHashName: string;
|
|
895
1232
|
orders: MarketMaxOrder[];
|
|
896
1233
|
}
|
|
897
|
-
/** `GET /v1/aggregations/max-orders
|
|
1234
|
+
/** `GET /v1/aggregations/max-orders`. */
|
|
898
1235
|
interface MaxOrdersResponse {
|
|
899
1236
|
items: ItemMaxOrders[];
|
|
900
1237
|
}
|
|
@@ -931,7 +1268,7 @@ interface ArbitrageParams {
|
|
|
931
1268
|
minNotional?: number;
|
|
932
1269
|
sort?: ArbitrageSort;
|
|
933
1270
|
markets?: KnownMarket[];
|
|
934
|
-
/** Maximum candidate items to consider (50–
|
|
1271
|
+
/** Maximum candidate items to consider (50–1000, default 500). */
|
|
935
1272
|
candidateLimit?: number;
|
|
936
1273
|
}
|
|
937
1274
|
interface ArbitrageQuote {
|
|
@@ -943,6 +1280,9 @@ interface ArbitrageQuote {
|
|
|
943
1280
|
priceLevelQuantity: number | null;
|
|
944
1281
|
updatedAt: IsoDateString;
|
|
945
1282
|
isStale: boolean;
|
|
1283
|
+
priceKind?: QuotePriceKind;
|
|
1284
|
+
/** True only for an ask you can buy at now. Always false on a bid. */
|
|
1285
|
+
purchasable?: boolean;
|
|
946
1286
|
}
|
|
947
1287
|
interface ArbitrageFreshness {
|
|
948
1288
|
buyAgeMs: number;
|
|
@@ -1167,33 +1507,39 @@ interface MarketAnalyticsParams {
|
|
|
1167
1507
|
/** Historical analytics window in hours (1–168, default 24). */
|
|
1168
1508
|
windowHours?: number;
|
|
1169
1509
|
}
|
|
1170
|
-
/** Per-market analytics row
|
|
1510
|
+
/** Per-market analytics row. */
|
|
1171
1511
|
interface MarketAnalyticsPoint {
|
|
1172
1512
|
market: string;
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1513
|
+
currentAsk: Cents | null;
|
|
1514
|
+
currentBid: Cents | null;
|
|
1515
|
+
spreadBps: number | null;
|
|
1516
|
+
askIsStale: boolean | null;
|
|
1517
|
+
bidIsStale: boolean | null;
|
|
1518
|
+
currentListingCount: number | null;
|
|
1519
|
+
currentBuyOrderCount: number | null;
|
|
1520
|
+
currentBidQuantity: number | null;
|
|
1521
|
+
sellAvgPrice: Cents | null;
|
|
1522
|
+
sellMinPrice: Cents | null;
|
|
1523
|
+
sellMaxPrice: Cents | null;
|
|
1524
|
+
sellAvgListingCount: number | null;
|
|
1525
|
+
buyAvgPrice: Cents | null;
|
|
1526
|
+
buyMaxPrice: Cents | null;
|
|
1527
|
+
buyAvgOrderCount: number | null;
|
|
1528
|
+
buyAvgTotalQuantity: number | null;
|
|
1529
|
+
/** True only when you can buy at `currentAsk` now. */
|
|
1530
|
+
askPurchasable?: boolean | null;
|
|
1531
|
+
/** Basis of `sellAvgPrice` and `sellMaxPrice`. */
|
|
1532
|
+
sellBasis?: SellBasis;
|
|
1533
|
+
/** Settlement kind of this market's bids: `currentBid`, `buyAvgPrice` and `buyMaxPrice`. */
|
|
1534
|
+
valueKind?: ValueKind;
|
|
1535
|
+
}
|
|
1536
|
+
/** `GET /v1/market-analytics/:marketHashName`. */
|
|
1191
1537
|
interface MarketAnalyticsResponse {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1538
|
+
canonicalItemId: string;
|
|
1539
|
+
marketHashName: string;
|
|
1540
|
+
windowHours: number;
|
|
1195
1541
|
markets: MarketAnalyticsPoint[];
|
|
1196
|
-
|
|
1542
|
+
calculatedAt: IsoDateString;
|
|
1197
1543
|
}
|
|
1198
1544
|
|
|
1199
1545
|
/** Per-market current + historical analytics for an item. */
|
|
@@ -1204,11 +1550,15 @@ declare class MarketAnalyticsResource extends BaseResource {
|
|
|
1204
1550
|
|
|
1205
1551
|
interface LatestPricesParams {
|
|
1206
1552
|
game: Game;
|
|
1207
|
-
/**
|
|
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. */
|
|
1208
1558
|
ifNoneMatch?: string;
|
|
1209
1559
|
}
|
|
1210
|
-
/** Fields shared by every quote in the all-item snapshot. */
|
|
1211
|
-
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 {
|
|
1212
1562
|
market: string;
|
|
1213
1563
|
price: Cents;
|
|
1214
1564
|
/** When the price was last read or confirmed still current. Not the age of the data. */
|
|
@@ -1225,6 +1575,8 @@ interface LatestPriceAskPoint extends LatestPricePoint {
|
|
|
1225
1575
|
quoteSize: number;
|
|
1226
1576
|
/** True for a placeholder ask far above the corroborated cheaper asks. It is still a real listing. */
|
|
1227
1577
|
outlier?: boolean;
|
|
1578
|
+
/** Present, and false, only when the ask cannot be bought now. */
|
|
1579
|
+
purchasable?: false;
|
|
1228
1580
|
}
|
|
1229
1581
|
interface LatestPriceBidPoint extends LatestPricePoint {
|
|
1230
1582
|
/** Null when unknown, which is not zero. */
|
|
@@ -1237,16 +1589,15 @@ interface LatestPriceBidPoint extends LatestPricePoint {
|
|
|
1237
1589
|
sourceTimeKind?: SourceTimeKind;
|
|
1238
1590
|
/** Age of the source's data when it was read, in seconds. */
|
|
1239
1591
|
sourceAgeSeconds?: number;
|
|
1240
|
-
|
|
1241
|
-
isSourceStale?: boolean;
|
|
1592
|
+
valueKind?: ValueKind;
|
|
1242
1593
|
}
|
|
1243
1594
|
interface LatestPriceItem {
|
|
1244
1595
|
/** Market hash name. */
|
|
1245
1596
|
name: string;
|
|
1246
1597
|
canonicalItemId: string;
|
|
1247
|
-
bestAsk:
|
|
1598
|
+
bestAsk: LatestBestPrice | null;
|
|
1248
1599
|
/** Best bid among markets that pay out in cash. */
|
|
1249
|
-
bestBid:
|
|
1600
|
+
bestBid: LatestBestPrice | null;
|
|
1250
1601
|
markets: LatestPriceAskPoint[];
|
|
1251
1602
|
buyOrders: LatestPriceBidPoint[];
|
|
1252
1603
|
}
|
|
@@ -1255,44 +1606,309 @@ interface LatestPricesResponse {
|
|
|
1255
1606
|
/** When the oldest read in the snapshot started. A quote's `fetchedAt` can be later. */
|
|
1256
1607
|
generatedAt: IsoDateString;
|
|
1257
1608
|
game: Game;
|
|
1258
|
-
|
|
1609
|
+
/** Currency of every price: USD, or the requested currency. */
|
|
1610
|
+
currency: Currency;
|
|
1611
|
+
/** Present only when `currency` is not USD. */
|
|
1612
|
+
fx?: PriceFx;
|
|
1259
1613
|
/** Ordered by `canonicalItemId`. */
|
|
1260
1614
|
items: LatestPriceItem[];
|
|
1261
1615
|
itemCount: number;
|
|
1262
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
|
+
}
|
|
1263
1848
|
|
|
1264
|
-
/** All-item price snapshots. */
|
|
1849
|
+
/** All-item price snapshots and their change feed. */
|
|
1265
1850
|
declare class PricesResource extends BaseResource {
|
|
1266
1851
|
/** `GET /v2/prices/latest`. Enterprise: every item of one game with each market's ask and bid. */
|
|
1267
1852
|
latestAll(params: {
|
|
1268
1853
|
game: Game;
|
|
1854
|
+
currency?: Currency;
|
|
1855
|
+
include?: "priceLevels";
|
|
1269
1856
|
ifNoneMatch?: undefined;
|
|
1270
1857
|
}, options?: RequestOptions): Promise<LatestPricesResponse>;
|
|
1271
1858
|
/** A matching conditional ETag returns null. */
|
|
1272
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;
|
|
1273
1887
|
}
|
|
1274
1888
|
|
|
1275
1889
|
interface RecommendationParams {
|
|
1276
1890
|
markets?: KnownMarket[];
|
|
1277
1891
|
}
|
|
1278
|
-
/** `GET /v1/recommendations/:marketHashName
|
|
1892
|
+
/** `GET /v1/recommendations/:marketHashName`. */
|
|
1279
1893
|
interface RecommendationResponse {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1894
|
+
canonicalItemId: string;
|
|
1895
|
+
marketHashName: string;
|
|
1896
|
+
suggestedPrice: Cents | null;
|
|
1897
|
+
/** `suggestedPrice` is a model estimate, not a quote from any market. */
|
|
1898
|
+
suggestedPriceKind?: "estimate";
|
|
1283
1899
|
strategy: string;
|
|
1284
1900
|
confidence: number;
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1901
|
+
liquidityScore: number;
|
|
1902
|
+
unstableReasons: string[];
|
|
1903
|
+
bestAsk: BestPrice | null;
|
|
1904
|
+
bestBid: BestPrice | null;
|
|
1905
|
+
spreadBps: number | null;
|
|
1906
|
+
marketCount: number;
|
|
1907
|
+
freshMarketCount: number;
|
|
1908
|
+
listingCount: number;
|
|
1909
|
+
buyOrderCount: number;
|
|
1910
|
+
totalBidQuantity: number;
|
|
1911
|
+
calculatedAt: IsoDateString;
|
|
1296
1912
|
}
|
|
1297
1913
|
|
|
1298
1914
|
/** Suggested executable price and liquidity signals for an item. */
|
|
@@ -1301,33 +1917,116 @@ declare class RecommendationsResource extends BaseResource {
|
|
|
1301
1917
|
get(marketHashName: string, params?: RecommendationParams, options?: RequestOptions): Promise<RecommendationResponse>;
|
|
1302
1918
|
}
|
|
1303
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
|
+
|
|
1304
2003
|
type MarketHealthStatus = "healthy" | "degraded" | "stale";
|
|
1305
2004
|
interface MarketFreshness {
|
|
1306
2005
|
market: string;
|
|
1307
|
-
|
|
1308
|
-
|
|
2006
|
+
delaySeconds: number;
|
|
2007
|
+
lastUpdate: IsoDateString;
|
|
1309
2008
|
status: MarketHealthStatus;
|
|
1310
2009
|
}
|
|
1311
|
-
/** `GET /v1/status/freshness
|
|
2010
|
+
/** `GET /v1/status/freshness`. */
|
|
1312
2011
|
interface FreshnessResponse {
|
|
1313
2012
|
markets: MarketFreshness[];
|
|
1314
|
-
|
|
1315
|
-
|
|
2013
|
+
overallStatus: MarketHealthStatus;
|
|
2014
|
+
checkedAt: IsoDateString;
|
|
1316
2015
|
}
|
|
1317
2016
|
interface MarketLatency {
|
|
1318
2017
|
market: string;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
/** `GET /v1/status/market-latency
|
|
2018
|
+
avgLatencyMs: number;
|
|
2019
|
+
p95LatencyMs: number;
|
|
2020
|
+
p99LatencyMs: number;
|
|
2021
|
+
fetchCount: number;
|
|
2022
|
+
errorRate: number;
|
|
2023
|
+
sloBreachRate: number;
|
|
2024
|
+
}
|
|
2025
|
+
/** `GET /v1/status/market-latency`. */
|
|
1327
2026
|
interface MarketLatencyResponse {
|
|
1328
2027
|
markets: MarketLatency[];
|
|
1329
|
-
|
|
1330
|
-
|
|
2028
|
+
windowHours: number;
|
|
2029
|
+
measuredAt: IsoDateString;
|
|
1331
2030
|
}
|
|
1332
2031
|
|
|
1333
2032
|
/** Pipeline health and latency metrics. */
|
|
@@ -1354,6 +2053,7 @@ declare class SkinpricerClient {
|
|
|
1354
2053
|
readonly markets: MarketsResource;
|
|
1355
2054
|
readonly schema: SchemaResource;
|
|
1356
2055
|
readonly prices: PricesResource;
|
|
2056
|
+
readonly sales: SalesResource;
|
|
1357
2057
|
/** Access the v2 endpoints supported by the selected game. */
|
|
1358
2058
|
forGame<G extends Game>(game: G): GameClient<G>;
|
|
1359
2059
|
private readonly httpClient;
|
|
@@ -1364,7 +2064,7 @@ declare class SkinpricerClient {
|
|
|
1364
2064
|
declare class APIError extends SkinpricerError {
|
|
1365
2065
|
}
|
|
1366
2066
|
interface ValidationErrorOptions extends SkinpricerErrorOptions {
|
|
1367
|
-
/**
|
|
2067
|
+
/** One entry per rejected field or parameter, from the error body's `details` (or a NestJS `message` array). */
|
|
1368
2068
|
messages?: string[];
|
|
1369
2069
|
}
|
|
1370
2070
|
/** 400 Bad Request — request validation failed. */
|
|
@@ -1440,6 +2140,6 @@ declare function chunk<T>(items: readonly T[], size: number): T[][];
|
|
|
1440
2140
|
/** Runs `fn` over `items` with at most `limit` concurrent executions, keeping order. */
|
|
1441
2141
|
declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
1442
2142
|
|
|
1443
|
-
declare const VERSION = "0.
|
|
2143
|
+
declare const VERSION = "0.6.0";
|
|
1444
2144
|
|
|
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 };
|
|
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 };
|