skewtape 0.1.5 → 0.1.7
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/README.md +4 -13
- package/dist/cjs/client.d.ts +37 -6
- package/dist/cjs/client.js +42 -13
- package/dist/cjs/fees.d.ts +4 -2
- package/dist/cjs/fees.js +48 -8
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -5
- package/dist/cjs/kalshi.d.ts +3 -3
- package/dist/cjs/kalshi.js +4 -4
- package/dist/cjs/paginated.d.ts +1 -1
- package/dist/cjs/paginated.js +1 -1
- package/dist/cjs/quote-math.js +4 -1
- package/dist/cjs/quote.d.ts +1 -12
- package/dist/cjs/quote.js +1 -16
- package/dist/cjs/route.d.ts +6 -65
- package/dist/cjs/route.js +3 -120
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client.d.ts +37 -6
- package/dist/esm/client.js +42 -13
- package/dist/esm/fees.d.ts +4 -2
- package/dist/esm/fees.js +48 -8
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/kalshi.d.ts +3 -3
- package/dist/esm/kalshi.js +4 -4
- package/dist/esm/paginated.d.ts +1 -1
- package/dist/esm/paginated.js +1 -1
- package/dist/esm/quote-math.js +4 -1
- package/dist/esm/quote.d.ts +1 -12
- package/dist/esm/quote.js +0 -14
- package/dist/esm/route.d.ts +6 -65
- package/dist/esm/route.js +2 -117
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +72 -21
- package/src/fees.ts +47 -7
- package/src/generated/schema.d.ts +388 -34
- package/src/index.ts +0 -4
- package/src/kalshi.ts +4 -4
- package/src/paginated.ts +1 -1
- package/src/quote-math.ts +3 -1
- package/src/quote.ts +1 -16
- package/src/route.ts +7 -147
- package/src/version.ts +1 -1
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export interface paths {
|
|
7
|
+
"/v1/availability": {
|
|
8
|
+
parameters: {
|
|
9
|
+
query?: never;
|
|
10
|
+
header?: never;
|
|
11
|
+
path?: never;
|
|
12
|
+
cookie?: never;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What each venue serves, by country
|
|
16
|
+
* @description The data policy in force, as the availability page shows it. The
|
|
17
|
+
* response lists the live venues and the features the policy decides:
|
|
18
|
+
* read_data for the REST API and the MCP data tools, live_data for the
|
|
19
|
+
* live feed, download_bundle for the files. It also lists the rules
|
|
20
|
+
* that change what a request gets. For a venue and a feature, take the
|
|
21
|
+
* rule for the request's country first, then the "*" rule, then the
|
|
22
|
+
* default. No API key is needed, and the answer can be cached: it holds
|
|
23
|
+
* no market data. Placing orders is not in it, since Skewtape never
|
|
24
|
+
* routes an order.
|
|
25
|
+
*/
|
|
26
|
+
get: operations["getAvailability"];
|
|
27
|
+
put?: never;
|
|
28
|
+
post?: never;
|
|
29
|
+
delete?: never;
|
|
30
|
+
options?: never;
|
|
31
|
+
head?: never;
|
|
32
|
+
patch?: never;
|
|
33
|
+
trace?: never;
|
|
34
|
+
};
|
|
7
35
|
"/v1/bundles": {
|
|
8
36
|
parameters: {
|
|
9
37
|
query?: never;
|
|
@@ -60,7 +88,10 @@ export interface paths {
|
|
|
60
88
|
* data policy blocks for the request contribute no rows. A missing or
|
|
61
89
|
* hidden event_id is 404. Free and History plans get Polymarket daily
|
|
62
90
|
* candles (res=1d) only; other venues, and the 1m and 1h sizes, need
|
|
63
|
-
* Builder or above.
|
|
91
|
+
* Builder or above (403 forbidden_plan). With venue, alone or with
|
|
92
|
+
* market_id, a venue the data policy blocks for the request is 403
|
|
93
|
+
* blocked, with error.block_reason_code saying why; the plan is checked
|
|
94
|
+
* first, so a venue or size outside the plan never shows the policy.
|
|
64
95
|
*/
|
|
65
96
|
get: operations["listCandles"];
|
|
66
97
|
put?: never;
|
|
@@ -245,7 +276,11 @@ export interface paths {
|
|
|
245
276
|
* event_id resolves an approved matched event the caller can see and
|
|
246
277
|
* reads its active members only; members whose venue the data policy
|
|
247
278
|
* blocks for the request contribute no rows. A missing or hidden
|
|
248
|
-
* event_id is 404. Free and History plans do not include fills
|
|
279
|
+
* event_id is 404. Free and History plans do not include fills: 403
|
|
280
|
+
* forbidden_plan, whatever the venue. With venue, alone or with
|
|
281
|
+
* market_id, a venue the data policy blocks for the request is 403
|
|
282
|
+
* blocked, with error.block_reason_code saying why; the plan is checked
|
|
283
|
+
* first, so a plan without fills never learns the policy.
|
|
249
284
|
*/
|
|
250
285
|
get: operations["listFills"];
|
|
251
286
|
put?: never;
|
|
@@ -265,10 +300,25 @@ export interface paths {
|
|
|
265
300
|
};
|
|
266
301
|
/**
|
|
267
302
|
* List markets
|
|
268
|
-
* @description Markets in (venue, market_id) order
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
303
|
+
* @description Markets in (venue, market_id) order, or by close_at, updated_at or
|
|
304
|
+
* first_seen_at with sort, ties broken by (venue, market_id). venue and
|
|
305
|
+
* market_id compare byte by byte (their UTF-8 bytes, so "B" comes before
|
|
306
|
+
* "a"), in the order and as tie-breakers alike. order desc reverses the
|
|
307
|
+
* sort and its tie-breakers. A market with no close_at
|
|
308
|
+
* comes after every market that has one, in both orders, and no
|
|
309
|
+
* close_after or close_before range matches it. Filters combine: a
|
|
310
|
+
* market is listed when it passes every filter given.
|
|
311
|
+
*
|
|
312
|
+
* A field the data policy withholds for this request is null, with
|
|
313
|
+
* blocked true and block_reason_code saying why. A filter on such a
|
|
314
|
+
* field (q, category, venue_event_id) matches none of that venue's
|
|
315
|
+
* markets, so it never tells what the field holds.
|
|
316
|
+
*
|
|
317
|
+
* Each database query of a list read is stopped past 10 seconds, and
|
|
318
|
+
* the read answered 400 invalid_request; error.message names the filter
|
|
319
|
+
* that narrows it. The bound is per query, not per page: one page can
|
|
320
|
+
* take more than one query (the rows with no sort value are read after
|
|
321
|
+
* the others).
|
|
272
322
|
*/
|
|
273
323
|
get: operations["listMarkets"];
|
|
274
324
|
put?: never;
|
|
@@ -310,10 +360,14 @@ export interface paths {
|
|
|
310
360
|
};
|
|
311
361
|
/**
|
|
312
362
|
* List matched events
|
|
313
|
-
* @description Matched events in event_id order
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
363
|
+
* @description Matched events in event_id order, or by published_at with sort, ties
|
|
364
|
+
* broken by event_id; event_id compares byte by byte. order desc
|
|
365
|
+
* reverses the sort and its tie-breaker.
|
|
366
|
+
* An event with no published_at comes after every event that has one,
|
|
367
|
+
* in both orders. Filters: min_confidence, resolution_equal, venue (any
|
|
368
|
+
* active member), status. Free and History keep events whose resolves_at
|
|
369
|
+
* is null or at most 30 days in the past. Plans see status approved
|
|
370
|
+
* only.
|
|
317
371
|
*/
|
|
318
372
|
get: operations["listMatchedEvents"];
|
|
319
373
|
put?: never;
|
|
@@ -355,7 +409,7 @@ export interface paths {
|
|
|
355
409
|
/**
|
|
356
410
|
* List two-member matched events
|
|
357
411
|
* @description Matched events with exactly two active members, in the pair shape.
|
|
358
|
-
* The same filters and
|
|
412
|
+
* The same filters, sorts and data as /v1/matched_events.
|
|
359
413
|
*/
|
|
360
414
|
get: operations["listPairs"];
|
|
361
415
|
put?: never;
|
|
@@ -425,8 +479,19 @@ export interface paths {
|
|
|
425
479
|
};
|
|
426
480
|
/**
|
|
427
481
|
* List resolution events
|
|
428
|
-
* @description Resolution events in (venue, market_id, seq) order
|
|
429
|
-
*
|
|
482
|
+
* @description Resolution events in (venue, market_id, seq) order, or by resolved_at
|
|
483
|
+
* with sort, ties broken by (venue, market_id, seq). venue and market_id
|
|
484
|
+
* compare byte by byte (their UTF-8 bytes, so "B" comes before "a"), seq
|
|
485
|
+
* as a number. order desc reverses the sort and its tie-breakers. An event with no resolved_at comes after
|
|
486
|
+
* every event that has one, in both orders, and no resolved_after or
|
|
487
|
+
* resolved_before range matches it. Filters combine: an event is listed
|
|
488
|
+
* when it passes every filter given.
|
|
489
|
+
*
|
|
490
|
+
* Each database query of a list read is stopped past 10 seconds, and
|
|
491
|
+
* the read answered 400 invalid_request; error.message names the filter
|
|
492
|
+
* that narrows it. The bound is per query, not per page: one page can
|
|
493
|
+
* take more than one query (the rows with no sort value are read after
|
|
494
|
+
* the others).
|
|
430
495
|
*/
|
|
431
496
|
get: operations["listResolutions"];
|
|
432
497
|
put?: never;
|
|
@@ -449,7 +514,9 @@ export interface paths {
|
|
|
449
514
|
* @description Every venue Skewtape serves: its key, whether it is in beta, notices
|
|
450
515
|
* about its data (flags), the rights and earliest history of each kind
|
|
451
516
|
* of data, and how many of its closed markets have a final resolution.
|
|
452
|
-
* Not paged.
|
|
517
|
+
* Not paged. `planned` lists the venues Skewtape plans to serve and does
|
|
518
|
+
* not serve yet, with their identity only; each moves to `data` once
|
|
519
|
+
* Skewtape serves it.
|
|
453
520
|
*/
|
|
454
521
|
get: operations["listVenues"];
|
|
455
522
|
put?: never;
|
|
@@ -464,6 +531,71 @@ export interface paths {
|
|
|
464
531
|
export type webhooks = Record<string, never>;
|
|
465
532
|
export interface components {
|
|
466
533
|
schemas: {
|
|
534
|
+
/**
|
|
535
|
+
* @description The data policy in force. A rule's countries are "*" for every
|
|
536
|
+
* country, or ISO 3166-1 alpha-2 codes. For a venue and a feature,
|
|
537
|
+
* the rule for the request's country applies first, then the "*" rule,
|
|
538
|
+
* then default. A venue with no rule is served whole.
|
|
539
|
+
*/
|
|
540
|
+
Availability: {
|
|
541
|
+
/**
|
|
542
|
+
* @description The UTC date the answer is for (YYYY-MM-DD).
|
|
543
|
+
* @example 2026-11-21
|
|
544
|
+
*/
|
|
545
|
+
as_of: string;
|
|
546
|
+
/**
|
|
547
|
+
* @description The effect where no rule applies.
|
|
548
|
+
* @enum {string}
|
|
549
|
+
*/
|
|
550
|
+
default: "allow";
|
|
551
|
+
features: components["schemas"]["AvailabilityFeature"][];
|
|
552
|
+
/**
|
|
553
|
+
* @description The policy's name. embedded is production's, open staging's (no rule).
|
|
554
|
+
* @example embedded
|
|
555
|
+
*/
|
|
556
|
+
policy: string;
|
|
557
|
+
/** @description The sha256 of the policy document, so two answers from one document compare equal. */
|
|
558
|
+
policy_sha256: string;
|
|
559
|
+
/** @description The rules that change what a request gets. Empty when every live venue is served whole. */
|
|
560
|
+
rules: components["schemas"]["AvailabilityRule"][];
|
|
561
|
+
/** @description The live venues, by slug, with the names the pages write. */
|
|
562
|
+
venues: components["schemas"]["AvailabilityVenue"][];
|
|
563
|
+
/**
|
|
564
|
+
* @description Build version (git SHA in deployed images, "dev" locally).
|
|
565
|
+
* @example dev
|
|
566
|
+
*/
|
|
567
|
+
version: string;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* @description read_data is the REST API and the MCP data tools, live_data the live feed, download_bundle the files.
|
|
571
|
+
* @enum {string}
|
|
572
|
+
*/
|
|
573
|
+
AvailabilityFeature: "read_data" | "live_data" | "download_bundle";
|
|
574
|
+
AvailabilityRule: {
|
|
575
|
+
/** @description "*" for every country, else the upper-case ISO 3166-1 alpha-2 codes the rule applies to. */
|
|
576
|
+
countries: "*" | string[];
|
|
577
|
+
/**
|
|
578
|
+
* @description block leaves the venue's data out; mask nulls mask_fields; allow, on a country rule, serves what the "*" rule would not.
|
|
579
|
+
* @enum {string}
|
|
580
|
+
*/
|
|
581
|
+
effect: "allow" | "block" | "mask";
|
|
582
|
+
feature: components["schemas"]["AvailabilityFeature"];
|
|
583
|
+
/** @description The fields that are null, on a mask. */
|
|
584
|
+
mask_fields?: string[];
|
|
585
|
+
/** @description Why, on a block or mask (licence_undecided, licence_derived_only or geo_policy); absent on an allow. */
|
|
586
|
+
reason_code?: string;
|
|
587
|
+
/** @example polymarket */
|
|
588
|
+
venue: string;
|
|
589
|
+
};
|
|
590
|
+
AvailabilityVenue: {
|
|
591
|
+
/** @example Polymarket */
|
|
592
|
+
display_name: string;
|
|
593
|
+
/**
|
|
594
|
+
* @description The venue key the other routes take.
|
|
595
|
+
* @example polymarket
|
|
596
|
+
*/
|
|
597
|
+
slug: string;
|
|
598
|
+
};
|
|
467
599
|
Bundle: {
|
|
468
600
|
description: string;
|
|
469
601
|
/** @description Files inside the bundle; path is passed to POST /v1/downloads/{bundle}/url. */
|
|
@@ -739,6 +871,12 @@ export interface components {
|
|
|
739
871
|
* @example false
|
|
740
872
|
*/
|
|
741
873
|
blocked: boolean;
|
|
874
|
+
/**
|
|
875
|
+
* Format: int64
|
|
876
|
+
* @description The chain the trade was published on, as its EIP-155 chain id: 137 Polygon, 1 Ethereum, 8453 Base, 56 BNB Smart Chain, 2741 Abstract, 59144 Linea; block_number is that chain's. Null when the venue has no chain. Rows written before 1.4.0 read as their venue's chain.
|
|
877
|
+
* @example 137
|
|
878
|
+
*/
|
|
879
|
+
chain_id?: number | null;
|
|
742
880
|
/**
|
|
743
881
|
* @description Venue contract version such as v1, v2 or v3; for polymarket the V1 exchanges, the CTF V2 exchanges and ExchangeV3.
|
|
744
882
|
* @example v2
|
|
@@ -877,26 +1015,34 @@ export interface components {
|
|
|
877
1015
|
close_at?: string | null;
|
|
878
1016
|
/**
|
|
879
1017
|
* @description The fees.category row that prices this market's taker fee (schema
|
|
880
|
-
* 1.3.0), in force while the market was open
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
* the
|
|
885
|
-
* (quadratic:1),
|
|
886
|
-
*
|
|
887
|
-
* the
|
|
1018
|
+
* 1.3.0), in force while the market was open. For Polymarket, the
|
|
1019
|
+
* row with the terms the venue states for the market; when several
|
|
1020
|
+
* rows have the same terms, their names, sorted and joined by a
|
|
1021
|
+
* vertical bar (finance|mentions|politics|tech), any of which gives
|
|
1022
|
+
* the fee; null when no row has those terms. For Kalshi, the series'
|
|
1023
|
+
* fee_type and fee_multiplier as fee_type:multiplier (quadratic:1),
|
|
1024
|
+
* moved by a scheduled change only on the markets open at its time.
|
|
1025
|
+
* Null until the venue has told us, and null when the data policy
|
|
1026
|
+
* withholds it.
|
|
888
1027
|
* @example quadratic:1
|
|
889
1028
|
*/
|
|
890
1029
|
fee_category?: string | null;
|
|
891
1030
|
/**
|
|
892
1031
|
* Format: date-time
|
|
893
|
-
* @description Time
|
|
1032
|
+
* @description Time Skewtape first stored this market, UTC: what
|
|
1033
|
+
* sort=first_seen_at orders by.
|
|
1034
|
+
* @example 2026-11-01T09:12:03Z
|
|
1035
|
+
*/
|
|
1036
|
+
first_seen_at: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* Format: date-time
|
|
1039
|
+
* @description The first fill Skewtape holds for the market, UTC, not the venue's own record. Null for a market with no fill, and for every market of a venue whose fills Skewtape has not indexed yet.
|
|
894
1040
|
* @example 2026-11-01T09:14:52Z
|
|
895
1041
|
*/
|
|
896
1042
|
first_trade_at?: string | null;
|
|
897
1043
|
/**
|
|
898
1044
|
* Format: date-time
|
|
899
|
-
* @description
|
|
1045
|
+
* @description The latest fill Skewtape holds for the market, UTC, not the venue's own record. Null for a market with no fill, and for every market of a venue whose fills Skewtape has not indexed yet.
|
|
900
1046
|
* @example 2026-11-03T09:58:41Z
|
|
901
1047
|
*/
|
|
902
1048
|
last_trade_at?: string | null;
|
|
@@ -1002,6 +1148,16 @@ export interface components {
|
|
|
1002
1148
|
* @example judge_v1/policy_1
|
|
1003
1149
|
*/
|
|
1004
1150
|
method_version: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* Format: date-time
|
|
1153
|
+
* @description Time this matched event was first published (first approved), UTC. It
|
|
1154
|
+
* does not move when the event is reviewed again. Null for an event
|
|
1155
|
+
* published before schema 1.5.0 with no publishing review on record,
|
|
1156
|
+
* until it is sent to rereview and approved again: it then takes the
|
|
1157
|
+
* time of that approval.
|
|
1158
|
+
* @example 2026-11-02T03:12:44Z
|
|
1159
|
+
*/
|
|
1160
|
+
published_at?: string | null;
|
|
1005
1161
|
/**
|
|
1006
1162
|
* @description Canonical question this matched event stands for, in the words of a member whose text the data policy ships for this request. With no such member it reads as the first active member's venue:market_id, for example polymarket:0xabc.
|
|
1007
1163
|
* @example Samsung Lions vs KT Wiz: First Inning Run?
|
|
@@ -1031,8 +1187,16 @@ export interface components {
|
|
|
1031
1187
|
* @example auto:1
|
|
1032
1188
|
*/
|
|
1033
1189
|
reviewer: string;
|
|
1034
|
-
/**
|
|
1035
|
-
|
|
1190
|
+
/**
|
|
1191
|
+
* @description The matcher's notes on this event: for each link between its
|
|
1192
|
+
* members, the code comparison's result and flags; the judge's
|
|
1193
|
+
* verdict, confidence, the differences it found and its rule note;
|
|
1194
|
+
* and, when the second model ran, its verdict and confidence.
|
|
1195
|
+
* Written by the matcher's models and checked by its code, never a
|
|
1196
|
+
* person's review. Present on Pro and above; absent on the other
|
|
1197
|
+
* plans, which do not include the notes.
|
|
1198
|
+
*/
|
|
1199
|
+
reviewer_notes?: string;
|
|
1036
1200
|
/**
|
|
1037
1201
|
* @description Plain-words note on rule differences. Required when resolution_equal is false.
|
|
1038
1202
|
* @example Both settle Yes if either team scores in the first inning of the game scheduled for 3 Nov 2026.
|
|
@@ -1163,6 +1327,16 @@ export interface components {
|
|
|
1163
1327
|
* @example st_evt_00412
|
|
1164
1328
|
*/
|
|
1165
1329
|
pair_id: string;
|
|
1330
|
+
/**
|
|
1331
|
+
* Format: date-time
|
|
1332
|
+
* @description Time this matched event was first published (first approved), UTC. It
|
|
1333
|
+
* does not move when the event is reviewed again. Null for an event
|
|
1334
|
+
* published before schema 1.5.0 with no publishing review on record,
|
|
1335
|
+
* until it is sent to rereview and approved again: it then takes the
|
|
1336
|
+
* time of that approval.
|
|
1337
|
+
* @example 2026-11-02T03:12:44Z
|
|
1338
|
+
*/
|
|
1339
|
+
published_at?: string | null;
|
|
1166
1340
|
/**
|
|
1167
1341
|
* @description True when member venues would settle the same question the same way.
|
|
1168
1342
|
* @example true
|
|
@@ -1179,8 +1353,16 @@ export interface components {
|
|
|
1179
1353
|
* @example auto:1
|
|
1180
1354
|
*/
|
|
1181
1355
|
reviewer: string;
|
|
1182
|
-
/**
|
|
1183
|
-
|
|
1356
|
+
/**
|
|
1357
|
+
* @description The matcher's notes on this event: for each link between its
|
|
1358
|
+
* members, the code comparison's result and flags; the judge's
|
|
1359
|
+
* verdict, confidence, the differences it found and its rule note;
|
|
1360
|
+
* and, when the second model ran, its verdict and confidence.
|
|
1361
|
+
* Written by the matcher's models and checked by its code, never a
|
|
1362
|
+
* person's review. Present on Pro and above; absent on the other
|
|
1363
|
+
* plans, which do not include the notes.
|
|
1364
|
+
*/
|
|
1365
|
+
reviewer_notes?: string;
|
|
1184
1366
|
/**
|
|
1185
1367
|
* @description Plain-words note on rule differences. Required when resolution_equal is false.
|
|
1186
1368
|
* @example Both settle Yes if either team scores in the first inning of the game scheduled for 3 Nov 2026.
|
|
@@ -1248,6 +1430,44 @@ export interface components {
|
|
|
1248
1430
|
* @enum {string}
|
|
1249
1431
|
*/
|
|
1250
1432
|
PlanId: "free" | "history" | "builder" | "pro";
|
|
1433
|
+
PlannedVenue: {
|
|
1434
|
+
/**
|
|
1435
|
+
* @description The country it is based in, or the chain it runs on.
|
|
1436
|
+
* @example US
|
|
1437
|
+
*/
|
|
1438
|
+
country_or_chain: string;
|
|
1439
|
+
/**
|
|
1440
|
+
* @description The venue's own name for itself.
|
|
1441
|
+
* @example CME event contracts
|
|
1442
|
+
*/
|
|
1443
|
+
display_name: string;
|
|
1444
|
+
/**
|
|
1445
|
+
* @description The venue's own website.
|
|
1446
|
+
* @example https://www.cmegroup.com/markets/prediction-markets/
|
|
1447
|
+
*/
|
|
1448
|
+
homepage_url: string;
|
|
1449
|
+
/**
|
|
1450
|
+
* @description What kind of venue it is: regulated-us, regulated-intl, on-chain or offshore.
|
|
1451
|
+
* @example regulated-us
|
|
1452
|
+
*/
|
|
1453
|
+
kind: string;
|
|
1454
|
+
/**
|
|
1455
|
+
* @description One line saying what the venue is, from public sources.
|
|
1456
|
+
* @example Event contracts listed on CME Group.
|
|
1457
|
+
*/
|
|
1458
|
+
public_description: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* @description Who regulates it, or "none (on-chain)" for a venue no regulator licenses.
|
|
1461
|
+
* @example CFTC
|
|
1462
|
+
*/
|
|
1463
|
+
regulator: string;
|
|
1464
|
+
/**
|
|
1465
|
+
* @description The key the venue will have once it is served. It is not served
|
|
1466
|
+
* today: a data endpoint treats it as it treats any unknown venue.
|
|
1467
|
+
* @example cme_events
|
|
1468
|
+
*/
|
|
1469
|
+
slug: string;
|
|
1470
|
+
};
|
|
1251
1471
|
QuoteContext: {
|
|
1252
1472
|
/**
|
|
1253
1473
|
* Format: date-time
|
|
@@ -1299,8 +1519,9 @@ export interface components {
|
|
|
1299
1519
|
/** @description The fee row that prices the member's market at as_of; null unless fee_status is ok. */
|
|
1300
1520
|
fee: components["schemas"]["Fee"] | null;
|
|
1301
1521
|
/**
|
|
1302
|
-
* @description The fee category that prices the member's market (markets.fee_category
|
|
1303
|
-
*
|
|
1522
|
+
* @description The fee category that prices the member's market (markets.fee_category,
|
|
1523
|
+
* which can join several names on Polymarket); null when the market
|
|
1524
|
+
* has none or the data policy withholds it.
|
|
1304
1525
|
* @example quadratic:1
|
|
1305
1526
|
*/
|
|
1306
1527
|
fee_category: string | null;
|
|
@@ -1517,6 +1738,13 @@ export interface components {
|
|
|
1517
1738
|
* @example embedded
|
|
1518
1739
|
*/
|
|
1519
1740
|
geoblock_policy: string;
|
|
1741
|
+
/**
|
|
1742
|
+
* @description Venues Skewtape plans to serve and does not serve yet, listed
|
|
1743
|
+
* alongside `data`, which holds only the venues it serves. Identity
|
|
1744
|
+
* fields only: no rights, history or coverage. Empty when none is
|
|
1745
|
+
* planned.
|
|
1746
|
+
*/
|
|
1747
|
+
planned?: components["schemas"]["PlannedVenue"][];
|
|
1520
1748
|
};
|
|
1521
1749
|
};
|
|
1522
1750
|
responses: {
|
|
@@ -1636,9 +1864,18 @@ export interface components {
|
|
|
1636
1864
|
* to the next; the cursor does not depend on it.
|
|
1637
1865
|
*/
|
|
1638
1866
|
Limit: number;
|
|
1867
|
+
/**
|
|
1868
|
+
* @description asc (the default) or desc, for the sort and its tie-breakers alike.
|
|
1869
|
+
* Rows with no value for the sort come last in both orders.
|
|
1870
|
+
*/
|
|
1871
|
+
Order: "asc" | "desc";
|
|
1639
1872
|
};
|
|
1640
1873
|
requestBodies: never;
|
|
1641
1874
|
headers: {
|
|
1875
|
+
/** @description How long a shared cache may keep the answer (public, max-age in seconds). */
|
|
1876
|
+
"Cache-Control": string;
|
|
1877
|
+
/** @description The answer's entity tag, for If-None-Match. */
|
|
1878
|
+
ETag: string;
|
|
1642
1879
|
/** @description Seconds to wait before retrying (429 responses). */
|
|
1643
1880
|
"Retry-After": number;
|
|
1644
1881
|
/** @description Requests allowed in the current window for this caller. */
|
|
@@ -1652,6 +1889,43 @@ export interface components {
|
|
|
1652
1889
|
}
|
|
1653
1890
|
export type $defs = Record<string, never>;
|
|
1654
1891
|
export interface operations {
|
|
1892
|
+
getAvailability: {
|
|
1893
|
+
parameters: {
|
|
1894
|
+
query?: never;
|
|
1895
|
+
header?: {
|
|
1896
|
+
/** @description The ETag of an earlier answer; 304 when the answer has not changed since. */
|
|
1897
|
+
"If-None-Match"?: string;
|
|
1898
|
+
};
|
|
1899
|
+
path?: never;
|
|
1900
|
+
cookie?: never;
|
|
1901
|
+
};
|
|
1902
|
+
requestBody?: never;
|
|
1903
|
+
responses: {
|
|
1904
|
+
/** @description The data policy in force */
|
|
1905
|
+
200: {
|
|
1906
|
+
headers: {
|
|
1907
|
+
"Cache-Control": components["headers"]["Cache-Control"];
|
|
1908
|
+
ETag: components["headers"]["ETag"];
|
|
1909
|
+
"X-Request-Id": components["headers"]["X-Request-Id"];
|
|
1910
|
+
[name: string]: unknown;
|
|
1911
|
+
};
|
|
1912
|
+
content: {
|
|
1913
|
+
"application/json": components["schemas"]["Availability"];
|
|
1914
|
+
};
|
|
1915
|
+
};
|
|
1916
|
+
/** @description The answer has not changed since the ETag sent in If-None-Match. */
|
|
1917
|
+
304: {
|
|
1918
|
+
headers: {
|
|
1919
|
+
"Cache-Control": components["headers"]["Cache-Control"];
|
|
1920
|
+
ETag: components["headers"]["ETag"];
|
|
1921
|
+
"X-Request-Id": components["headers"]["X-Request-Id"];
|
|
1922
|
+
[name: string]: unknown;
|
|
1923
|
+
};
|
|
1924
|
+
content?: never;
|
|
1925
|
+
};
|
|
1926
|
+
500: components["responses"]["Internal"];
|
|
1927
|
+
};
|
|
1928
|
+
};
|
|
1655
1929
|
listBundles: {
|
|
1656
1930
|
parameters: {
|
|
1657
1931
|
query?: never;
|
|
@@ -1741,7 +2015,7 @@ export interface operations {
|
|
|
1741
2015
|
};
|
|
1742
2016
|
400: components["responses"]["InvalidRequest"];
|
|
1743
2017
|
401: components["responses"]["Unauthorized"];
|
|
1744
|
-
403: components["responses"]["
|
|
2018
|
+
403: components["responses"]["Forbidden"];
|
|
1745
2019
|
404: components["responses"]["NotFound"];
|
|
1746
2020
|
/**
|
|
1747
2021
|
* @description rate_limited: wait the Retry-After seconds, then send again.
|
|
@@ -1961,7 +2235,7 @@ export interface operations {
|
|
|
1961
2235
|
};
|
|
1962
2236
|
400: components["responses"]["InvalidRequest"];
|
|
1963
2237
|
401: components["responses"]["Unauthorized"];
|
|
1964
|
-
403: components["responses"]["
|
|
2238
|
+
403: components["responses"]["Forbidden"];
|
|
1965
2239
|
404: components["responses"]["NotFound"];
|
|
1966
2240
|
/**
|
|
1967
2241
|
* @description rate_limited: wait the Retry-After seconds, then send again.
|
|
@@ -1991,10 +2265,51 @@ export interface operations {
|
|
|
1991
2265
|
query?: {
|
|
1992
2266
|
/** @description Restrict to one venue key. */
|
|
1993
2267
|
venue?: string;
|
|
1994
|
-
/**
|
|
2268
|
+
/**
|
|
2269
|
+
* @description Restrict to these market ids (at most 100). Requires venue, since
|
|
2270
|
+
* market ids are per venue; without it, 400 invalid_request.
|
|
2271
|
+
*/
|
|
1995
2272
|
market_id?: string[];
|
|
1996
2273
|
/** @description Only markets updated at or after this UTC time. */
|
|
1997
2274
|
updated_since?: string;
|
|
2275
|
+
/** @description Only markets in one of these statuses. */
|
|
2276
|
+
status?: ("open" | "closed" | "resolved" | "voided")[];
|
|
2277
|
+
/**
|
|
2278
|
+
* @description Only markets whose category label is exactly one of these (at most
|
|
2279
|
+
* 20). A venue whose category the data policy withholds for this
|
|
2280
|
+
* request matches none.
|
|
2281
|
+
*/
|
|
2282
|
+
category?: string[];
|
|
2283
|
+
/**
|
|
2284
|
+
* @description Only the markets of this venue event. Requires venue, since event
|
|
2285
|
+
* ids are per venue; without it, 400 invalid_request. A venue whose
|
|
2286
|
+
* venue_event_id the data policy withholds matches none.
|
|
2287
|
+
*/
|
|
2288
|
+
venue_event_id?: string;
|
|
2289
|
+
/** @description Only markets whose close_at is at or after this UTC time. */
|
|
2290
|
+
close_after?: string;
|
|
2291
|
+
/** @description Only markets whose close_at is before this UTC time. */
|
|
2292
|
+
close_before?: string;
|
|
2293
|
+
/**
|
|
2294
|
+
* @description Keyword search on the question, read as English: words (stemmed,
|
|
2295
|
+
* so election also finds elections), "quoted phrases", OR between
|
|
2296
|
+
* two words, and -word to leave a word out. Results come in the sort
|
|
2297
|
+
* order, not ranked by relevance. A venue whose question the data
|
|
2298
|
+
* policy withholds for this request matches none.
|
|
2299
|
+
*/
|
|
2300
|
+
q?: string;
|
|
2301
|
+
/**
|
|
2302
|
+
* @description venue (the default) orders by (venue, market_id). close_at,
|
|
2303
|
+
* updated_at and first_seen_at (the time Skewtape first stored the
|
|
2304
|
+
* market) order by that field. Ties are broken by (venue,
|
|
2305
|
+
* market_id).
|
|
2306
|
+
*/
|
|
2307
|
+
sort?: "venue" | "close_at" | "updated_at" | "first_seen_at";
|
|
2308
|
+
/**
|
|
2309
|
+
* @description asc (the default) or desc, for the sort and its tie-breakers alike.
|
|
2310
|
+
* Rows with no value for the sort come last in both orders.
|
|
2311
|
+
*/
|
|
2312
|
+
order?: components["parameters"]["Order"];
|
|
1998
2313
|
/**
|
|
1999
2314
|
* @description Page size. Default 100, maximum 1,000. It may change from one page
|
|
2000
2315
|
* to the next; the cursor does not depend on it.
|
|
@@ -2113,6 +2428,17 @@ export interface operations {
|
|
|
2113
2428
|
/** @description Restrict to events with an active member on this venue. */
|
|
2114
2429
|
venue?: string;
|
|
2115
2430
|
status?: "approved" | "needs_rereview" | "retired";
|
|
2431
|
+
/**
|
|
2432
|
+
* @description event_id (the default) orders by event_id; published_at orders by
|
|
2433
|
+
* the time the matched event was first published, ties broken by
|
|
2434
|
+
* event_id.
|
|
2435
|
+
*/
|
|
2436
|
+
sort?: "event_id" | "published_at";
|
|
2437
|
+
/**
|
|
2438
|
+
* @description asc (the default) or desc, for the sort and its tie-breakers alike.
|
|
2439
|
+
* Rows with no value for the sort come last in both orders.
|
|
2440
|
+
*/
|
|
2441
|
+
order?: components["parameters"]["Order"];
|
|
2116
2442
|
/**
|
|
2117
2443
|
* @description Page size. Default 100, maximum 1,000. It may change from one page
|
|
2118
2444
|
* to the next; the cursor does not depend on it.
|
|
@@ -2227,6 +2553,17 @@ export interface operations {
|
|
|
2227
2553
|
resolution_equal?: boolean;
|
|
2228
2554
|
venue?: string;
|
|
2229
2555
|
status?: "approved" | "needs_rereview" | "retired";
|
|
2556
|
+
/**
|
|
2557
|
+
* @description event_id (the default) orders by event_id; published_at orders by
|
|
2558
|
+
* the time the matched event was first published, ties broken by
|
|
2559
|
+
* event_id.
|
|
2560
|
+
*/
|
|
2561
|
+
sort?: "event_id" | "published_at";
|
|
2562
|
+
/**
|
|
2563
|
+
* @description asc (the default) or desc, for the sort and its tie-breakers alike.
|
|
2564
|
+
* Rows with no value for the sort come last in both orders.
|
|
2565
|
+
*/
|
|
2566
|
+
order?: components["parameters"]["Order"];
|
|
2230
2567
|
/**
|
|
2231
2568
|
* @description Page size. Default 100, maximum 1,000. It may change from one page
|
|
2232
2569
|
* to the next; the cursor does not depend on it.
|
|
@@ -2389,10 +2726,27 @@ export interface operations {
|
|
|
2389
2726
|
query?: {
|
|
2390
2727
|
/** @description Restrict to one venue, by its key. */
|
|
2391
2728
|
venue?: string;
|
|
2392
|
-
/**
|
|
2729
|
+
/**
|
|
2730
|
+
* @description Restrict to these market ids (at most 100). Requires venue, since
|
|
2731
|
+
* market ids are per venue; without it, 400 invalid_request.
|
|
2732
|
+
*/
|
|
2393
2733
|
market_id?: string[];
|
|
2394
2734
|
/** @description Only events created at or after this UTC time. */
|
|
2395
2735
|
created_since?: string;
|
|
2736
|
+
/** @description Only events whose resolved_at is at or after this UTC time. */
|
|
2737
|
+
resolved_after?: string;
|
|
2738
|
+
/** @description Only events whose resolved_at is before this UTC time. */
|
|
2739
|
+
resolved_before?: string;
|
|
2740
|
+
/**
|
|
2741
|
+
* @description venue (the default) orders by (venue, market_id, seq); resolved_at
|
|
2742
|
+
* orders by resolved_at, ties broken by (venue, market_id, seq).
|
|
2743
|
+
*/
|
|
2744
|
+
sort?: "venue" | "resolved_at";
|
|
2745
|
+
/**
|
|
2746
|
+
* @description asc (the default) or desc, for the sort and its tie-breakers alike.
|
|
2747
|
+
* Rows with no value for the sort come last in both orders.
|
|
2748
|
+
*/
|
|
2749
|
+
order?: components["parameters"]["Order"];
|
|
2396
2750
|
/**
|
|
2397
2751
|
* @description Page size. Default 100, maximum 1,000. It may change from one page
|
|
2398
2752
|
* to the next; the cursor does not depend on it.
|
package/src/index.ts
CHANGED
|
@@ -85,7 +85,6 @@ export {
|
|
|
85
85
|
KALSHI_FRACTION_MICRO,
|
|
86
86
|
quoteFromContext,
|
|
87
87
|
readKalshiBook,
|
|
88
|
-
readKalshiBookThroughDflow,
|
|
89
88
|
readPolymarketBook,
|
|
90
89
|
type BookReader,
|
|
91
90
|
type BookRequest,
|
|
@@ -121,13 +120,10 @@ export {
|
|
|
121
120
|
SkewtapeError,
|
|
122
121
|
} from "./errors.js";
|
|
123
122
|
export {
|
|
124
|
-
DFLOW_TRADING_API,
|
|
125
|
-
DFlowOrderRequest,
|
|
126
123
|
POLYMARKET_EXCHANGES,
|
|
127
124
|
PolymarketOrder,
|
|
128
125
|
RouteError,
|
|
129
126
|
route,
|
|
130
|
-
type DFlowRoute,
|
|
131
127
|
type PolymarketRoute,
|
|
132
128
|
type PolymarketTypedData,
|
|
133
129
|
type RouteInput,
|
package/src/kalshi.ts
CHANGED
|
@@ -36,7 +36,7 @@ import { VERSION } from "./version.js";
|
|
|
36
36
|
/** The production Trade API host Kalshi's docs prefer (api.elections.kalshi.com stays supported; pass baseUrl for it or for the demo host). */
|
|
37
37
|
export const DEFAULT_KALSHI_BASE_URL = "https://external-api.kalshi.com/trade-api/v2";
|
|
38
38
|
/** The matched-event member venues whose market_id is a Kalshi ticker. */
|
|
39
|
-
export const KALSHI_VENUES: ReadonlySet<string> = new Set(["kalshi"
|
|
39
|
+
export const KALSHI_VENUES: ReadonlySet<string> = new Set(["kalshi"]);
|
|
40
40
|
export type KalshiPeriod = "1m" | "1h" | "1d";
|
|
41
41
|
/** Candlestick sizes, as sk.candles names them, to Kalshi's period_interval minutes. */
|
|
42
42
|
export const PERIODS: Readonly<Record<KalshiPeriod, 1 | 60 | 1440>> = { "1m": 1, "1h": 60, "1d": 1440 };
|
|
@@ -323,8 +323,8 @@ export interface KalshiEventLike {
|
|
|
323
323
|
|
|
324
324
|
/**
|
|
325
325
|
* The Kalshi tickers of a matched event: the market_id of its members on
|
|
326
|
-
* kalshi
|
|
327
|
-
*
|
|
326
|
+
* kalshi (the ticker is the id), active ones unless includeInactive, in
|
|
327
|
+
* member order, each once.
|
|
328
328
|
*/
|
|
329
329
|
export function kalshiTickers(event: KalshiEventLike, includeInactive = false): string[] {
|
|
330
330
|
const out: string[] = [];
|
|
@@ -547,7 +547,7 @@ export class Kalshi {
|
|
|
547
547
|
return rows.map((s) => candlestickFromRaw(record(s), minutes));
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
/** The Kalshi tickers of a Skewtape matched event: the market_id of its kalshi
|
|
550
|
+
/** The Kalshi tickers of a Skewtape matched event: the market_id of its kalshi members, active ones unless includeInactive. */
|
|
551
551
|
tickers(event: KalshiEventLike, options: { includeInactive?: boolean } = {}): string[] {
|
|
552
552
|
return kalshiTickers(event, options.includeInactive ?? false);
|
|
553
553
|
}
|