@skinpricer/sdk 0.2.0 → 0.3.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;
@@ -125,6 +135,8 @@ interface BuildRequestInput {
125
135
  path: string;
126
136
  query?: QueryParams;
127
137
  body?: unknown;
138
+ /** Overrides `config.baseUrl` for this request (e.g. keyless public-service endpoints). */
139
+ baseUrl?: string;
128
140
  }
129
141
 
130
142
  interface RequestOptions {
@@ -136,18 +148,53 @@ declare class HttpClient {
136
148
  private readonly config;
137
149
  private throttleUntil;
138
150
  constructor(config: ResolvedConfig);
151
+ /** Base URL for keyless public-service endpoints (see {@link ResolvedConfig.publicBaseUrl}). */
152
+ get publicBaseUrl(): string;
139
153
  request<T>(input: BuildRequestInput, options?: RequestOptions): Promise<HttpResponse<T>>;
140
154
  private recordRateLimit;
141
155
  private awaitThrottle;
142
156
  }
143
157
 
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"];
158
+ /**
159
+ * Market ids the API integrates — the canonical join keys returned by
160
+ * `GET /v1/markets/health` and used across pricing / nbbo / aggregation
161
+ * responses. Kept in sync with that registry (18 integrated markets as of
162
+ * 2026-06). A market id appears here once the backend integrates it, regardless
163
+ * of live/degraded/stale status; ids prepared but not yet ingesting (e.g.
164
+ * bitskins, skinbaron) are intentionally excluded until they show in health.
165
+ */
166
+ declare const KNOWN_MARKETS: readonly ["skinport", "skindeck", "buff163", "csfloat", "csdeals", "marketcsgo", "cstrade", "dmarket", "itrade", "lis-skins", "swapgg", "whitemarket", "waxpeer", "lootfarm", "avanmarket", "tradeit-store", "tradeit-trade", "steamcommunity"];
146
167
  /** A known market id, or any other string. */
147
168
  type KnownMarket = (typeof KNOWN_MARKETS)[number] | (string & Record<never, never>);
148
169
  /** Markets that expose attribute (float/fade/tag) bucket pricing. */
149
170
  declare const ATTRIBUTE_MARKETS: readonly ["buff163", "steamcommunity", "marketcsgo", "csfloat", "dmarket"];
150
171
  type AttributeMarket = (typeof ATTRIBUTE_MARKETS)[number] | (string & Record<never, never>);
172
+ /**
173
+ * Per-market ingest status reported by `GET /v1/markets/health`. Distinct from
174
+ * the freshness endpoint's `MarketHealthStatus` (`healthy | degraded | stale`)
175
+ * in `./status` — the registry uses `live | warn | stale`.
176
+ */
177
+ type MarketRegistryStatus = "live" | "warn" | "stale";
178
+ /**
179
+ * One market's health row from `GET /v1/markets/health`. The `id` is the
180
+ * canonical join key used across pricing / nbbo / aggregation responses (see
181
+ * {@link KNOWN_MARKETS}). A market appears here once integrated, at any status.
182
+ */
183
+ interface MarketHealthRow {
184
+ id: string;
185
+ status: MarketRegistryStatus;
186
+ /** ISO timestamp of the latest ingest event from this marketplace. */
187
+ lastEventAt: string;
188
+ listingsCount: number;
189
+ /**
190
+ * Optional 48 × 5-min uptime tiers covering the trailing 4h. Each entry is
191
+ * 0 (down) / 1 (degraded) / 2 (live), oldest first. Absent when the backend
192
+ * doesn't yet emit per-bucket health.
193
+ */
194
+ healthBars?: readonly number[];
195
+ }
196
+ /** `GET /v1/markets/health` — a plain array of per-market health rows. */
197
+ type MarketHealthResponse = MarketHealthRow[];
151
198
 
152
199
  /** An ISO-8601 timestamp string. */
153
200
  type IsoDateString = string;
@@ -199,8 +246,10 @@ interface PaginationMeta {
199
246
  }
200
247
 
201
248
  interface AggregationsParams {
202
- /** Canonical item ids (1–100). */
203
- ids: string[];
249
+ /** Canonical item ids (1–100). Provide this or {@link AggregationsParams.marketHashNames}. */
250
+ ids?: string[];
251
+ /** Market hash names (1–100). Provide this or {@link AggregationsParams.ids}. */
252
+ marketHashNames?: string[];
204
253
  markets?: KnownMarket[];
205
254
  }
206
255
  /** Per-market minimum sell price (snake_case). */
@@ -256,9 +305,9 @@ interface AggregationsBatchParams {
256
305
  concurrency?: number;
257
306
  }
258
307
  declare class AggregationsResource extends BaseResource {
259
- /** GET /v1/aggregations/min-prices — minimum sell price per market (max 100 ids). */
308
+ /** GET /v1/aggregations/min-prices — minimum sell price per market. Pass up to 100 `ids` or `marketHashNames`. */
260
309
  minPrices(params: AggregationsParams, options?: RequestOptions): Promise<MinPricesResponse>;
261
- /** GET /v1/aggregations/max-orders — maximum buy order per market (max 100 ids). */
310
+ /** GET /v1/aggregations/max-orders — maximum buy order per market. Pass up to 100 `ids` or `marketHashNames`. */
262
311
  maxOrders(params: AggregationsParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
263
312
  /** Like `minPrices` but splits more than 100 ids into batches and merges them. */
264
313
  minPricesAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MinPricesResponse>;
@@ -665,6 +714,135 @@ declare class ItemsResource extends BaseResource {
665
714
  searchEach(params?: ItemSearchParams, options?: RequestOptions): AsyncGenerator<CurrentPriceResponse>;
666
715
  }
667
716
 
717
+ declare const LIQUIDITY_BADGES: readonly ["EXTREMELY_LIQUID", "VERY_LIQUID", "LIQUID", "ILLIQUID", "VERY_ILLIQUID", "EXTREMELY_ILLIQUID", "UNTRADED"];
718
+ type LiquidityBadge = (typeof LIQUIDITY_BADGES)[number];
719
+ declare const LIQUIDITY_CONFIDENCE: readonly ["HIGH", "MEDIUM", "LOW", "CRITICAL"];
720
+ type LiquidityConfidence = (typeof LIQUIDITY_CONFIDENCE)[number];
721
+ type LiquidityCoverage = "full" | "partial" | "none";
722
+ /** Lowercase label form of the badge; `UNTRADED` maps to `"unknown"`, no `"moderate"` tier. */
723
+ declare const LIQUIDITY_LABELS: readonly ["extremely_liquid", "very_liquid", "liquid", "illiquid", "very_illiquid", "extremely_illiquid", "unknown"];
724
+ type LiquidityLabel = (typeof LIQUIDITY_LABELS)[number];
725
+ declare const SUPPORTED_LIQUIDITY_MARKETS: readonly ["skinport", "marketcsgo", "dmarket", "csdeals", "csfloat"];
726
+ type SupportedLiquidityMarket = (typeof SUPPORTED_LIQUIDITY_MARKETS)[number];
727
+ interface LiquidityParams {
728
+ /** Hypothetical ask (USD cents) to estimate against; defaults to the best ask. */
729
+ askPrice?: Cents;
730
+ market?: SupportedLiquidityMarket;
731
+ }
732
+ /** Per-market row; every metric is null when that market has no data. */
733
+ interface LiquidityMarketMetric {
734
+ market: string;
735
+ salesPerDay: number | null;
736
+ activeListings: number | null;
737
+ bestAskUsdCents: Cents | null;
738
+ medianTimeToSellHours: number | null;
739
+ p90TimeToSellHours: number | null;
740
+ salesDataAgeMinutes: number | null;
741
+ listingsDataAgeMinutes: number | null;
742
+ }
743
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
744
+ interface LiquidityResponse {
745
+ canonicalItemId: string;
746
+ marketHashName: string;
747
+ liquidityBadge: LiquidityBadge;
748
+ confidence: LiquidityConfidence;
749
+ coverage: LiquidityCoverage;
750
+ medianTimeToSellHours: number | null;
751
+ p90TimeToSellHours: number | null;
752
+ bestMarketToList: string | null;
753
+ salesPerDay: number | null;
754
+ activeListings: number | null;
755
+ referenceAskUsdCents: Cents | null;
756
+ marketWideSalesPerDay: number | null;
757
+ marketWideListings: number | null;
758
+ marketsWithSales: number;
759
+ marketsWithDepth: number;
760
+ /** Whole-market saturation (hours), NOT a per-listing estimate. */
761
+ marketWideMedianTimeToSellHours: number | null;
762
+ marketWideP90TimeToSellHours: number | null;
763
+ metrics: LiquidityMarketMetric[];
764
+ /** Data-quality flags, e.g. `sales_data_stale:marketcsgo`. */
765
+ notes: string[];
766
+ calculatedAt: IsoDateString;
767
+ }
768
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
769
+ interface LiquiditySummaryResponse {
770
+ marketHashName: string;
771
+ liquidityBadge: LiquidityBadge;
772
+ liquidity: LiquidityLabel;
773
+ /** Human time-to-sell, e.g. `"2 - 6 hours"` (`"No recent sales"` when untraded). */
774
+ estimatedSaleTime: string;
775
+ confidence: LiquidityConfidence;
776
+ /** 0-100, higher sells faster; null when untraded. */
777
+ score: number | null;
778
+ bestMarketToList: string | null;
779
+ calculatedAt: IsoDateString;
780
+ }
781
+ /** Request body for `POST /v1/liquidity/batch` (1-100 names). */
782
+ interface LiquidityBatchBody {
783
+ marketHashNames: string[];
784
+ market?: SupportedLiquidityMarket;
785
+ }
786
+ /** `POST /v1/liquidity/batch` — up to 100 full results in one call. */
787
+ interface LiquidityBatchResponse {
788
+ results: LiquidityResponse[];
789
+ notFound: string[];
790
+ requested: number;
791
+ calculatedAt: IsoDateString;
792
+ }
793
+ /** Bulk-map entry. `market_hash_name` and `estimated_sale_time` are snake_case on the wire. */
794
+ interface LiquidityBulkItem {
795
+ market_hash_name: string;
796
+ liquidity: LiquidityLabel;
797
+ estimated_sale_time: string;
798
+ liquidityBadge: LiquidityBadge;
799
+ confidence: LiquidityConfidence;
800
+ score: number | null;
801
+ bestMarketToList: string | null;
802
+ /** Reserved; always `{}` for now. */
803
+ variants: Record<string, never>;
804
+ }
805
+ /** `GET /v1/liquidity/items/manifest` — cheap change-probe; compare `version` before refetching. */
806
+ interface LiquidityBulkManifest {
807
+ /** Snapshot version / ETag. */
808
+ version: string;
809
+ calculatedAt: IsoDateString;
810
+ /** Recompute cadence as an ISO-8601 duration, e.g. `"PT10M"`. */
811
+ cadence: string;
812
+ markets: string[];
813
+ itemCount: number;
814
+ }
815
+ /** `GET /v1/liquidity/items` — Enterprise: whole-catalog map keyed by market_hash_name. */
816
+ interface LiquidityBulkResponse extends LiquidityBulkManifest {
817
+ items: Record<string, LiquidityBulkItem>;
818
+ }
819
+
820
+ /**
821
+ * Liquidity & expected time-to-sell, from cross-market order-book depth and
822
+ * sales velocity. The single + summary + batch endpoints are Pro; the bulk map
823
+ * + manifest are Enterprise.
824
+ */
825
+ declare class LiquidityResource extends BaseResource {
826
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
827
+ get(marketHashName: string, params?: LiquidityParams, options?: RequestOptions): Promise<LiquidityResponse>;
828
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
829
+ summary(marketHashName: string, params?: LiquidityParams, options?: RequestOptions): Promise<LiquiditySummaryResponse>;
830
+ /** `POST /v1/liquidity/batch` — score up to 100 items in one call. */
831
+ batch(body: LiquidityBatchBody, options?: RequestOptions): Promise<LiquidityBatchResponse>;
832
+ /**
833
+ * `GET /v1/liquidity/items` — Enterprise: the whole-catalog liquidity map,
834
+ * rematerialized every ~10 minutes. Poll {@link manifest} and compare
835
+ * `version` before refetching this heavier payload.
836
+ */
837
+ bulk(options?: RequestOptions): Promise<LiquidityBulkResponse>;
838
+ /**
839
+ * `GET /v1/liquidity/items/manifest` — Enterprise: a cheap change-probe for
840
+ * the {@link bulk} map (`version`, `calculatedAt`, `cadence`, `markets`,
841
+ * `itemCount`). Refetch the bulk map only when `version` changes.
842
+ */
843
+ manifest(options?: RequestOptions): Promise<LiquidityBulkManifest>;
844
+ }
845
+
668
846
  interface MarketAnalyticsParams {
669
847
  markets?: KnownMarket[];
670
848
  /** Historical analytics window in hours (1–168, default 24). */
@@ -705,6 +883,16 @@ declare class MarketAnalyticsResource extends BaseResource {
705
883
  get(marketHashName: string, params?: MarketAnalyticsParams, options?: RequestOptions): Promise<MarketAnalyticsResponse>;
706
884
  }
707
885
 
886
+ /** Market registry health & integration status. */
887
+ declare class MarketsResource extends BaseResource {
888
+ /**
889
+ * `GET /v1/markets/health` — per-market ingest status, last event time, and
890
+ * listing counts for every integrated market. Returns a plain array of
891
+ * {@link import("../types/markets").MarketHealthRow}.
892
+ */
893
+ health(options?: RequestOptions): Promise<MarketHealthResponse>;
894
+ }
895
+
708
896
  interface NbboParams {
709
897
  /** Canonical item id. Provide this or `marketHashName`. */
710
898
  id?: string;
@@ -884,6 +1072,8 @@ declare class SkinpricerClient {
884
1072
  readonly marketAnalytics: MarketAnalyticsResource;
885
1073
  readonly attributePrices: AttributePricesResource;
886
1074
  readonly buff163: Buff163Resource;
1075
+ readonly liquidity: LiquidityResource;
1076
+ readonly markets: MarketsResource;
887
1077
  private readonly httpClient;
888
1078
  constructor(config: ClientConfig);
889
1079
  }
@@ -968,6 +1158,6 @@ declare function chunk<T>(items: readonly T[], size: number): T[][];
968
1158
  /** Runs `fn` over `items` with at most `limit` concurrent executions, keeping order. */
969
1159
  declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
970
1160
 
971
- declare const VERSION = "0.1.0";
1161
+ declare const VERSION = "0.3.0";
972
1162
 
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 };
1163
+ 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 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 LiquidityBadge, type LiquidityBatchBody, type LiquidityBatchResponse, type LiquidityBulkItem, type LiquidityBulkManifest, type LiquidityBulkResponse, type LiquidityConfidence, type LiquidityCoverage, type LiquidityLabel, 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, 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, type SalesHistoryWindow, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, StatusResource, type SupportedLiquidityMarket, TimeoutError, VERSION, ValidationError, type ValidationErrorOptions, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };
package/dist/index.d.ts 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;
@@ -125,6 +135,8 @@ interface BuildRequestInput {
125
135
  path: string;
126
136
  query?: QueryParams;
127
137
  body?: unknown;
138
+ /** Overrides `config.baseUrl` for this request (e.g. keyless public-service endpoints). */
139
+ baseUrl?: string;
128
140
  }
129
141
 
130
142
  interface RequestOptions {
@@ -136,18 +148,53 @@ declare class HttpClient {
136
148
  private readonly config;
137
149
  private throttleUntil;
138
150
  constructor(config: ResolvedConfig);
151
+ /** Base URL for keyless public-service endpoints (see {@link ResolvedConfig.publicBaseUrl}). */
152
+ get publicBaseUrl(): string;
139
153
  request<T>(input: BuildRequestInput, options?: RequestOptions): Promise<HttpResponse<T>>;
140
154
  private recordRateLimit;
141
155
  private awaitThrottle;
142
156
  }
143
157
 
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"];
158
+ /**
159
+ * Market ids the API integrates — the canonical join keys returned by
160
+ * `GET /v1/markets/health` and used across pricing / nbbo / aggregation
161
+ * responses. Kept in sync with that registry (18 integrated markets as of
162
+ * 2026-06). A market id appears here once the backend integrates it, regardless
163
+ * of live/degraded/stale status; ids prepared but not yet ingesting (e.g.
164
+ * bitskins, skinbaron) are intentionally excluded until they show in health.
165
+ */
166
+ declare const KNOWN_MARKETS: readonly ["skinport", "skindeck", "buff163", "csfloat", "csdeals", "marketcsgo", "cstrade", "dmarket", "itrade", "lis-skins", "swapgg", "whitemarket", "waxpeer", "lootfarm", "avanmarket", "tradeit-store", "tradeit-trade", "steamcommunity"];
146
167
  /** A known market id, or any other string. */
147
168
  type KnownMarket = (typeof KNOWN_MARKETS)[number] | (string & Record<never, never>);
148
169
  /** Markets that expose attribute (float/fade/tag) bucket pricing. */
149
170
  declare const ATTRIBUTE_MARKETS: readonly ["buff163", "steamcommunity", "marketcsgo", "csfloat", "dmarket"];
150
171
  type AttributeMarket = (typeof ATTRIBUTE_MARKETS)[number] | (string & Record<never, never>);
172
+ /**
173
+ * Per-market ingest status reported by `GET /v1/markets/health`. Distinct from
174
+ * the freshness endpoint's `MarketHealthStatus` (`healthy | degraded | stale`)
175
+ * in `./status` — the registry uses `live | warn | stale`.
176
+ */
177
+ type MarketRegistryStatus = "live" | "warn" | "stale";
178
+ /**
179
+ * One market's health row from `GET /v1/markets/health`. The `id` is the
180
+ * canonical join key used across pricing / nbbo / aggregation responses (see
181
+ * {@link KNOWN_MARKETS}). A market appears here once integrated, at any status.
182
+ */
183
+ interface MarketHealthRow {
184
+ id: string;
185
+ status: MarketRegistryStatus;
186
+ /** ISO timestamp of the latest ingest event from this marketplace. */
187
+ lastEventAt: string;
188
+ listingsCount: number;
189
+ /**
190
+ * Optional 48 × 5-min uptime tiers covering the trailing 4h. Each entry is
191
+ * 0 (down) / 1 (degraded) / 2 (live), oldest first. Absent when the backend
192
+ * doesn't yet emit per-bucket health.
193
+ */
194
+ healthBars?: readonly number[];
195
+ }
196
+ /** `GET /v1/markets/health` — a plain array of per-market health rows. */
197
+ type MarketHealthResponse = MarketHealthRow[];
151
198
 
152
199
  /** An ISO-8601 timestamp string. */
153
200
  type IsoDateString = string;
@@ -199,8 +246,10 @@ interface PaginationMeta {
199
246
  }
200
247
 
201
248
  interface AggregationsParams {
202
- /** Canonical item ids (1–100). */
203
- ids: string[];
249
+ /** Canonical item ids (1–100). Provide this or {@link AggregationsParams.marketHashNames}. */
250
+ ids?: string[];
251
+ /** Market hash names (1–100). Provide this or {@link AggregationsParams.ids}. */
252
+ marketHashNames?: string[];
204
253
  markets?: KnownMarket[];
205
254
  }
206
255
  /** Per-market minimum sell price (snake_case). */
@@ -256,9 +305,9 @@ interface AggregationsBatchParams {
256
305
  concurrency?: number;
257
306
  }
258
307
  declare class AggregationsResource extends BaseResource {
259
- /** GET /v1/aggregations/min-prices — minimum sell price per market (max 100 ids). */
308
+ /** GET /v1/aggregations/min-prices — minimum sell price per market. Pass up to 100 `ids` or `marketHashNames`. */
260
309
  minPrices(params: AggregationsParams, options?: RequestOptions): Promise<MinPricesResponse>;
261
- /** GET /v1/aggregations/max-orders — maximum buy order per market (max 100 ids). */
310
+ /** GET /v1/aggregations/max-orders — maximum buy order per market. Pass up to 100 `ids` or `marketHashNames`. */
262
311
  maxOrders(params: AggregationsParams, options?: RequestOptions): Promise<MaxOrdersResponse>;
263
312
  /** Like `minPrices` but splits more than 100 ids into batches and merges them. */
264
313
  minPricesAll(ids: string[], params?: AggregationsBatchParams, options?: RequestOptions): Promise<MinPricesResponse>;
@@ -665,6 +714,135 @@ declare class ItemsResource extends BaseResource {
665
714
  searchEach(params?: ItemSearchParams, options?: RequestOptions): AsyncGenerator<CurrentPriceResponse>;
666
715
  }
667
716
 
717
+ declare const LIQUIDITY_BADGES: readonly ["EXTREMELY_LIQUID", "VERY_LIQUID", "LIQUID", "ILLIQUID", "VERY_ILLIQUID", "EXTREMELY_ILLIQUID", "UNTRADED"];
718
+ type LiquidityBadge = (typeof LIQUIDITY_BADGES)[number];
719
+ declare const LIQUIDITY_CONFIDENCE: readonly ["HIGH", "MEDIUM", "LOW", "CRITICAL"];
720
+ type LiquidityConfidence = (typeof LIQUIDITY_CONFIDENCE)[number];
721
+ type LiquidityCoverage = "full" | "partial" | "none";
722
+ /** Lowercase label form of the badge; `UNTRADED` maps to `"unknown"`, no `"moderate"` tier. */
723
+ declare const LIQUIDITY_LABELS: readonly ["extremely_liquid", "very_liquid", "liquid", "illiquid", "very_illiquid", "extremely_illiquid", "unknown"];
724
+ type LiquidityLabel = (typeof LIQUIDITY_LABELS)[number];
725
+ declare const SUPPORTED_LIQUIDITY_MARKETS: readonly ["skinport", "marketcsgo", "dmarket", "csdeals", "csfloat"];
726
+ type SupportedLiquidityMarket = (typeof SUPPORTED_LIQUIDITY_MARKETS)[number];
727
+ interface LiquidityParams {
728
+ /** Hypothetical ask (USD cents) to estimate against; defaults to the best ask. */
729
+ askPrice?: Cents;
730
+ market?: SupportedLiquidityMarket;
731
+ }
732
+ /** Per-market row; every metric is null when that market has no data. */
733
+ interface LiquidityMarketMetric {
734
+ market: string;
735
+ salesPerDay: number | null;
736
+ activeListings: number | null;
737
+ bestAskUsdCents: Cents | null;
738
+ medianTimeToSellHours: number | null;
739
+ p90TimeToSellHours: number | null;
740
+ salesDataAgeMinutes: number | null;
741
+ listingsDataAgeMinutes: number | null;
742
+ }
743
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
744
+ interface LiquidityResponse {
745
+ canonicalItemId: string;
746
+ marketHashName: string;
747
+ liquidityBadge: LiquidityBadge;
748
+ confidence: LiquidityConfidence;
749
+ coverage: LiquidityCoverage;
750
+ medianTimeToSellHours: number | null;
751
+ p90TimeToSellHours: number | null;
752
+ bestMarketToList: string | null;
753
+ salesPerDay: number | null;
754
+ activeListings: number | null;
755
+ referenceAskUsdCents: Cents | null;
756
+ marketWideSalesPerDay: number | null;
757
+ marketWideListings: number | null;
758
+ marketsWithSales: number;
759
+ marketsWithDepth: number;
760
+ /** Whole-market saturation (hours), NOT a per-listing estimate. */
761
+ marketWideMedianTimeToSellHours: number | null;
762
+ marketWideP90TimeToSellHours: number | null;
763
+ metrics: LiquidityMarketMetric[];
764
+ /** Data-quality flags, e.g. `sales_data_stale:marketcsgo`. */
765
+ notes: string[];
766
+ calculatedAt: IsoDateString;
767
+ }
768
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
769
+ interface LiquiditySummaryResponse {
770
+ marketHashName: string;
771
+ liquidityBadge: LiquidityBadge;
772
+ liquidity: LiquidityLabel;
773
+ /** Human time-to-sell, e.g. `"2 - 6 hours"` (`"No recent sales"` when untraded). */
774
+ estimatedSaleTime: string;
775
+ confidence: LiquidityConfidence;
776
+ /** 0-100, higher sells faster; null when untraded. */
777
+ score: number | null;
778
+ bestMarketToList: string | null;
779
+ calculatedAt: IsoDateString;
780
+ }
781
+ /** Request body for `POST /v1/liquidity/batch` (1-100 names). */
782
+ interface LiquidityBatchBody {
783
+ marketHashNames: string[];
784
+ market?: SupportedLiquidityMarket;
785
+ }
786
+ /** `POST /v1/liquidity/batch` — up to 100 full results in one call. */
787
+ interface LiquidityBatchResponse {
788
+ results: LiquidityResponse[];
789
+ notFound: string[];
790
+ requested: number;
791
+ calculatedAt: IsoDateString;
792
+ }
793
+ /** Bulk-map entry. `market_hash_name` and `estimated_sale_time` are snake_case on the wire. */
794
+ interface LiquidityBulkItem {
795
+ market_hash_name: string;
796
+ liquidity: LiquidityLabel;
797
+ estimated_sale_time: string;
798
+ liquidityBadge: LiquidityBadge;
799
+ confidence: LiquidityConfidence;
800
+ score: number | null;
801
+ bestMarketToList: string | null;
802
+ /** Reserved; always `{}` for now. */
803
+ variants: Record<string, never>;
804
+ }
805
+ /** `GET /v1/liquidity/items/manifest` — cheap change-probe; compare `version` before refetching. */
806
+ interface LiquidityBulkManifest {
807
+ /** Snapshot version / ETag. */
808
+ version: string;
809
+ calculatedAt: IsoDateString;
810
+ /** Recompute cadence as an ISO-8601 duration, e.g. `"PT10M"`. */
811
+ cadence: string;
812
+ markets: string[];
813
+ itemCount: number;
814
+ }
815
+ /** `GET /v1/liquidity/items` — Enterprise: whole-catalog map keyed by market_hash_name. */
816
+ interface LiquidityBulkResponse extends LiquidityBulkManifest {
817
+ items: Record<string, LiquidityBulkItem>;
818
+ }
819
+
820
+ /**
821
+ * Liquidity & expected time-to-sell, from cross-market order-book depth and
822
+ * sales velocity. The single + summary + batch endpoints are Pro; the bulk map
823
+ * + manifest are Enterprise.
824
+ */
825
+ declare class LiquidityResource extends BaseResource {
826
+ /** `GET /v1/liquidity/:marketHashName` — full liquidity model for one item. */
827
+ get(marketHashName: string, params?: LiquidityParams, options?: RequestOptions): Promise<LiquidityResponse>;
828
+ /** `GET /v1/liquidity/summary/:marketHashName` — slim badge-only projection. */
829
+ summary(marketHashName: string, params?: LiquidityParams, options?: RequestOptions): Promise<LiquiditySummaryResponse>;
830
+ /** `POST /v1/liquidity/batch` — score up to 100 items in one call. */
831
+ batch(body: LiquidityBatchBody, options?: RequestOptions): Promise<LiquidityBatchResponse>;
832
+ /**
833
+ * `GET /v1/liquidity/items` — Enterprise: the whole-catalog liquidity map,
834
+ * rematerialized every ~10 minutes. Poll {@link manifest} and compare
835
+ * `version` before refetching this heavier payload.
836
+ */
837
+ bulk(options?: RequestOptions): Promise<LiquidityBulkResponse>;
838
+ /**
839
+ * `GET /v1/liquidity/items/manifest` — Enterprise: a cheap change-probe for
840
+ * the {@link bulk} map (`version`, `calculatedAt`, `cadence`, `markets`,
841
+ * `itemCount`). Refetch the bulk map only when `version` changes.
842
+ */
843
+ manifest(options?: RequestOptions): Promise<LiquidityBulkManifest>;
844
+ }
845
+
668
846
  interface MarketAnalyticsParams {
669
847
  markets?: KnownMarket[];
670
848
  /** Historical analytics window in hours (1–168, default 24). */
@@ -705,6 +883,16 @@ declare class MarketAnalyticsResource extends BaseResource {
705
883
  get(marketHashName: string, params?: MarketAnalyticsParams, options?: RequestOptions): Promise<MarketAnalyticsResponse>;
706
884
  }
707
885
 
886
+ /** Market registry health & integration status. */
887
+ declare class MarketsResource extends BaseResource {
888
+ /**
889
+ * `GET /v1/markets/health` — per-market ingest status, last event time, and
890
+ * listing counts for every integrated market. Returns a plain array of
891
+ * {@link import("../types/markets").MarketHealthRow}.
892
+ */
893
+ health(options?: RequestOptions): Promise<MarketHealthResponse>;
894
+ }
895
+
708
896
  interface NbboParams {
709
897
  /** Canonical item id. Provide this or `marketHashName`. */
710
898
  id?: string;
@@ -884,6 +1072,8 @@ declare class SkinpricerClient {
884
1072
  readonly marketAnalytics: MarketAnalyticsResource;
885
1073
  readonly attributePrices: AttributePricesResource;
886
1074
  readonly buff163: Buff163Resource;
1075
+ readonly liquidity: LiquidityResource;
1076
+ readonly markets: MarketsResource;
887
1077
  private readonly httpClient;
888
1078
  constructor(config: ClientConfig);
889
1079
  }
@@ -968,6 +1158,6 @@ declare function chunk<T>(items: readonly T[], size: number): T[][];
968
1158
  /** Runs `fn` over `items` with at most `limit` concurrent executions, keeping order. */
969
1159
  declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
970
1160
 
971
- declare const VERSION = "0.1.0";
1161
+ declare const VERSION = "0.3.0";
972
1162
 
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 };
1163
+ 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 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 LiquidityBadge, type LiquidityBatchBody, type LiquidityBatchResponse, type LiquidityBulkItem, type LiquidityBulkManifest, type LiquidityBulkResponse, type LiquidityConfidence, type LiquidityCoverage, type LiquidityLabel, 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, 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, type SalesHistoryWindow, ServerError, SkinpricerClient, SkinpricerError, type SkinpricerErrorOptions, StatusResource, type SupportedLiquidityMarket, TimeoutError, VERSION, ValidationError, type ValidationErrorOptions, type WithMeta, centsToUsd, chunk, errorFromResponse, formatUsd, getMeta, mapWithConcurrency, parseIsoDate, resolveConfig };