@stxapp/stx-typescript 0.7.0 → 0.8.1
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 +11 -0
- package/dist/{chunk-CDXZOW53.js → chunk-GLUTQFBV.js} +591 -6
- package/dist/chunk-GLUTQFBV.js.map +1 -0
- package/dist/{chunk-ASOLCDBG.cjs → chunk-VLNOUSFW.cjs} +595 -10
- package/dist/chunk-VLNOUSFW.cjs.map +1 -0
- package/dist/{client-CA1d-osT.d.cts → client-CRccD5B2.d.cts} +1000 -109
- package/dist/{client-CA1d-osT.d.ts → client-CRccD5B2.d.ts} +1000 -109
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/oauth.cjs +21 -19
- package/dist/oauth.cjs.map +1 -1
- package/dist/oauth.d.cts +8 -4
- package/dist/oauth.d.ts +8 -4
- package/dist/oauth.js +5 -3
- package/dist/oauth.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ASOLCDBG.cjs.map +0 -1
- package/dist/chunk-CDXZOW53.js.map +0 -1
|
@@ -140,13 +140,182 @@ interface GeoCheckResult {
|
|
|
140
140
|
sentPacket: boolean;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Player stats by sport, as the exchange names them. Use these for
|
|
145
|
+
* autocomplete; the stats a given event accepts are the ones
|
|
146
|
+
* `STX.statsFor()` returns for it.
|
|
147
|
+
*/
|
|
148
|
+
declare const Stats: {
|
|
149
|
+
readonly Baseball: {
|
|
150
|
+
readonly BASES: "BASES";
|
|
151
|
+
readonly BK: "BK";
|
|
152
|
+
readonly DOUBLES: "DOUBLES";
|
|
153
|
+
readonly HITS: "HITS";
|
|
154
|
+
readonly HIT_RUN_RBI: "HIT_RUN_RBI";
|
|
155
|
+
readonly HOMERUN: "HOMERUN";
|
|
156
|
+
readonly PERA: "PERA";
|
|
157
|
+
readonly PHITA: "PHITA";
|
|
158
|
+
readonly PK: "PK";
|
|
159
|
+
readonly POUTS: "POUTS";
|
|
160
|
+
readonly PRUNSALOWED: "PRUNSALOWED";
|
|
161
|
+
readonly PWALKSA: "PWALKSA";
|
|
162
|
+
readonly RBI: "RBI";
|
|
163
|
+
readonly RUNS: "RUNS";
|
|
164
|
+
readonly SINGLES: "SINGLES";
|
|
165
|
+
readonly STOLENBASES: "STOLENBASES";
|
|
166
|
+
readonly TRIPLES: "TRIPLES";
|
|
167
|
+
readonly WALKS: "WALKS";
|
|
168
|
+
};
|
|
169
|
+
readonly Basketball: {
|
|
170
|
+
readonly ASSISTS: "ASSISTS";
|
|
171
|
+
readonly BLOCKS: "BLOCKS";
|
|
172
|
+
readonly POINTS: "POINTS";
|
|
173
|
+
readonly POINTS_ASSISTS: "POINTS_ASSISTS";
|
|
174
|
+
readonly POINTS_REBOUNDS: "POINTS_REBOUNDS";
|
|
175
|
+
readonly POINTS_REBOUNDS_ASSISTS: "POINTS_REBOUNDS_ASSISTS";
|
|
176
|
+
readonly REBOUNDS: "REBOUNDS";
|
|
177
|
+
readonly REBOUNDS_ASSISTS: "REBOUNDS_ASSISTS";
|
|
178
|
+
readonly STEALS: "STEALS";
|
|
179
|
+
readonly STEALS_BLOCKS: "STEALS_BLOCKS";
|
|
180
|
+
readonly THREE_POINTS: "THREE_POINTS";
|
|
181
|
+
readonly TURNOVERS: "TURNOVERS";
|
|
182
|
+
};
|
|
183
|
+
readonly Football: {
|
|
184
|
+
readonly DEF_INTERCEPT: "DEF_INTERCEPT";
|
|
185
|
+
readonly DEF_TD: "DEF_TD";
|
|
186
|
+
readonly FG_MADE: "FG_MADE";
|
|
187
|
+
readonly INTERCEPT: "INTERCEPT";
|
|
188
|
+
readonly PASS_ATT: "PASS_ATT";
|
|
189
|
+
readonly PASS_CMP: "PASS_CMP";
|
|
190
|
+
readonly PASS_RUSH_YDS: "PASS_RUSH_YDS";
|
|
191
|
+
readonly PASS_SACKS: "PASS_SACKS";
|
|
192
|
+
readonly PASS_TD: "PASS_TD";
|
|
193
|
+
readonly PASS_YDS: "PASS_YDS";
|
|
194
|
+
readonly REC: "REC";
|
|
195
|
+
readonly RECV_LONG: "RECV_LONG";
|
|
196
|
+
readonly RECV_TD: "RECV_TD";
|
|
197
|
+
readonly RECV_YDS: "RECV_YDS";
|
|
198
|
+
readonly RUSH_ATT: "RUSH_ATT";
|
|
199
|
+
readonly RUSH_LONG: "RUSH_LONG";
|
|
200
|
+
readonly RUSH_REC_YDS: "RUSH_REC_YDS";
|
|
201
|
+
readonly RUSH_TD: "RUSH_TD";
|
|
202
|
+
readonly RUSH_YDS: "RUSH_YDS";
|
|
203
|
+
readonly SACKS: "SACKS";
|
|
204
|
+
readonly TACKLES_ASSIST: "TACKLES_ASSIST";
|
|
205
|
+
readonly TACKLES_SOLO: "TACKLES_SOLO";
|
|
206
|
+
readonly TACKLES_TOTAL: "TACKLES_TOTAL";
|
|
207
|
+
readonly TD_SCORE: "TD_SCORE";
|
|
208
|
+
};
|
|
209
|
+
readonly Hockey: {
|
|
210
|
+
readonly ASSISTS: "ASSISTS";
|
|
211
|
+
readonly GOALS: "GOALS";
|
|
212
|
+
readonly GOAL_AG: "GOAL_AG";
|
|
213
|
+
readonly GOAL_SO: "GOAL_SO";
|
|
214
|
+
readonly POINTS: "POINTS";
|
|
215
|
+
readonly SAVES: "SAVES";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
type StatValues<T> = T extends Record<string, infer V> ? V : never;
|
|
219
|
+
/** A stat named in `Stats`. */
|
|
220
|
+
type KnownStat = StatValues<(typeof Stats)[keyof typeof Stats]>;
|
|
221
|
+
/** A stat key. Autocompletes the known ones and still takes a stat added later. */
|
|
222
|
+
type Stat = KnownStat | (string & {});
|
|
223
|
+
/** One player on an event's roster. */
|
|
224
|
+
interface EventPlayer {
|
|
225
|
+
/** Send this back as `playerId` when creating a market. */
|
|
226
|
+
player_id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
jersey?: string | null;
|
|
229
|
+
position?: string | null;
|
|
230
|
+
[key: string]: unknown;
|
|
231
|
+
}
|
|
232
|
+
/** One team's roster, sorted by player name. */
|
|
233
|
+
interface EventTeam {
|
|
234
|
+
team: string;
|
|
235
|
+
players: EventPlayer[];
|
|
236
|
+
[key: string]: unknown;
|
|
237
|
+
}
|
|
238
|
+
/** A stat a market on the event can be created on. */
|
|
239
|
+
interface EventStat {
|
|
240
|
+
/** The key to send, e.g. `"POINTS"`. */
|
|
241
|
+
stat: Stat;
|
|
242
|
+
/** Display name, e.g. `"Points"`. */
|
|
243
|
+
name: string;
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
}
|
|
246
|
+
/** `GET /api/v1/events/{event_id}/players`. */
|
|
247
|
+
interface EventPlayers {
|
|
248
|
+
event_id: string;
|
|
249
|
+
/** Empty until the teams' rosters are published. */
|
|
250
|
+
teams: EventTeam[];
|
|
251
|
+
/** The stats this event accepts. */
|
|
252
|
+
stats: EventStat[];
|
|
253
|
+
[key: string]: unknown;
|
|
254
|
+
}
|
|
255
|
+
/** One market to create. */
|
|
256
|
+
interface NewMarketInput {
|
|
257
|
+
/** The market type. Player stat lines are the only one today. */
|
|
258
|
+
rule?: "player_stat_line";
|
|
259
|
+
/** From `eventPlayers()`. */
|
|
260
|
+
playerId: string;
|
|
261
|
+
/** One of the event's stats, e.g. `Stats.Basketball.POINTS`. */
|
|
262
|
+
stat: Stat;
|
|
263
|
+
/**
|
|
264
|
+
* The line. A positive number ending in `.5`, e.g. `18.5`. Whole numbers
|
|
265
|
+
* (`18`), quarter lines (`18.25`), zero, negatives and strings (`"18.5"`)
|
|
266
|
+
* are rejected with `invalid_line`.
|
|
267
|
+
*/
|
|
268
|
+
line: number;
|
|
269
|
+
/** `"ou"` (over/under), the only type today and the default. */
|
|
270
|
+
propType?: "ou";
|
|
271
|
+
}
|
|
272
|
+
/** Why a market was not created. */
|
|
273
|
+
type MarketRejectionReason = "invalid_market" | "unsupported_market_type" | "unsupported_prop_type" | "unsupported_stat" | "invalid_line" | "unknown_player" | "event_not_open" | "not_created" | (string & {});
|
|
274
|
+
/** What was sent for one market, as the exchange echoes it. */
|
|
275
|
+
interface MarketRequestEcho {
|
|
276
|
+
player_id?: string;
|
|
277
|
+
stat?: string;
|
|
278
|
+
prop_type?: string;
|
|
279
|
+
line?: number;
|
|
280
|
+
[key: string]: unknown;
|
|
281
|
+
}
|
|
282
|
+
/** The outcome for one requested market, in request order. */
|
|
283
|
+
type CreateMarketResult = {
|
|
284
|
+
status: "created";
|
|
285
|
+
market_id: string;
|
|
286
|
+
market: MarketRequestEcho;
|
|
287
|
+
} | {
|
|
288
|
+
status: "exists";
|
|
289
|
+
market_id: string;
|
|
290
|
+
market: MarketRequestEcho;
|
|
291
|
+
} | {
|
|
292
|
+
status: "rejected";
|
|
293
|
+
reason: MarketRejectionReason;
|
|
294
|
+
market: MarketRequestEcho;
|
|
295
|
+
};
|
|
296
|
+
/** Options for `STX.createMarkets()`. */
|
|
297
|
+
interface CreateMarketsOptions {
|
|
298
|
+
/**
|
|
299
|
+
* Check each market against the event's players and stats, and the line
|
|
300
|
+
* rule, before sending. Failing markets come back `rejected` without a
|
|
301
|
+
* request; the rest are sent with the event's own stat key. The exchange
|
|
302
|
+
* checks every market either way. Reads `eventPlayers()`, so the token also
|
|
303
|
+
* needs the `events` scope.
|
|
304
|
+
*/
|
|
305
|
+
validate?: boolean;
|
|
306
|
+
}
|
|
307
|
+
/** The most markets one `createMarkets()` call takes. */
|
|
308
|
+
declare const MAX_MARKETS_PER_REQUEST = 25;
|
|
309
|
+
/** Whether `line` is a valid line: positive and ending in `.5`. */
|
|
310
|
+
declare function isValidLine(line: unknown): boolean;
|
|
311
|
+
|
|
143
312
|
/**
|
|
144
313
|
* One account's balance and fee summary, in the dollar wire format.
|
|
145
314
|
*/
|
|
146
315
|
interface Balance {
|
|
147
316
|
/**
|
|
148
|
-
* The account's cash balance. Unaffected by placing an order
|
|
149
|
-
* may be available. In dollars. Money as a decimal string, as sent by the
|
|
317
|
+
* The account's cash balance. Unaffected by placing an order, but not all of
|
|
318
|
+
* it may be available. In dollars. Money as a decimal string, as sent by the
|
|
150
319
|
* API.
|
|
151
320
|
*/
|
|
152
321
|
account_balance?: string | null;
|
|
@@ -283,8 +452,8 @@ interface Cancellation {
|
|
|
283
452
|
*/
|
|
284
453
|
order_id?: string | null;
|
|
285
454
|
/**
|
|
286
|
-
* The order status after cancelling, or a reason it was not cancelled
|
|
287
|
-
* "Order not found" for an unknown id.
|
|
455
|
+
* The order status after cancelling, or a reason it was not cancelled, such
|
|
456
|
+
* as "Order not found" for an unknown id.
|
|
288
457
|
*/
|
|
289
458
|
status?: string | null;
|
|
290
459
|
/** Fields the server added after this SDK was generated. */
|
|
@@ -307,7 +476,7 @@ interface Error$1 {
|
|
|
307
476
|
*/
|
|
308
477
|
interface Event {
|
|
309
478
|
/**
|
|
310
|
-
*
|
|
479
|
+
* Whether this event is archived.
|
|
311
480
|
*/
|
|
312
481
|
archived?: boolean | null;
|
|
313
482
|
/**
|
|
@@ -319,15 +488,16 @@ interface Event {
|
|
|
319
488
|
*/
|
|
320
489
|
event_id?: string | null;
|
|
321
490
|
/**
|
|
322
|
-
* The
|
|
491
|
+
* The type of this event, e.g. `ad_hoc`, `baseball_game`, `basketball_game`.
|
|
323
492
|
*/
|
|
324
493
|
event_type?: string | null;
|
|
325
494
|
/**
|
|
326
|
-
* The
|
|
495
|
+
* The event's participants, as an array of `{name, role, short_name,
|
|
496
|
+
* abbreviation}`.
|
|
327
497
|
*/
|
|
328
498
|
participants?: Array<Record<string, unknown>> | null;
|
|
329
499
|
/**
|
|
330
|
-
*
|
|
500
|
+
* Whether this event is promoted.
|
|
331
501
|
*/
|
|
332
502
|
promoted?: boolean | null;
|
|
333
503
|
/**
|
|
@@ -412,7 +582,7 @@ interface FeeTransaction {
|
|
|
412
582
|
*/
|
|
413
583
|
time?: string | null;
|
|
414
584
|
/**
|
|
415
|
-
* What moved the money or the points
|
|
585
|
+
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
416
586
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
417
587
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
418
588
|
* `fee_refund`, `casino`, `adjustment`, `loyalty`, `loyalty_points_rollup`,
|
|
@@ -435,13 +605,13 @@ interface Fill {
|
|
|
435
605
|
*/
|
|
436
606
|
action?: string | null;
|
|
437
607
|
/**
|
|
438
|
-
* Internal. Operator audit trail, not part of the supported contract
|
|
608
|
+
* Internal. Operator audit trail, not part of the supported contract; do not
|
|
439
609
|
* depend on it.
|
|
440
610
|
*/
|
|
441
611
|
admin_log?: Record<string, unknown> | null;
|
|
442
612
|
/**
|
|
443
|
-
* True if
|
|
444
|
-
* `
|
|
613
|
+
* True if STX has amended this trade. When true, compare `original_price` and
|
|
614
|
+
* `original_filled` against the current values.
|
|
445
615
|
*/
|
|
446
616
|
amended?: boolean | null;
|
|
447
617
|
/**
|
|
@@ -460,7 +630,7 @@ interface Fill {
|
|
|
460
630
|
*/
|
|
461
631
|
closed_fee?: string | null;
|
|
462
632
|
/**
|
|
463
|
-
*
|
|
633
|
+
* Realized profit or loss on the closed portion. Negative for a loss. In
|
|
464
634
|
* dollars. Money as a decimal string, as sent by the API.
|
|
465
635
|
*/
|
|
466
636
|
closed_net_pnl?: string | null;
|
|
@@ -475,7 +645,7 @@ interface Fill {
|
|
|
475
645
|
*/
|
|
476
646
|
closing?: string | null;
|
|
477
647
|
/**
|
|
478
|
-
* The
|
|
648
|
+
* The device associated with this trade.
|
|
479
649
|
*/
|
|
480
650
|
device_id?: string | null;
|
|
481
651
|
/**
|
|
@@ -489,13 +659,13 @@ interface Fill {
|
|
|
489
659
|
*/
|
|
490
660
|
expired_fee?: string | null;
|
|
491
661
|
/**
|
|
492
|
-
*
|
|
662
|
+
* Realized profit or loss on the expired portion. In dollars. Money as a
|
|
493
663
|
* decimal string, as sent by the API.
|
|
494
664
|
*/
|
|
495
665
|
expired_net_pnl?: string | null;
|
|
496
666
|
/**
|
|
497
|
-
* The profit or loss
|
|
498
|
-
*
|
|
667
|
+
* The profit or loss on the trade when the market expired. In dollars. Money
|
|
668
|
+
* as a decimal string, as sent by the API.
|
|
499
669
|
*/
|
|
500
670
|
expired_pnl?: string | null;
|
|
501
671
|
/**
|
|
@@ -521,12 +691,12 @@ interface Fill {
|
|
|
521
691
|
*/
|
|
522
692
|
ip_address?: string | null;
|
|
523
693
|
/**
|
|
524
|
-
* When
|
|
694
|
+
* When STX last amended this trade, as UNIX microseconds. Null unless
|
|
525
695
|
* `amended` is true.
|
|
526
696
|
*/
|
|
527
697
|
last_modified_at?: number | null;
|
|
528
698
|
/**
|
|
529
|
-
* Internal. Operator audit field, not part of the supported contract
|
|
699
|
+
* Internal. Operator audit field, not part of the supported contract; do not
|
|
530
700
|
* depend on it.
|
|
531
701
|
*/
|
|
532
702
|
last_modified_by_admin_id?: string | null;
|
|
@@ -568,7 +738,7 @@ interface Fill {
|
|
|
568
738
|
*/
|
|
569
739
|
original_risk?: string | null;
|
|
570
740
|
/**
|
|
571
|
-
* The original
|
|
741
|
+
* The original gain if the position wins, for the trade excluding `closed`.
|
|
572
742
|
* In dollars. Money as a decimal string, as sent by the API.
|
|
573
743
|
*/
|
|
574
744
|
original_to_win?: string | null;
|
|
@@ -583,8 +753,9 @@ interface Fill {
|
|
|
583
753
|
*/
|
|
584
754
|
pc_risk?: string | null;
|
|
585
755
|
/**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
756
|
+
* What each contract gains if the position wins: `max_price - price` on a
|
|
757
|
+
* buy, `price` on a sell. In dollars. Money as a decimal string, as sent by
|
|
758
|
+
* the API.
|
|
588
759
|
*/
|
|
589
760
|
pc_to_win?: string | null;
|
|
590
761
|
/**
|
|
@@ -625,8 +796,8 @@ interface Fill {
|
|
|
625
796
|
*/
|
|
626
797
|
remaining_risk?: string | null;
|
|
627
798
|
/**
|
|
628
|
-
*
|
|
629
|
-
* string, as sent by the API.
|
|
799
|
+
* What the unsettled contracts gain if the position wins. In dollars. Money
|
|
800
|
+
* as a decimal string, as sent by the API.
|
|
630
801
|
*/
|
|
631
802
|
remaining_to_win?: string | null;
|
|
632
803
|
/**
|
|
@@ -639,14 +810,14 @@ interface Fill {
|
|
|
639
810
|
*/
|
|
640
811
|
settled_contracts?: string | null;
|
|
641
812
|
/**
|
|
642
|
-
* The number of settlements where this
|
|
813
|
+
* The number of settlements where this trade is the opening trade.
|
|
643
814
|
*/
|
|
644
815
|
settlements_count?: number | null;
|
|
645
816
|
/**
|
|
646
817
|
* Fill state. `created` once the matching engine has written the fill, `open`
|
|
647
818
|
* while the position is live, `settled` once it no longer contributes to a
|
|
648
|
-
* position, and `cancelled` if
|
|
649
|
-
* `
|
|
819
|
+
* position, and `cancelled` if STX reversed it. One of: `created`, `open`,
|
|
820
|
+
* `settled`, `cancelled`.
|
|
650
821
|
*/
|
|
651
822
|
status?: string | null;
|
|
652
823
|
/**
|
|
@@ -674,7 +845,7 @@ interface Fill {
|
|
|
674
845
|
traded_contracts?: string | null;
|
|
675
846
|
/**
|
|
676
847
|
* Fee before rounding. Use the rounded fee for reconciliation. In dollars.
|
|
677
|
-
* Carries up to 9 decimal places
|
|
848
|
+
* Carries up to 9 decimal places; parse money with a variable-scale decimal
|
|
678
849
|
* type, not a fixed-width one. Money as a decimal string, as sent by the API.
|
|
679
850
|
*/
|
|
680
851
|
unrounded_trade_fee?: string | null;
|
|
@@ -690,16 +861,162 @@ interface Fill {
|
|
|
690
861
|
/** Fields the server added after this SDK was generated. */
|
|
691
862
|
[key: string]: unknown;
|
|
692
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* One ranked board.
|
|
866
|
+
*/
|
|
867
|
+
interface Leaderboard {
|
|
868
|
+
/**
|
|
869
|
+
* `all` or a sport key.
|
|
870
|
+
*/
|
|
871
|
+
category?: string | null;
|
|
872
|
+
/**
|
|
873
|
+
* Ranked rows, best first, at most the number of members STX shows per board
|
|
874
|
+
* (never more than 100). Empty for a board STX hides.
|
|
875
|
+
*/
|
|
876
|
+
leaderboard?: LeaderboardEntry[] | null;
|
|
877
|
+
/**
|
|
878
|
+
* The metric the rows are ranked on. One of: `volume`, `profit`,
|
|
879
|
+
* `predictions`, `markets`, `win_rate`, `biggest_win`, `return`, `streak`.
|
|
880
|
+
*/
|
|
881
|
+
metric?: string | null;
|
|
882
|
+
/**
|
|
883
|
+
* When this period's board resets: local midnight in America/New_York on the
|
|
884
|
+
* next boundary, as UTC. `null` for `all`, which never resets, and before the
|
|
885
|
+
* first snapshot.
|
|
886
|
+
*/
|
|
887
|
+
next_reset_at?: string | null;
|
|
888
|
+
/**
|
|
889
|
+
* The period the board covers. One of: `daily`, `weekly`, `monthly`,
|
|
890
|
+
* `yearly`, `all`.
|
|
891
|
+
*/
|
|
892
|
+
period?: string | null;
|
|
893
|
+
/**
|
|
894
|
+
* When this snapshot was built. `null` before the first snapshot is
|
|
895
|
+
* published.
|
|
896
|
+
*/
|
|
897
|
+
refreshed_at?: string | null;
|
|
898
|
+
/**
|
|
899
|
+
* Whether STX shows this board to members. `false` means the board is hidden
|
|
900
|
+
* and `leaderboard` is empty, not that nobody has ranked yet.
|
|
901
|
+
*/
|
|
902
|
+
shown?: boolean | null;
|
|
903
|
+
/** Fields the server added after this SDK was generated. */
|
|
904
|
+
[key: string]: unknown;
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* One ranked member.
|
|
908
|
+
*/
|
|
909
|
+
interface LeaderboardEntry {
|
|
910
|
+
/**
|
|
911
|
+
* Path of the member's avatar, `/avatars/{handle}.svg`, relative to the API
|
|
912
|
+
* host. `null` when `handle` is `null`.
|
|
913
|
+
*/
|
|
914
|
+
avatar_url?: string | null;
|
|
915
|
+
/**
|
|
916
|
+
* The member's public handle. `null` for a member who has not set one.
|
|
917
|
+
*/
|
|
918
|
+
handle?: string | null;
|
|
919
|
+
/**
|
|
920
|
+
* Dense rank, 1-based. Tied values share a rank.
|
|
921
|
+
*/
|
|
922
|
+
rank?: number | null;
|
|
923
|
+
/**
|
|
924
|
+
* The sport the member traded most in the period, as a category key. On a
|
|
925
|
+
* sport board it is that sport. `null` when unknown.
|
|
926
|
+
*/
|
|
927
|
+
top_sport?: string | null;
|
|
928
|
+
/**
|
|
929
|
+
* Path of the sport's icon, the same category icon the apps use, relative to
|
|
930
|
+
* the API host. `null` when `top_sport` is `null`.
|
|
931
|
+
*/
|
|
932
|
+
top_sport_icon_url?: string | null;
|
|
933
|
+
/**
|
|
934
|
+
* The ranked value. A dollar string on money boards, an integer on count
|
|
935
|
+
* boards and a number from 0 to 1 on ratio boards.
|
|
936
|
+
*/
|
|
937
|
+
value?: unknown | null;
|
|
938
|
+
/** Fields the server added after this SDK was generated. */
|
|
939
|
+
[key: string]: unknown;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Your standing in one period and category.
|
|
943
|
+
*/
|
|
944
|
+
interface LeaderboardStanding {
|
|
945
|
+
/**
|
|
946
|
+
* Your rank and biggest single-market win; `null` when unranked or the board
|
|
947
|
+
* is hidden.
|
|
948
|
+
*/
|
|
949
|
+
biggest_win?: Record<string, unknown> | null;
|
|
950
|
+
/**
|
|
951
|
+
* The category asked for.
|
|
952
|
+
*/
|
|
953
|
+
category?: string | null;
|
|
954
|
+
/**
|
|
955
|
+
* Your rank and markets settled; `null` when unranked or the board is hidden.
|
|
956
|
+
*/
|
|
957
|
+
markets?: Record<string, unknown> | null;
|
|
958
|
+
/**
|
|
959
|
+
* Whether you appear on public boards. `false` is why every rank is `null`
|
|
960
|
+
* for an opted-out member.
|
|
961
|
+
*/
|
|
962
|
+
opted_in?: boolean | null;
|
|
963
|
+
/**
|
|
964
|
+
* The period asked for. One of: `daily`, `weekly`, `monthly`, `yearly`,
|
|
965
|
+
* `all`.
|
|
966
|
+
*/
|
|
967
|
+
period?: string | null;
|
|
968
|
+
/**
|
|
969
|
+
* Your rank and contracts settled; `null` when unranked or the board is
|
|
970
|
+
* hidden.
|
|
971
|
+
*/
|
|
972
|
+
predictions?: Record<string, unknown> | null;
|
|
973
|
+
/**
|
|
974
|
+
* Your rank and net profit; `null` when unranked or the board is hidden.
|
|
975
|
+
*/
|
|
976
|
+
profit?: Record<string, unknown> | null;
|
|
977
|
+
/**
|
|
978
|
+
* Your rank and return (profit ÷ volume), `0.0`-`1.0`; needs $500 of volume;
|
|
979
|
+
* `null` when unranked or the board is hidden.
|
|
980
|
+
*/
|
|
981
|
+
return?: Record<string, unknown> | null;
|
|
982
|
+
/**
|
|
983
|
+
* Markets decided (won or lost) in the period. `0` when unranked.
|
|
984
|
+
*/
|
|
985
|
+
settled_markets?: number | null;
|
|
986
|
+
/**
|
|
987
|
+
* Your rank and longest winning streak; `null` when unranked or the board is
|
|
988
|
+
* hidden.
|
|
989
|
+
*/
|
|
990
|
+
streak?: Record<string, unknown> | null;
|
|
991
|
+
/**
|
|
992
|
+
* Your rank and notional traded; `null` when unranked or the board is hidden.
|
|
993
|
+
*/
|
|
994
|
+
volume?: Record<string, unknown> | null;
|
|
995
|
+
/**
|
|
996
|
+
* Share of decided markets you won, `0.0`-`1.0`. `null` until at least 10
|
|
997
|
+
* markets have been decided in the period; a market settled at zero profit is
|
|
998
|
+
* neither a win nor a loss.
|
|
999
|
+
*/
|
|
1000
|
+
win_rate?: number | null;
|
|
1001
|
+
/**
|
|
1002
|
+
* Your rank and win rate, `0.0`-`1.0`; needs 10 decided markets to rank;
|
|
1003
|
+
* `null` when unranked or the board is hidden.
|
|
1004
|
+
*/
|
|
1005
|
+
win_rate_rank?: Record<string, unknown> | null;
|
|
1006
|
+
/** Fields the server added after this SDK was generated. */
|
|
1007
|
+
[key: string]: unknown;
|
|
1008
|
+
}
|
|
693
1009
|
/**
|
|
694
1010
|
* A market you can trade, with its book and event context.
|
|
695
1011
|
*/
|
|
696
1012
|
interface Market {
|
|
697
1013
|
/**
|
|
698
|
-
*
|
|
1014
|
+
* Whether the market is archived.
|
|
699
1015
|
*/
|
|
700
1016
|
archived?: boolean | null;
|
|
701
1017
|
/**
|
|
702
|
-
* The
|
|
1018
|
+
* The top bids on the market, sorted by price descending, so the best
|
|
1019
|
+
* (highest) bid is first.
|
|
703
1020
|
*/
|
|
704
1021
|
bids?: BookLevel[] | null;
|
|
705
1022
|
/**
|
|
@@ -735,15 +1052,15 @@ interface Market {
|
|
|
735
1052
|
*/
|
|
736
1053
|
event_type?: string | null;
|
|
737
1054
|
/**
|
|
738
|
-
*
|
|
1055
|
+
* Whether the market is featured.
|
|
739
1056
|
*/
|
|
740
1057
|
featured?: boolean | null;
|
|
741
1058
|
/**
|
|
742
|
-
*
|
|
1059
|
+
* Whether the market is featured on the home page.
|
|
743
1060
|
*/
|
|
744
1061
|
featured_home?: boolean | null;
|
|
745
1062
|
/**
|
|
746
|
-
* The
|
|
1063
|
+
* The categorizations under which the market appears. A list, not an object.
|
|
747
1064
|
*/
|
|
748
1065
|
filters?: MarketFilter[] | null;
|
|
749
1066
|
/**
|
|
@@ -752,7 +1069,7 @@ interface Market {
|
|
|
752
1069
|
group_title?: string | null;
|
|
753
1070
|
/**
|
|
754
1071
|
* Identity of the set of mutually exclusive outcomes this market prices
|
|
755
|
-
* against
|
|
1072
|
+
* against: the 30 World Series contracts, the 4 AFC East contracts, one
|
|
756
1073
|
* fixture's moneyline pair. Opaque: compare for equality, never parse. Stable
|
|
757
1074
|
* for the life of the market, and present in every status, so it is the field
|
|
758
1075
|
* to map market data on. Unlike `symbol`, it does not move when a fixture is
|
|
@@ -761,12 +1078,12 @@ interface Market {
|
|
|
761
1078
|
grouping_id?: string | null;
|
|
762
1079
|
/**
|
|
763
1080
|
* The grouping in words, e.g. `AL East Division`, `Spread - 1st Quarter`.
|
|
764
|
-
* Descriptive rather than stable
|
|
1081
|
+
* Descriptive rather than stable: for a tournament it is the event title,
|
|
765
1082
|
* which can be renamed. Display it; join on `grouping_id`.
|
|
766
1083
|
*/
|
|
767
1084
|
grouping_name?: string | null;
|
|
768
1085
|
/**
|
|
769
|
-
* The category in which the market appears: `Upcoming`, `Live` or `
|
|
1086
|
+
* The category in which the market appears: `Upcoming`, `Live` or `null`.
|
|
770
1087
|
*/
|
|
771
1088
|
home_category?: string | null;
|
|
772
1089
|
/**
|
|
@@ -789,7 +1106,7 @@ interface Market {
|
|
|
789
1106
|
last_traded_price?: string | null;
|
|
790
1107
|
/**
|
|
791
1108
|
* `true` when the probability was set by hand, `false` when it came from the
|
|
792
|
-
*
|
|
1109
|
+
* pricing feed. A flag, not a probability figure.
|
|
793
1110
|
*/
|
|
794
1111
|
manual_probability?: boolean | null;
|
|
795
1112
|
/**
|
|
@@ -797,13 +1114,14 @@ interface Market {
|
|
|
797
1114
|
*/
|
|
798
1115
|
market_id?: string | null;
|
|
799
1116
|
/**
|
|
800
|
-
* The
|
|
801
|
-
*
|
|
1117
|
+
* The settlement value of one winning contract, and the ceiling on order
|
|
1118
|
+
* prices: an order must price strictly below it. Read it per market. In
|
|
802
1119
|
* dollars. Money as a decimal string, as sent by the API.
|
|
803
1120
|
*/
|
|
804
1121
|
max_price?: string | null;
|
|
805
1122
|
/**
|
|
806
|
-
* The
|
|
1123
|
+
* The top offers on the market, sorted by price descending, so the best
|
|
1124
|
+
* (lowest) offer is last.
|
|
807
1125
|
*/
|
|
808
1126
|
offers?: BookLevel[] | null;
|
|
809
1127
|
/**
|
|
@@ -812,7 +1130,7 @@ interface Market {
|
|
|
812
1130
|
*/
|
|
813
1131
|
open_interest?: string | null;
|
|
814
1132
|
/**
|
|
815
|
-
* The
|
|
1133
|
+
* The participants of the market's event, as an array.
|
|
816
1134
|
*/
|
|
817
1135
|
participants?: Array<Record<string, unknown>> | null;
|
|
818
1136
|
/**
|
|
@@ -825,7 +1143,7 @@ interface Market {
|
|
|
825
1143
|
*/
|
|
826
1144
|
position?: string | null;
|
|
827
1145
|
/**
|
|
828
|
-
*
|
|
1146
|
+
* The provider used to result this market.
|
|
829
1147
|
*/
|
|
830
1148
|
powered_by?: Record<string, unknown> | null;
|
|
831
1149
|
/**
|
|
@@ -834,12 +1152,12 @@ interface Market {
|
|
|
834
1152
|
*/
|
|
835
1153
|
price?: string | null;
|
|
836
1154
|
/**
|
|
837
|
-
* The change in price over the last 24 hours, as a percentage. Not money
|
|
1155
|
+
* The change in price over the last 24 hours, as a percentage. Not money: it
|
|
838
1156
|
* stays a number and must not be divided by 100.
|
|
839
1157
|
*/
|
|
840
1158
|
price_change24h?: number | null;
|
|
841
1159
|
/**
|
|
842
|
-
*
|
|
1160
|
+
* The market's probability of the outcome, between 0 and 1.
|
|
843
1161
|
*/
|
|
844
1162
|
probability?: number | null;
|
|
845
1163
|
/**
|
|
@@ -881,8 +1199,8 @@ interface Market {
|
|
|
881
1199
|
*/
|
|
882
1200
|
stat_detail?: StatDetail | null;
|
|
883
1201
|
/**
|
|
884
|
-
* Market state. See [Market and order status](/concepts/market-status/)
|
|
885
|
-
*
|
|
1202
|
+
* Market state. See [Market and order status](/concepts/market-status/). Note
|
|
1203
|
+
* that a market with `status: open` may still report as suspended when
|
|
886
1204
|
* trading is halted. One of: `scheduled`, `pre_open`, `open`, `suspended`,
|
|
887
1205
|
* `closed`, `resulted`, `cancelled`, `voided`.
|
|
888
1206
|
*/
|
|
@@ -910,11 +1228,11 @@ interface Market {
|
|
|
910
1228
|
*/
|
|
911
1229
|
total_volume?: string | null;
|
|
912
1230
|
/**
|
|
913
|
-
*
|
|
1231
|
+
* Whether the market is accepting orders right now.
|
|
914
1232
|
*/
|
|
915
1233
|
trading?: boolean | null;
|
|
916
1234
|
/**
|
|
917
|
-
* The
|
|
1235
|
+
* The categorizations used for organizing trades, settlements and related
|
|
918
1236
|
* items. A list, not an object.
|
|
919
1237
|
*/
|
|
920
1238
|
trading_filters?: MarketFilter[] | null;
|
|
@@ -927,7 +1245,7 @@ interface Market {
|
|
|
927
1245
|
[key: string]: unknown;
|
|
928
1246
|
}
|
|
929
1247
|
/**
|
|
930
|
-
* One
|
|
1248
|
+
* One categorization this market appears under.
|
|
931
1249
|
*/
|
|
932
1250
|
interface MarketFilter {
|
|
933
1251
|
/**
|
|
@@ -939,7 +1257,7 @@ interface MarketFilter {
|
|
|
939
1257
|
*/
|
|
940
1258
|
grouping?: string | null;
|
|
941
1259
|
/**
|
|
942
|
-
* Whether the
|
|
1260
|
+
* Whether the categorization was assigned by hand.
|
|
943
1261
|
*/
|
|
944
1262
|
manual?: boolean | null;
|
|
945
1263
|
/**
|
|
@@ -958,7 +1276,7 @@ interface MarketFilter {
|
|
|
958
1276
|
[key: string]: unknown;
|
|
959
1277
|
}
|
|
960
1278
|
/**
|
|
961
|
-
* Your exposure and
|
|
1279
|
+
* Your exposure and realized result in one market.
|
|
962
1280
|
*/
|
|
963
1281
|
interface MarketStat {
|
|
964
1282
|
/**
|
|
@@ -966,8 +1284,8 @@ interface MarketStat {
|
|
|
966
1284
|
*/
|
|
967
1285
|
account_id?: string | null;
|
|
968
1286
|
/**
|
|
969
|
-
*
|
|
970
|
-
*
|
|
1287
|
+
* When the record was marked as archived. `null` until the market is
|
|
1288
|
+
* archived. UNIX microseconds.
|
|
971
1289
|
*/
|
|
972
1290
|
archived_at?: number | null;
|
|
973
1291
|
/**
|
|
@@ -1100,8 +1418,8 @@ interface MarketStat {
|
|
|
1100
1418
|
*/
|
|
1101
1419
|
contracts_in_buy_orders?: string | null;
|
|
1102
1420
|
/**
|
|
1103
|
-
* Sum of all
|
|
1104
|
-
*
|
|
1421
|
+
* Sum of all unmatched contracts in all orders: each order's `quantity` minus
|
|
1422
|
+
* its `filled`. Quantity as a decimal string, as sent by the API.
|
|
1105
1423
|
*/
|
|
1106
1424
|
contracts_in_orders?: string | null;
|
|
1107
1425
|
/**
|
|
@@ -1115,9 +1433,9 @@ interface MarketStat {
|
|
|
1115
1433
|
*/
|
|
1116
1434
|
contracts_settled?: string | null;
|
|
1117
1435
|
/**
|
|
1118
|
-
* The total number of
|
|
1119
|
-
* contracts are counted
|
|
1120
|
-
* Quantity as a decimal string, as sent by the API.
|
|
1436
|
+
* The total number of contracts traded (the sum of each fill's `filled`).
|
|
1437
|
+
* Only opening trades' contracts are counted, not contracts closing other
|
|
1438
|
+
* trades. Quantity as a decimal string, as sent by the API.
|
|
1121
1439
|
*/
|
|
1122
1440
|
contracts_traded?: string | null;
|
|
1123
1441
|
/**
|
|
@@ -1168,7 +1486,7 @@ interface MarketStat {
|
|
|
1168
1486
|
*/
|
|
1169
1487
|
inserted_at?: number | null;
|
|
1170
1488
|
/**
|
|
1171
|
-
*
|
|
1489
|
+
* When the last settlement was created. UNIX microseconds.
|
|
1172
1490
|
*/
|
|
1173
1491
|
last_settled_at?: number | null;
|
|
1174
1492
|
/**
|
|
@@ -1176,7 +1494,7 @@ interface MarketStat {
|
|
|
1176
1494
|
*/
|
|
1177
1495
|
market_id?: string | null;
|
|
1178
1496
|
/**
|
|
1179
|
-
* The market's maximum price
|
|
1497
|
+
* The market's maximum price: the settlement value of one winning contract.
|
|
1180
1498
|
* In dollars. Money as a decimal string, as sent by the API.
|
|
1181
1499
|
*/
|
|
1182
1500
|
market_max_price?: string | null;
|
|
@@ -1186,7 +1504,7 @@ interface MarketStat {
|
|
|
1186
1504
|
*/
|
|
1187
1505
|
max_liability_loss?: string | null;
|
|
1188
1506
|
/**
|
|
1189
|
-
* Worst-case loss if this market settles in
|
|
1507
|
+
* Worst-case loss if this market settles in favor of the position you hold.
|
|
1190
1508
|
* In dollars. Money as a decimal string, as sent by the API.
|
|
1191
1509
|
*/
|
|
1192
1510
|
max_liability_win?: string | null;
|
|
@@ -1258,7 +1576,7 @@ interface MarketStat {
|
|
|
1258
1576
|
*/
|
|
1259
1577
|
pending_close_fee?: string | null;
|
|
1260
1578
|
/**
|
|
1261
|
-
* Profit or loss that would be
|
|
1579
|
+
* Profit or loss that would be realized if the resting close orders all
|
|
1262
1580
|
* filled. In dollars. Money as a decimal string, as sent by the API.
|
|
1263
1581
|
*/
|
|
1264
1582
|
pending_close_pnl?: string | null;
|
|
@@ -1295,7 +1613,7 @@ interface MarketStat {
|
|
|
1295
1613
|
*/
|
|
1296
1614
|
rejected_sell_orders?: number | null;
|
|
1297
1615
|
/**
|
|
1298
|
-
* The total number of
|
|
1616
|
+
* The total number of sell contracts that were closed. Quantity as a decimal
|
|
1299
1617
|
* string, as sent by the API.
|
|
1300
1618
|
*/
|
|
1301
1619
|
sell_contracts_closed?: string | null;
|
|
@@ -1338,8 +1656,8 @@ interface MarketStat {
|
|
|
1338
1656
|
*/
|
|
1339
1657
|
sell_trade_count?: number | null;
|
|
1340
1658
|
/**
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1659
|
+
* When the expired settlements were recorded. `null` if the market has not
|
|
1660
|
+
* resulted or voided yet. UNIX microseconds.
|
|
1343
1661
|
*/
|
|
1344
1662
|
settled_at?: number | null;
|
|
1345
1663
|
/**
|
|
@@ -1366,7 +1684,7 @@ interface MarketStat {
|
|
|
1366
1684
|
*/
|
|
1367
1685
|
total_fees?: string | null;
|
|
1368
1686
|
/**
|
|
1369
|
-
* The liability affecting
|
|
1687
|
+
* The liability affecting available balance from open orders and position. In
|
|
1370
1688
|
* dollars. Money as a decimal string, as sent by the API.
|
|
1371
1689
|
*/
|
|
1372
1690
|
total_liability?: string | null;
|
|
@@ -1376,7 +1694,7 @@ interface MarketStat {
|
|
|
1376
1694
|
*/
|
|
1377
1695
|
total_net_pnl?: string | null;
|
|
1378
1696
|
/**
|
|
1379
|
-
* The total
|
|
1697
|
+
* The total profit or loss on all settlements. In dollars. Money as a decimal
|
|
1380
1698
|
* string, as sent by the API.
|
|
1381
1699
|
*/
|
|
1382
1700
|
total_settlement_pnl?: string | null;
|
|
@@ -1392,20 +1710,35 @@ interface MarketStat {
|
|
|
1392
1710
|
[key: string]: unknown;
|
|
1393
1711
|
}
|
|
1394
1712
|
/**
|
|
1395
|
-
* The account behind the
|
|
1713
|
+
* The account behind the credential.
|
|
1396
1714
|
*/
|
|
1397
1715
|
interface Me {
|
|
1398
1716
|
/**
|
|
1399
1717
|
* Your account id. Trades, settlements and balances are scoped to it.
|
|
1400
1718
|
*/
|
|
1401
1719
|
account_id?: string | null;
|
|
1720
|
+
/**
|
|
1721
|
+
* Path of your avatar, `/avatars/{handle}.svg`, relative to the API host.
|
|
1722
|
+
* `null` when `handle` is `null`.
|
|
1723
|
+
*/
|
|
1724
|
+
avatar_url?: string | null;
|
|
1402
1725
|
/**
|
|
1403
1726
|
* First name on the account, or `null` if no profile is loaded.
|
|
1404
1727
|
*/
|
|
1405
1728
|
first_name?: string | null;
|
|
1406
1729
|
/**
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1730
|
+
* Your public handle, shown on the leaderboard in place of your name. `null`
|
|
1731
|
+
* until one is set.
|
|
1732
|
+
*/
|
|
1733
|
+
handle?: string | null;
|
|
1734
|
+
/**
|
|
1735
|
+
* When you may next change your handle. `null` means now; otherwise the end
|
|
1736
|
+
* of the 30-day window since the last change.
|
|
1737
|
+
*/
|
|
1738
|
+
handle_changeable_at?: string | null;
|
|
1739
|
+
/**
|
|
1740
|
+
* The id of the API key that signed this request: the value sent in the
|
|
1741
|
+
* access-key header. `null` on a bearer request.
|
|
1409
1742
|
*/
|
|
1410
1743
|
key_id?: string | null;
|
|
1411
1744
|
/**
|
|
@@ -1413,16 +1746,24 @@ interface Me {
|
|
|
1413
1746
|
*/
|
|
1414
1747
|
last_name?: string | null;
|
|
1415
1748
|
/**
|
|
1416
|
-
*
|
|
1749
|
+
* Whether you have consented to appear on public leaderboards. New accounts
|
|
1750
|
+
* start with the jurisdiction's default; accounts from before the leaderboard
|
|
1751
|
+
* start at `false`. Change it with `PATCH /api/v1/me/profile`.
|
|
1752
|
+
*/
|
|
1753
|
+
leaderboard_opt_in?: boolean | null;
|
|
1754
|
+
/**
|
|
1755
|
+
* How this request authenticated: `api_key` for a signed request, `bearer`
|
|
1756
|
+
* for a session token. One of: `api_key`, `bearer`.
|
|
1417
1757
|
*/
|
|
1418
1758
|
method?: string | null;
|
|
1419
1759
|
/**
|
|
1420
1760
|
* Access level granted to this key: `read_only`, or `read_write` for keys
|
|
1421
|
-
* that may place and cancel orders. One of:
|
|
1761
|
+
* that may place and cancel orders. `null` on a bearer request. One of:
|
|
1762
|
+
* `read_only`, `read_write`.
|
|
1422
1763
|
*/
|
|
1423
1764
|
scope?: string | null;
|
|
1424
1765
|
/**
|
|
1425
|
-
* Your user id. Substitute this into
|
|
1766
|
+
* Your user id. Substitute this into account channel topics such as
|
|
1426
1767
|
* `orders:{user_id}`.
|
|
1427
1768
|
*/
|
|
1428
1769
|
user_id?: string | null;
|
|
@@ -1443,7 +1784,7 @@ interface NewOrder {
|
|
|
1443
1784
|
*/
|
|
1444
1785
|
cancel_on_disconnect?: boolean | null;
|
|
1445
1786
|
/**
|
|
1446
|
-
* Your own reference, echoed back unchanged. A free-form string, not a UUID
|
|
1787
|
+
* Your own reference, echoed back unchanged. A free-form string, not a UUID;
|
|
1447
1788
|
* FIX clients routinely send ids like `my-order-001`.
|
|
1448
1789
|
*/
|
|
1449
1790
|
client_order_id?: string | null;
|
|
@@ -1461,6 +1802,19 @@ interface NewOrder {
|
|
|
1461
1802
|
* `good_till_time`. UNIX microseconds.
|
|
1462
1803
|
*/
|
|
1463
1804
|
expiration_time?: number | null;
|
|
1805
|
+
/**
|
|
1806
|
+
* Location code from the STX geolocation check, covering this order. Inside a
|
|
1807
|
+
* `POST /api/v1/orders/batched` leg it is ignored; send the batch's top-level
|
|
1808
|
+
* `geo_location` instead. Read only in environments that enforce geo-fencing,
|
|
1809
|
+
* and ignored elsewhere. Where it is read, omitting it is a 422 (`Placing
|
|
1810
|
+
* Order(s) from this IP address … is disallowed.`) unless that environment
|
|
1811
|
+
* accepts the network location the request arrives from in its place, which
|
|
1812
|
+
* it can refuse for an address identified as a VPN, proxy or hosting
|
|
1813
|
+
* provider. Do not rely on omitting it: send the code whenever you have one.
|
|
1814
|
+
* A code that is sent is always checked, so a bad one is a 422 even where
|
|
1815
|
+
* omitting it would have been accepted.
|
|
1816
|
+
*/
|
|
1817
|
+
geo_location?: string | null;
|
|
1464
1818
|
/**
|
|
1465
1819
|
* The market to place the order on.
|
|
1466
1820
|
*/
|
|
@@ -1471,16 +1825,15 @@ interface NewOrder {
|
|
|
1471
1825
|
*/
|
|
1472
1826
|
order_type?: string | null;
|
|
1473
1827
|
/**
|
|
1474
|
-
* Limit price in dollars, as a string
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
* assuming a fixed ceiling. Required for `limit` orders and unused by
|
|
1828
|
+
* Limit price in dollars, as a string: `"0.42"` is 42 cents. A number is
|
|
1829
|
+
* rejected outright rather than reinterpreted, because a bare `42` could mean
|
|
1830
|
+
* 42 cents or 42 dollars and the wrong reading is off by 100x. Must be
|
|
1831
|
+
* strictly less than the market's `max_price`; read that per market rather
|
|
1832
|
+
* than assuming a fixed ceiling. Required for `limit` orders and unused by
|
|
1480
1833
|
* `market` orders, but validated whenever it is present: a malformed or
|
|
1481
1834
|
* sub-cent price is a 400 on a `market` order too, rather than being quietly
|
|
1482
1835
|
* dropped. An explicit `null` is accepted there, exactly as omitting the key
|
|
1483
|
-
* is. Must be greater than zero and a whole number of cents
|
|
1836
|
+
* is. Must be greater than zero and a whole number of cents: at most two
|
|
1484
1837
|
* decimal places, not counting trailing zeros. So "0.42" and "0.4200" are the
|
|
1485
1838
|
* same accepted value, and "0.001" is rejected. Money as a decimal string, as
|
|
1486
1839
|
* sent by the API.
|
|
@@ -1489,7 +1842,7 @@ interface NewOrder {
|
|
|
1489
1842
|
/**
|
|
1490
1843
|
* Number of contracts, greater than zero, as a decimal string: `"10"` and
|
|
1491
1844
|
* `"10.00"` are read the same. A number is rejected rather than converted,
|
|
1492
|
-
* the same rule `price` follows, though for a different reason
|
|
1845
|
+
* the same rule `price` follows, though for a different reason: a float
|
|
1493
1846
|
* arrives as a binary double, so the size that rests on the book would not
|
|
1494
1847
|
* always be the size that was sent. More than nine decimal places is rounded.
|
|
1495
1848
|
* Responses always return it as a string.
|
|
@@ -1512,8 +1865,9 @@ interface Order {
|
|
|
1512
1865
|
*/
|
|
1513
1866
|
action?: string | null;
|
|
1514
1867
|
/**
|
|
1515
|
-
* Order size
|
|
1516
|
-
* quantity.
|
|
1868
|
+
* Order size in dollars, for an order entered by amount rather than by
|
|
1869
|
+
* contract quantity. `null` for orders placed through this API, which always
|
|
1870
|
+
* take a quantity. Money as a decimal string, as sent by the API.
|
|
1517
1871
|
*/
|
|
1518
1872
|
amount?: string | null;
|
|
1519
1873
|
/**
|
|
@@ -1547,6 +1901,12 @@ interface Order {
|
|
|
1547
1901
|
* The expiration time for time-based expiration. UNIX microseconds.
|
|
1548
1902
|
*/
|
|
1549
1903
|
expiration_time?: number | null;
|
|
1904
|
+
/**
|
|
1905
|
+
* When the contracts this order trades expire, as UNIX microseconds: the
|
|
1906
|
+
* market's expiration, copied onto the order when it is placed. `null` when
|
|
1907
|
+
* the market has no event. Not the same as `expiration_time`.
|
|
1908
|
+
*/
|
|
1909
|
+
expires_at?: number | null;
|
|
1550
1910
|
/**
|
|
1551
1911
|
* Contracts filled so far. Compare with `quantity` to get remaining size.
|
|
1552
1912
|
* Quantity as a decimal string, as sent by the API.
|
|
@@ -1583,11 +1943,13 @@ interface Order {
|
|
|
1583
1943
|
*/
|
|
1584
1944
|
market_id?: string | null;
|
|
1585
1945
|
/**
|
|
1586
|
-
* The odds
|
|
1946
|
+
* Legacy. The odds format (`decimal` or `american`) an order was entered in
|
|
1947
|
+
* on an STX app. `null` for orders placed through this API.
|
|
1587
1948
|
*/
|
|
1588
1949
|
odds_type?: string | null;
|
|
1589
1950
|
/**
|
|
1590
|
-
* The odds
|
|
1951
|
+
* Legacy. The odds an order was entered at on an STX app, as a string. `null`
|
|
1952
|
+
* for orders placed through this API.
|
|
1591
1953
|
*/
|
|
1592
1954
|
odds_value?: string | null;
|
|
1593
1955
|
/**
|
|
@@ -1599,9 +1961,9 @@ interface Order {
|
|
|
1599
1961
|
*/
|
|
1600
1962
|
placed_pre_start?: boolean | null;
|
|
1601
1963
|
/**
|
|
1602
|
-
* Limit price
|
|
1603
|
-
*
|
|
1604
|
-
* decimal places
|
|
1964
|
+
* Limit price, below the market's `max_price`; read that per market rather
|
|
1965
|
+
* than assuming a ceiling. Absent for market orders. In dollars. Carries up
|
|
1966
|
+
* to 7 decimal places; parse money with a variable-scale decimal type, not a
|
|
1605
1967
|
* fixed-width one. Money as a decimal string, as sent by the API.
|
|
1606
1968
|
*/
|
|
1607
1969
|
price?: string | null;
|
|
@@ -1614,7 +1976,7 @@ interface Order {
|
|
|
1614
1976
|
*/
|
|
1615
1977
|
rejection_reason?: string | null;
|
|
1616
1978
|
/**
|
|
1617
|
-
* Order state
|
|
1979
|
+
* Order state, one of nine. See [Market and order
|
|
1618
1980
|
* status](/concepts/market-status/#order-statuses) for the full set and which
|
|
1619
1981
|
* are terminal. One of: `created`, `requested`, `accepted`, `delayed`,
|
|
1620
1982
|
* `open`, `filled`, `rejected`, `cancelled`, `partially_cancelled`.
|
|
@@ -1695,7 +2057,7 @@ interface PaymentTransaction {
|
|
|
1695
2057
|
*/
|
|
1696
2058
|
time?: string | null;
|
|
1697
2059
|
/**
|
|
1698
|
-
* What moved the money or the points
|
|
2060
|
+
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
1699
2061
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
1700
2062
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
1701
2063
|
* `fee_refund`, `casino`, `adjustment`, `loyalty`, `loyalty_points_rollup`,
|
|
@@ -1751,7 +2113,7 @@ interface Position {
|
|
|
1751
2113
|
*/
|
|
1752
2114
|
max_potential_fee?: string | null;
|
|
1753
2115
|
/**
|
|
1754
|
-
* Total possible profit for the position if everything settles
|
|
2116
|
+
* Total possible profit for the position if everything settles favorably. In
|
|
1755
2117
|
* dollars. Money as a decimal string, as sent by the API.
|
|
1756
2118
|
*/
|
|
1757
2119
|
max_potential_profit?: string | null;
|
|
@@ -1804,7 +2166,7 @@ interface Position {
|
|
|
1804
2166
|
*/
|
|
1805
2167
|
total_fee?: string | null;
|
|
1806
2168
|
/**
|
|
1807
|
-
* Profit or loss
|
|
2169
|
+
* Profit or loss realized from settlements so far. In dollars. Money as a
|
|
1808
2170
|
* decimal string, as sent by the API.
|
|
1809
2171
|
*/
|
|
1810
2172
|
total_settlement_pnl?: string | null;
|
|
@@ -1812,12 +2174,38 @@ interface Position {
|
|
|
1812
2174
|
[key: string]: unknown;
|
|
1813
2175
|
}
|
|
1814
2176
|
/**
|
|
1815
|
-
*
|
|
2177
|
+
* The public-profile fields to change. Every key is optional, but at least one
|
|
2178
|
+
* is required.
|
|
2179
|
+
*/
|
|
2180
|
+
interface ProfileUpdate {
|
|
2181
|
+
/**
|
|
2182
|
+
* A new avatar. Any style/palette pairing renders; the seed selects the
|
|
2183
|
+
* pattern. `null` is refused (`400`).
|
|
2184
|
+
*/
|
|
2185
|
+
avatar?: Record<string, unknown> | null;
|
|
2186
|
+
/**
|
|
2187
|
+
* New public handle: 3-24 characters of lowercase letters, digits and inner
|
|
2188
|
+
* `.` or `_`; case is folded. Must be unused, not a reserved word and not
|
|
2189
|
+
* blocked. May be changed once every 30 days; re-sending your current handle
|
|
2190
|
+
* is not a change. A blank handle is refused (`422`).
|
|
2191
|
+
*/
|
|
2192
|
+
handle?: string | null;
|
|
2193
|
+
/**
|
|
2194
|
+
* Your consent to appear on public boards. `true` joins, `false` leaves; your
|
|
2195
|
+
* own standing is unaffected. Each change is recorded with its time. Joining
|
|
2196
|
+
* gives you a generated handle and avatar if you have none yet.
|
|
2197
|
+
*/
|
|
2198
|
+
leaderboard_opt_in?: boolean | null;
|
|
2199
|
+
/** Fields the server added after this SDK was generated. */
|
|
2200
|
+
[key: string]: unknown;
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* One recent trade on the market.
|
|
1816
2204
|
*/
|
|
1817
2205
|
interface RecentTrade {
|
|
1818
2206
|
/**
|
|
1819
2207
|
* Which side took liquidity. `Trade.liquidity_taker/1` derives this from the
|
|
1820
|
-
* resting side, so the values are `buyer` and `seller
|
|
2208
|
+
* resting side, so the values are `buyer` and `seller`, not `buy`/`sell` as
|
|
1821
2209
|
* on an order's `action`. One of: `buyer`, `seller`.
|
|
1822
2210
|
*/
|
|
1823
2211
|
liquidity_taker?: string | null;
|
|
@@ -1967,7 +2355,7 @@ interface StatDetail {
|
|
|
1967
2355
|
*/
|
|
1968
2356
|
prop_type?: string | null;
|
|
1969
2357
|
/**
|
|
1970
|
-
* The stat
|
|
2358
|
+
* The stat the line is on, e.g. `passingYards`.
|
|
1971
2359
|
*/
|
|
1972
2360
|
stat?: string | null;
|
|
1973
2361
|
/**
|
|
@@ -2035,7 +2423,7 @@ interface Transaction {
|
|
|
2035
2423
|
*/
|
|
2036
2424
|
time?: string | null;
|
|
2037
2425
|
/**
|
|
2038
|
-
* What moved the money or the points
|
|
2426
|
+
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
2039
2427
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
2040
2428
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
2041
2429
|
* `fee_refund`, `casino`, `adjustment`, `loyalty`, `loyalty_points_rollup`,
|
|
@@ -2052,6 +2440,9 @@ type models_Cancellation = Cancellation;
|
|
|
2052
2440
|
type models_Event = Event;
|
|
2053
2441
|
type models_FeeTransaction = FeeTransaction;
|
|
2054
2442
|
type models_Fill = Fill;
|
|
2443
|
+
type models_Leaderboard = Leaderboard;
|
|
2444
|
+
type models_LeaderboardEntry = LeaderboardEntry;
|
|
2445
|
+
type models_LeaderboardStanding = LeaderboardStanding;
|
|
2055
2446
|
type models_Market = Market;
|
|
2056
2447
|
type models_MarketFilter = MarketFilter;
|
|
2057
2448
|
type models_MarketStat = MarketStat;
|
|
@@ -2060,16 +2451,17 @@ type models_NewOrder = NewOrder;
|
|
|
2060
2451
|
type models_Order = Order;
|
|
2061
2452
|
type models_PaymentTransaction = PaymentTransaction;
|
|
2062
2453
|
type models_Position = Position;
|
|
2454
|
+
type models_ProfileUpdate = ProfileUpdate;
|
|
2063
2455
|
type models_RecentTrade = RecentTrade;
|
|
2064
2456
|
type models_Settlement = Settlement;
|
|
2065
2457
|
type models_StatDetail = StatDetail;
|
|
2066
2458
|
type models_Transaction = Transaction;
|
|
2067
2459
|
declare namespace models {
|
|
2068
|
-
export type { models_Balance as Balance, models_BookLevel as BookLevel, models_Cancellation as Cancellation, Error$1 as Error, models_Event as Event, models_FeeTransaction as FeeTransaction, models_Fill as Fill, models_Market as Market, models_MarketFilter as MarketFilter, models_MarketStat as MarketStat, models_Me as Me, models_NewOrder as NewOrder, models_Order as Order, models_PaymentTransaction as PaymentTransaction, models_Position as Position, models_RecentTrade as RecentTrade, models_Settlement as Settlement, models_StatDetail as StatDetail, models_Transaction as Transaction };
|
|
2460
|
+
export type { models_Balance as Balance, models_BookLevel as BookLevel, models_Cancellation as Cancellation, Error$1 as Error, models_Event as Event, models_FeeTransaction as FeeTransaction, models_Fill as Fill, models_Leaderboard as Leaderboard, models_LeaderboardEntry as LeaderboardEntry, models_LeaderboardStanding as LeaderboardStanding, models_Market as Market, models_MarketFilter as MarketFilter, models_MarketStat as MarketStat, models_Me as Me, models_NewOrder as NewOrder, models_Order as Order, models_PaymentTransaction as PaymentTransaction, models_Position as Position, models_ProfileUpdate as ProfileUpdate, models_RecentTrade as RecentTrade, models_Settlement as Settlement, models_StatDetail as StatDetail, models_Transaction as Transaction };
|
|
2069
2461
|
}
|
|
2070
2462
|
|
|
2071
2463
|
interface Operation {
|
|
2072
|
-
readonly method: "GET" | "POST" | "DELETE";
|
|
2464
|
+
readonly method: "GET" | "POST" | "PATCH" | "DELETE";
|
|
2073
2465
|
readonly path: string;
|
|
2074
2466
|
readonly query: readonly string[];
|
|
2075
2467
|
readonly pathParams: readonly string[];
|
|
@@ -2113,6 +2505,17 @@ declare const OPERATIONS: {
|
|
|
2113
2505
|
readonly isList: true;
|
|
2114
2506
|
readonly paginated: true;
|
|
2115
2507
|
};
|
|
2508
|
+
readonly events__id_players_get: {
|
|
2509
|
+
readonly method: "GET";
|
|
2510
|
+
readonly path: "/api/v1/events/{event_id}/players";
|
|
2511
|
+
readonly query: readonly [];
|
|
2512
|
+
readonly pathParams: readonly ["event_id"];
|
|
2513
|
+
readonly hasBody: false;
|
|
2514
|
+
readonly responseKey: "";
|
|
2515
|
+
readonly model: "";
|
|
2516
|
+
readonly isList: false;
|
|
2517
|
+
readonly paginated: false;
|
|
2518
|
+
};
|
|
2116
2519
|
readonly fills_get: {
|
|
2117
2520
|
readonly method: "GET";
|
|
2118
2521
|
readonly path: "/api/v1/fills";
|
|
@@ -2124,6 +2527,28 @@ declare const OPERATIONS: {
|
|
|
2124
2527
|
readonly isList: true;
|
|
2125
2528
|
readonly paginated: true;
|
|
2126
2529
|
};
|
|
2530
|
+
readonly leaderboard_get: {
|
|
2531
|
+
readonly method: "GET";
|
|
2532
|
+
readonly path: "/api/v1/leaderboard";
|
|
2533
|
+
readonly query: readonly ["period", "category", "metric", "limit"];
|
|
2534
|
+
readonly pathParams: readonly [];
|
|
2535
|
+
readonly hasBody: false;
|
|
2536
|
+
readonly responseKey: "";
|
|
2537
|
+
readonly model: "";
|
|
2538
|
+
readonly isList: false;
|
|
2539
|
+
readonly paginated: false;
|
|
2540
|
+
};
|
|
2541
|
+
readonly leaderboard_me_get: {
|
|
2542
|
+
readonly method: "GET";
|
|
2543
|
+
readonly path: "/api/v1/leaderboard/me";
|
|
2544
|
+
readonly query: readonly ["period", "category"];
|
|
2545
|
+
readonly pathParams: readonly [];
|
|
2546
|
+
readonly hasBody: false;
|
|
2547
|
+
readonly responseKey: "";
|
|
2548
|
+
readonly model: "";
|
|
2549
|
+
readonly isList: false;
|
|
2550
|
+
readonly paginated: false;
|
|
2551
|
+
};
|
|
2127
2552
|
readonly markets_get: {
|
|
2128
2553
|
readonly method: "GET";
|
|
2129
2554
|
readonly path: "/api/v1/markets";
|
|
@@ -2135,6 +2560,17 @@ declare const OPERATIONS: {
|
|
|
2135
2560
|
readonly isList: true;
|
|
2136
2561
|
readonly paginated: true;
|
|
2137
2562
|
};
|
|
2563
|
+
readonly markets_post: {
|
|
2564
|
+
readonly method: "POST";
|
|
2565
|
+
readonly path: "/api/v1/markets";
|
|
2566
|
+
readonly query: readonly [];
|
|
2567
|
+
readonly pathParams: readonly [];
|
|
2568
|
+
readonly hasBody: true;
|
|
2569
|
+
readonly responseKey: "";
|
|
2570
|
+
readonly model: "";
|
|
2571
|
+
readonly isList: false;
|
|
2572
|
+
readonly paginated: false;
|
|
2573
|
+
};
|
|
2138
2574
|
readonly me_get: {
|
|
2139
2575
|
readonly method: "GET";
|
|
2140
2576
|
readonly path: "/api/v1/me";
|
|
@@ -2146,6 +2582,17 @@ declare const OPERATIONS: {
|
|
|
2146
2582
|
readonly isList: false;
|
|
2147
2583
|
readonly paginated: false;
|
|
2148
2584
|
};
|
|
2585
|
+
readonly me_profile_patch: {
|
|
2586
|
+
readonly method: "PATCH";
|
|
2587
|
+
readonly path: "/api/v1/me/profile";
|
|
2588
|
+
readonly query: readonly [];
|
|
2589
|
+
readonly pathParams: readonly [];
|
|
2590
|
+
readonly hasBody: true;
|
|
2591
|
+
readonly responseKey: "me";
|
|
2592
|
+
readonly model: "Me";
|
|
2593
|
+
readonly isList: false;
|
|
2594
|
+
readonly paginated: false;
|
|
2595
|
+
};
|
|
2149
2596
|
readonly orders_get: {
|
|
2150
2597
|
readonly method: "GET";
|
|
2151
2598
|
readonly path: "/api/v1/orders";
|
|
@@ -2173,7 +2620,7 @@ declare const OPERATIONS: {
|
|
|
2173
2620
|
readonly path: "/api/v1/orders/all";
|
|
2174
2621
|
readonly query: readonly [];
|
|
2175
2622
|
readonly pathParams: readonly [];
|
|
2176
|
-
readonly hasBody:
|
|
2623
|
+
readonly hasBody: true;
|
|
2177
2624
|
readonly responseKey: "cancellations";
|
|
2178
2625
|
readonly model: "Cancellation";
|
|
2179
2626
|
readonly isList: true;
|
|
@@ -2206,7 +2653,7 @@ declare const OPERATIONS: {
|
|
|
2206
2653
|
readonly path: "/api/v1/orders/{order_id}";
|
|
2207
2654
|
readonly query: readonly [];
|
|
2208
2655
|
readonly pathParams: readonly ["order_id"];
|
|
2209
|
-
readonly hasBody:
|
|
2656
|
+
readonly hasBody: true;
|
|
2210
2657
|
readonly responseKey: "";
|
|
2211
2658
|
readonly model: "";
|
|
2212
2659
|
readonly isList: false;
|
|
@@ -2364,7 +2811,7 @@ declare class STXAPIException extends STXException {
|
|
|
2364
2811
|
declare class STXValidationException extends STXAPIException {
|
|
2365
2812
|
}
|
|
2366
2813
|
/**
|
|
2367
|
-
* 401: the signature, key
|
|
2814
|
+
* 401: the signature, key ID or timestamp was not accepted. A machine clock
|
|
2368
2815
|
* more than 30 seconds off also lands here.
|
|
2369
2816
|
*/
|
|
2370
2817
|
declare class STXAuthenticationException extends STXAPIException {
|
|
@@ -2455,6 +2902,55 @@ declare class STXChannelException extends STXException {
|
|
|
2455
2902
|
*/
|
|
2456
2903
|
declare class STXTimeoutException extends STXChannelException {
|
|
2457
2904
|
}
|
|
2905
|
+
/**
|
|
2906
|
+
* Combos are not available on this environment: the exchange refused the
|
|
2907
|
+
* join to the player or maker topic with `unmatched topic`. Nothing else is
|
|
2908
|
+
* affected. Preview: combos are available on US demo.
|
|
2909
|
+
*/
|
|
2910
|
+
declare class STXCombosUnavailableException extends STXChannelException {
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* The exchange refused a combo command or join. `code` is the refusal
|
|
2914
|
+
* (`not_found`, `insufficient_assets`, `player_refused`, ...); for
|
|
2915
|
+
* `player_refused:<reason>` the part after the first colon is in `detail`.
|
|
2916
|
+
* `command` is the event that was refused, e.g. `accept`. `reason` (from
|
|
2917
|
+
* `STXChannelException`) is the full string as sent.
|
|
2918
|
+
*/
|
|
2919
|
+
declare class STXComboRefusedException extends STXChannelException {
|
|
2920
|
+
readonly command: string;
|
|
2921
|
+
readonly code: string;
|
|
2922
|
+
readonly detail: string | undefined;
|
|
2923
|
+
constructor(message: string, opts: {
|
|
2924
|
+
topic?: string;
|
|
2925
|
+
reply?: unknown;
|
|
2926
|
+
command: string;
|
|
2927
|
+
code: string;
|
|
2928
|
+
detail?: string;
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2931
|
+
/**
|
|
2932
|
+
* `accept` found nothing live at the accepted amount or better. The request
|
|
2933
|
+
* stays open. `best` is the live best quote now; its fields are null when
|
|
2934
|
+
* nothing is live. Accept again at `best.amount` to take it.
|
|
2935
|
+
*/
|
|
2936
|
+
declare class STXComboPriceMovedException extends STXComboRefusedException {
|
|
2937
|
+
readonly best: {
|
|
2938
|
+
quote_id: string | null;
|
|
2939
|
+
amount: string | null;
|
|
2940
|
+
expires_at: number | null;
|
|
2941
|
+
};
|
|
2942
|
+
constructor(message: string, opts: {
|
|
2943
|
+
topic?: string;
|
|
2944
|
+
reply?: unknown;
|
|
2945
|
+
command: string;
|
|
2946
|
+
code: string;
|
|
2947
|
+
best: {
|
|
2948
|
+
quote_id: string | null;
|
|
2949
|
+
amount: string | null;
|
|
2950
|
+
expires_at: number | null;
|
|
2951
|
+
};
|
|
2952
|
+
});
|
|
2953
|
+
}
|
|
2458
2954
|
/** Build the exception for one non-2xx response. */
|
|
2459
2955
|
declare function errorForStatus(statusCode: number, body: unknown, opts: {
|
|
2460
2956
|
method: string;
|
|
@@ -2525,7 +3021,7 @@ declare function loadPrivateKey(value: PrivateKeyInput): KeyObject;
|
|
|
2525
3021
|
*/
|
|
2526
3022
|
declare function signerFromPrivateKey(value: PrivateKeyInput): Signer;
|
|
2527
3023
|
/**
|
|
2528
|
-
* An STX API key: the key
|
|
3024
|
+
* An STX API key: the key ID sent with every request, and the means of
|
|
2529
3025
|
* signing. Build one from a PEM string or path:
|
|
2530
3026
|
*
|
|
2531
3027
|
* new ApiKeyCredentials("my-key-id", "~/.stx/ontario.pem")
|
|
@@ -2556,8 +3052,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
2556
3052
|
toString(): string;
|
|
2557
3053
|
}
|
|
2558
3054
|
|
|
2559
|
-
declare const VERSION = "0.
|
|
2560
|
-
declare const USER_AGENT = "stx-typescript/0.
|
|
3055
|
+
declare const VERSION = "0.8.1";
|
|
3056
|
+
declare const USER_AGENT = "stx-typescript/0.8.1";
|
|
2561
3057
|
/**
|
|
2562
3058
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
2563
3059
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -2654,6 +3150,353 @@ declare class AccountView {
|
|
|
2654
3150
|
close(): Promise<void>;
|
|
2655
3151
|
}
|
|
2656
3152
|
|
|
3153
|
+
/** What the combination needs of a leg. */
|
|
3154
|
+
type ComboOutcome = "won" | "lost";
|
|
3155
|
+
/** One leg of a quote request. */
|
|
3156
|
+
interface ComboLeg {
|
|
3157
|
+
/** An `open`, ordinary (not combination) market. */
|
|
3158
|
+
marketId: string;
|
|
3159
|
+
outcome: ComboOutcome;
|
|
3160
|
+
}
|
|
3161
|
+
/** Options for `STXWebSocket.comboPlayer()` and `STXWebSocket.comboMaker()`. */
|
|
3162
|
+
interface ComboJoinOptions<E> {
|
|
3163
|
+
/**
|
|
3164
|
+
* A geolocation packet, or a function returning one, sent on every join
|
|
3165
|
+
* where the exchange is geo-fenced. A function is called again on each
|
|
3166
|
+
* rejoin, so a reconnect sends a fresh packet.
|
|
3167
|
+
*/
|
|
3168
|
+
geoLocation?: GeoLocationProvider;
|
|
3169
|
+
/** Called for every typed event, as it arrives. */
|
|
3170
|
+
onEvent?: (event: E) => void | Promise<void>;
|
|
3171
|
+
}
|
|
3172
|
+
/** The join reply on either topic. */
|
|
3173
|
+
interface ComboJoinReply {
|
|
3174
|
+
/** Your account's pseudonym for counterparties. Makers see the player's on requests and quotes. */
|
|
3175
|
+
external_id: string;
|
|
3176
|
+
/** ISO 8601 time the geolocation packet expires, or null when no packet was needed. Rejoin before it. */
|
|
3177
|
+
next_geolocation_at: string | null;
|
|
3178
|
+
}
|
|
3179
|
+
/** `requestQuote()` reply. */
|
|
3180
|
+
interface ComboRequestReply {
|
|
3181
|
+
rfq_id: string;
|
|
3182
|
+
}
|
|
3183
|
+
/** `cashOut()` reply. */
|
|
3184
|
+
interface ComboCashOutReply {
|
|
3185
|
+
rfq_id: string;
|
|
3186
|
+
/** The combination being sold. */
|
|
3187
|
+
market_id: string;
|
|
3188
|
+
/** Contracts to sell, set by the exchange: what you hold less your resting sells. */
|
|
3189
|
+
quantity: string;
|
|
3190
|
+
}
|
|
3191
|
+
/** `accept()` reply: what was placed for the player, not what filled. */
|
|
3192
|
+
interface ComboPlacement {
|
|
3193
|
+
market_id: string;
|
|
3194
|
+
/** The player's order. Its fills arrive on `fills`. */
|
|
3195
|
+
order_id: string;
|
|
3196
|
+
quantity: string;
|
|
3197
|
+
price: string;
|
|
3198
|
+
}
|
|
3199
|
+
/** `cancel()` reply. */
|
|
3200
|
+
interface ComboCancelReply {
|
|
3201
|
+
/** The `rfq_id` that was cancelled. */
|
|
3202
|
+
cancelled: string;
|
|
3203
|
+
}
|
|
3204
|
+
/** The best live quote. All three fields are null when nothing is live. */
|
|
3205
|
+
interface ComboBestQuote {
|
|
3206
|
+
quote_id: string | null;
|
|
3207
|
+
amount: string | null;
|
|
3208
|
+
/** Microseconds since the Unix epoch. */
|
|
3209
|
+
expires_at: number | null;
|
|
3210
|
+
}
|
|
3211
|
+
/** `snapshot()` reply. */
|
|
3212
|
+
interface ComboSnapshot {
|
|
3213
|
+
rfq_id: string;
|
|
3214
|
+
/** Null on a buy until a bind places; the combination on a cash out. */
|
|
3215
|
+
market_id: string | null;
|
|
3216
|
+
/** `binding` while an acceptance waits for its next bind attempt. */
|
|
3217
|
+
status: "open" | "binding";
|
|
3218
|
+
/** The player's side: `buy` for a request, `sell` for a cash out. */
|
|
3219
|
+
side: "buy" | "sell";
|
|
3220
|
+
/** The stake on a buy; null on a cash out. */
|
|
3221
|
+
amount: string | null;
|
|
3222
|
+
/** The size on a cash out; null on a buy. */
|
|
3223
|
+
quantity: string | null;
|
|
3224
|
+
/** When the request ends, in microseconds since the Unix epoch. */
|
|
3225
|
+
expires_at: number;
|
|
3226
|
+
best_quote: ComboBestQuote;
|
|
3227
|
+
}
|
|
3228
|
+
/** `quote()` reply. It carries no price or size: the bind sets those. */
|
|
3229
|
+
interface ComboQuoteReply {
|
|
3230
|
+
quote_id: string;
|
|
3231
|
+
/** The amount as recorded. */
|
|
3232
|
+
amount: string;
|
|
3233
|
+
/** The player's `external_id`. */
|
|
3234
|
+
external_id: string;
|
|
3235
|
+
}
|
|
3236
|
+
/** `withdrawQuote()` reply. */
|
|
3237
|
+
interface ComboWithdrawReply {
|
|
3238
|
+
/** The `quote_id` that was withdrawn. */
|
|
3239
|
+
withdrawn: string;
|
|
3240
|
+
}
|
|
3241
|
+
/** Why a player's request ended without placing. */
|
|
3242
|
+
type ComboRequestClosedReason = "cancelled" | "expired" | "leg_not_quotable" | "unknown_leg" | "player_refused" | "maker_refused";
|
|
3243
|
+
/** `best_quote`: the best quote changed. */
|
|
3244
|
+
interface ComboBestQuoteEvent extends ComboBestQuote {
|
|
3245
|
+
rfq_id: string;
|
|
3246
|
+
market_id: string | null;
|
|
3247
|
+
}
|
|
3248
|
+
/** `placed`: the bind placed. The `accept()` reply plus `rfq_id`. */
|
|
3249
|
+
interface ComboPlacedEvent extends ComboPlacement {
|
|
3250
|
+
rfq_id: string;
|
|
3251
|
+
}
|
|
3252
|
+
/** `negotiation_closed` to the player: the request ended without placing. */
|
|
3253
|
+
interface ComboRequestClosedEvent {
|
|
3254
|
+
rfq_id: string;
|
|
3255
|
+
market_id: string | null;
|
|
3256
|
+
reason: ComboRequestClosedReason;
|
|
3257
|
+
}
|
|
3258
|
+
/** An event on the player's topic. Narrow on `event`. */
|
|
3259
|
+
type ComboPlayerEvent = {
|
|
3260
|
+
event: "best_quote";
|
|
3261
|
+
payload: ComboBestQuoteEvent;
|
|
3262
|
+
} | {
|
|
3263
|
+
event: "placed";
|
|
3264
|
+
payload: ComboPlacedEvent;
|
|
3265
|
+
} | {
|
|
3266
|
+
event: "negotiation_closed";
|
|
3267
|
+
payload: ComboRequestClosedEvent;
|
|
3268
|
+
};
|
|
3269
|
+
/** One leg as makers see it. */
|
|
3270
|
+
interface ComboRfqLeg {
|
|
3271
|
+
market_id: string;
|
|
3272
|
+
outcome: ComboOutcome;
|
|
3273
|
+
short_name: string;
|
|
3274
|
+
}
|
|
3275
|
+
/** `rfq_opened`: a player opened a request. */
|
|
3276
|
+
interface ComboRfqOpenedEvent {
|
|
3277
|
+
rfq_id: string;
|
|
3278
|
+
/** Null on a buy; the combination on a cash out. */
|
|
3279
|
+
market_id: string | null;
|
|
3280
|
+
/** The player's pseudonym. */
|
|
3281
|
+
external_id: string;
|
|
3282
|
+
/** The player's side; the maker takes the other. */
|
|
3283
|
+
side: "buy" | "sell";
|
|
3284
|
+
/** The stake on a buy; null on a cash out. */
|
|
3285
|
+
amount: string | null;
|
|
3286
|
+
/** The size on a cash out; null on a buy. */
|
|
3287
|
+
quantity: string | null;
|
|
3288
|
+
/** Price against this, not a constant. */
|
|
3289
|
+
max_price: string;
|
|
3290
|
+
/** Price against this, not a constant. */
|
|
3291
|
+
tick_size: string;
|
|
3292
|
+
expires_at: number;
|
|
3293
|
+
legs: ComboRfqLeg[];
|
|
3294
|
+
}
|
|
3295
|
+
/** Why a request ended, as the feed reports it. */
|
|
3296
|
+
type ComboRfqClosedReason = "placed" | "cancelled" | "expired" | "leg_not_quotable" | "unknown_leg" | "player_refused" | "maker_refused" | "ended";
|
|
3297
|
+
/** `rfq_closed`: a request ended. */
|
|
3298
|
+
interface ComboRfqClosedEvent {
|
|
3299
|
+
rfq_id: string;
|
|
3300
|
+
market_id: string | null;
|
|
3301
|
+
reason: ComboRfqClosedReason;
|
|
3302
|
+
}
|
|
3303
|
+
/** `quote_accepted`: this quote is about to be bound. */
|
|
3304
|
+
interface ComboQuoteAcceptedEvent {
|
|
3305
|
+
rfq_id: string;
|
|
3306
|
+
market_id: string | null;
|
|
3307
|
+
external_id: string;
|
|
3308
|
+
quote_id: string;
|
|
3309
|
+
}
|
|
3310
|
+
/** `placed` to the maker: this quote bound and the maker's order was placed. Both orders share the size and price. */
|
|
3311
|
+
interface ComboMakerPlacedEvent {
|
|
3312
|
+
rfq_id: string;
|
|
3313
|
+
market_id: string;
|
|
3314
|
+
external_id: string;
|
|
3315
|
+
quote_id: string;
|
|
3316
|
+
/** The maker's order. Its fills arrive on `fills`. */
|
|
3317
|
+
order_id: string;
|
|
3318
|
+
quantity: string;
|
|
3319
|
+
price: string;
|
|
3320
|
+
}
|
|
3321
|
+
/** Why one of the maker's quotes stopped standing. */
|
|
3322
|
+
type ComboQuoteClosedReason = "placed_elsewhere" | "maker_refused" | "cancelled" | "expired" | "leg_not_quotable" | "unknown_leg" | "player_refused";
|
|
3323
|
+
/** `negotiation_closed` to the maker: this quote stopped standing. */
|
|
3324
|
+
interface ComboQuoteClosedEvent {
|
|
3325
|
+
rfq_id: string;
|
|
3326
|
+
market_id: string | null;
|
|
3327
|
+
external_id: string;
|
|
3328
|
+
quote_id: string;
|
|
3329
|
+
reason: ComboQuoteClosedReason;
|
|
3330
|
+
}
|
|
3331
|
+
/** An event on the maker's topic. Narrow on `event`. */
|
|
3332
|
+
type ComboMakerEvent = {
|
|
3333
|
+
event: "rfq_opened";
|
|
3334
|
+
payload: ComboRfqOpenedEvent;
|
|
3335
|
+
} | {
|
|
3336
|
+
event: "rfq_closed";
|
|
3337
|
+
payload: ComboRfqClosedEvent;
|
|
3338
|
+
} | {
|
|
3339
|
+
event: "quote_accepted";
|
|
3340
|
+
payload: ComboQuoteAcceptedEvent;
|
|
3341
|
+
} | {
|
|
3342
|
+
event: "placed";
|
|
3343
|
+
payload: ComboMakerPlacedEvent;
|
|
3344
|
+
} | {
|
|
3345
|
+
event: "negotiation_closed";
|
|
3346
|
+
payload: ComboQuoteClosedEvent;
|
|
3347
|
+
};
|
|
3348
|
+
/**
|
|
3349
|
+
* A refusal `reason` the exchange documents for combo commands. The type stays
|
|
3350
|
+
* open (`string`) because a few reasons are sentences passed through verbatim.
|
|
3351
|
+
*/
|
|
3352
|
+
type ComboRefusalReason = "malformed_payload" | "malformed_id" | "malformed_money" | "malformed_leg" | "malformed_client_order_id" | "unknown_command" | "not_found" | "timeout" | "request_unavailable" | "not_the_requester" | "combo_minimum_two_markets_needed" | "combo_maximum_legs_exceeded" | "unknown_outcome" | "non_positive_amount" | "sub_cent_amount" | "insufficient_assets" | "draining" | "account_unreachable" | "unknown_leg" | "leg_not_quotable" | "duplicate_legs" | "request_not_started" | "unknown_combination" | "market_not_quotable" | "combination_unavailable" | "nothing_to_sell" | "price_moved" | "player_refused" | "maker_refused" | "market_not_trading" | "market_unavailable" | "price_out_of_range" | "below_one_contract" | "bind_in_progress" | "cancelled" | "expired" | "expires_at_required" | "cannot_quote_own_request" | "unknown_quote" | "unauthorized" | "insufficient_scope" | (string & {});
|
|
3353
|
+
/** What the player and maker sessions share: the joined channel, typed events and waiting. */
|
|
3354
|
+
declare abstract class ComboSession<E extends {
|
|
3355
|
+
event: string;
|
|
3356
|
+
payload: {
|
|
3357
|
+
rfq_id: string;
|
|
3358
|
+
};
|
|
3359
|
+
}> implements AsyncIterable<E> {
|
|
3360
|
+
#private;
|
|
3361
|
+
/** The underlying channel. Its `reply` is the latest join reply. */
|
|
3362
|
+
readonly channel: Channel;
|
|
3363
|
+
/** @internal */
|
|
3364
|
+
constructor(channel: Channel, events: ReadonlySet<string>, onEvent: ((event: E) => void | Promise<void>) | undefined);
|
|
3365
|
+
/** Your account's pseudonym for counterparties, from the join reply. */
|
|
3366
|
+
get externalId(): string;
|
|
3367
|
+
/** When the geolocation packet this join used expires (ISO 8601), or null. Rejoin before it. */
|
|
3368
|
+
get nextGeolocationAt(): string | null;
|
|
3369
|
+
/** @internal */
|
|
3370
|
+
_typed(msg: ChannelMessage): E | undefined;
|
|
3371
|
+
/** @internal Called for every message on the channel, before it is queued. */
|
|
3372
|
+
_receive(msg: ChannelMessage): Promise<void>;
|
|
3373
|
+
/** The events received so far (the latest 1000), oldest first. */
|
|
3374
|
+
get events(): readonly E[];
|
|
3375
|
+
/**
|
|
3376
|
+
* The next event, in arrival order. Rejects with `STXTimeoutException` when
|
|
3377
|
+
* none arrives within `timeoutMs`, and with `STXChannelException` once the
|
|
3378
|
+
* channel is closed. Use either this or `for await`, not both.
|
|
3379
|
+
*/
|
|
3380
|
+
next(timeoutMs?: number | null): Promise<E>;
|
|
3381
|
+
[Symbol.asyncIterator](): AsyncIterator<E>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Resolve with the first event named `event` (or one of several) for
|
|
3384
|
+
* `rfqId`, looking first at events already received. Unlike `next()`, it
|
|
3385
|
+
* takes nothing from the queue. Rejects with `STXTimeoutException` after
|
|
3386
|
+
* `timeoutMs` (default 10000).
|
|
3387
|
+
*
|
|
3388
|
+
* @param event An event name, or several.
|
|
3389
|
+
* @param opts.rfqId Only events for this request.
|
|
3390
|
+
* @param opts.quoteId Only events for this quote (maker events).
|
|
3391
|
+
* @param opts.timeoutMs Milliseconds to wait. Default 10000.
|
|
3392
|
+
*/
|
|
3393
|
+
waitFor<K extends E["event"]>(event: K | readonly K[], opts?: {
|
|
3394
|
+
rfqId?: string;
|
|
3395
|
+
quoteId?: string;
|
|
3396
|
+
timeoutMs?: number;
|
|
3397
|
+
}): Promise<Extract<E, {
|
|
3398
|
+
event: K;
|
|
3399
|
+
}>>;
|
|
3400
|
+
/** Leave the topic. Requests opened and quotes placed on this channel end, as on any close. */
|
|
3401
|
+
leave(): Promise<void>;
|
|
3402
|
+
/** @internal Send a command and map a refusal to the combo exceptions. */
|
|
3403
|
+
_command<T>(command: string, payload: Record<string, unknown>, timeoutMs?: number): Promise<T>;
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* The player's side of combos, on `rfq:<user_id>`. Get one with
|
|
3407
|
+
* `ws.comboPlayer()`.
|
|
3408
|
+
*
|
|
3409
|
+
* Preview: available on US demo; may change before general availability.
|
|
3410
|
+
*
|
|
3411
|
+
* A request belongs to this channel: leaving, a dropped socket or a geo lapse
|
|
3412
|
+
* ends it `cancelled`, and the SDK's automatic rejoin does not bring it back.
|
|
3413
|
+
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
3414
|
+
* `reason` in `code`.
|
|
3415
|
+
*/
|
|
3416
|
+
declare class ComboPlayer extends ComboSession<ComboPlayerEvent> {
|
|
3417
|
+
/** @internal */
|
|
3418
|
+
constructor(channel: Channel, onEvent?: (event: ComboPlayerEvent) => void | Promise<void>);
|
|
3419
|
+
/**
|
|
3420
|
+
* `request_quote`: ask makers to quote on these legs for a stake. `amount`
|
|
3421
|
+
* is the stake as a decimal string in whole cents, e.g. `"250.00"`. Makers
|
|
3422
|
+
* quote what you win; quotes arrive as `best_quote` events.
|
|
3423
|
+
*
|
|
3424
|
+
* @param legs Two or more `open` markets and the outcome the combination needs of each.
|
|
3425
|
+
* @param amount The stake in dollars, e.g. `"250.00"`.
|
|
3426
|
+
*/
|
|
3427
|
+
requestQuote(legs: readonly ComboLeg[], amount: string): Promise<ComboRequestReply>;
|
|
3428
|
+
/**
|
|
3429
|
+
* `cash_out`: ask makers to quote for what you hold of a combination, by the
|
|
3430
|
+
* `market_id` from `placed`. The exchange sets the size.
|
|
3431
|
+
*
|
|
3432
|
+
* @param marketId The combination's market id.
|
|
3433
|
+
*/
|
|
3434
|
+
cashOut(marketId: string): Promise<ComboCashOutReply>;
|
|
3435
|
+
/**
|
|
3436
|
+
* `accept`: bind the request at `amount` or more, normally the amount
|
|
3437
|
+
* `best_quote` showed. The best live quote binds whoever made it, so the
|
|
3438
|
+
* placement can be better than `amount`. Waits up to 35 s.
|
|
3439
|
+
*
|
|
3440
|
+
* Throws `STXComboPriceMovedException` (with the live `best`) when nothing
|
|
3441
|
+
* at least as good is live; the request stays open and you can accept again.
|
|
3442
|
+
* The reply says what was placed; fills arrive on `fills`.
|
|
3443
|
+
*
|
|
3444
|
+
* @param rfqId The request.
|
|
3445
|
+
* @param quoteId The quote you saw, normally from `best_quote`.
|
|
3446
|
+
* @param amount The least amount you take, e.g. `"1750.00"`.
|
|
3447
|
+
*/
|
|
3448
|
+
accept(rfqId: string, quoteId: string, amount: string): Promise<ComboPlacement>;
|
|
3449
|
+
/**
|
|
3450
|
+
* `cancel`: end the request and drop every quote on it.
|
|
3451
|
+
*
|
|
3452
|
+
* @param rfqId The request.
|
|
3453
|
+
*/
|
|
3454
|
+
cancel(rfqId: string): Promise<ComboCancelReply>;
|
|
3455
|
+
/**
|
|
3456
|
+
* `snapshot`: the request now, with the live best quote. Not delayed like `best_quote` events.
|
|
3457
|
+
*
|
|
3458
|
+
* @param rfqId The request.
|
|
3459
|
+
*/
|
|
3460
|
+
snapshot(rfqId: string): Promise<ComboSnapshot>;
|
|
3461
|
+
}
|
|
3462
|
+
/**
|
|
3463
|
+
* The maker's side of combos, on `combo_quote:<user_id>`. Get one with
|
|
3464
|
+
* `ws.comboMaker()`. Joining subscribes to every request opened after the
|
|
3465
|
+
* join (`rfq_opened`); earlier requests are not replayed.
|
|
3466
|
+
*
|
|
3467
|
+
* Preview: available on US demo; may change before general availability.
|
|
3468
|
+
*
|
|
3469
|
+
* A quote belongs to this channel: leaving or a dropped socket withdraws it.
|
|
3470
|
+
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
3471
|
+
* `reason` in `code`.
|
|
3472
|
+
*/
|
|
3473
|
+
declare class ComboMaker extends ComboSession<ComboMakerEvent> {
|
|
3474
|
+
/** @internal */
|
|
3475
|
+
constructor(channel: Channel, onEvent?: (event: ComboMakerEvent) => void | Promise<void>);
|
|
3476
|
+
/**
|
|
3477
|
+
* `quote`: offer `amount` on a request. On a buy it is what the player wins;
|
|
3478
|
+
* on a cash out, what you pay for the whole size. Price it against the
|
|
3479
|
+
* request's `max_price` and `tick_size`. `expiresInMs` (a positive integer)
|
|
3480
|
+
* counts from receipt; the quote ends no later than its request.
|
|
3481
|
+
* `clientOrderId` (at most 255 bytes) is copied onto your order if it binds.
|
|
3482
|
+
*
|
|
3483
|
+
* @param rfqId The request, from `rfq_opened`.
|
|
3484
|
+
* @param amount In dollars, e.g. `"1750.00"`.
|
|
3485
|
+
* @param expiresInMs How long the quote stands, in milliseconds.
|
|
3486
|
+
* @param opts.clientOrderId Copied onto your order if the quote binds.
|
|
3487
|
+
*/
|
|
3488
|
+
quote(rfqId: string, amount: string, expiresInMs: number, opts?: {
|
|
3489
|
+
clientOrderId?: string | null;
|
|
3490
|
+
}): Promise<ComboQuoteReply>;
|
|
3491
|
+
/**
|
|
3492
|
+
* `withdraw_quote`: remove one of your quotes.
|
|
3493
|
+
*
|
|
3494
|
+
* @param rfqId The request.
|
|
3495
|
+
* @param quoteId Your quote, from the `quote()` reply.
|
|
3496
|
+
*/
|
|
3497
|
+
withdrawQuote(rfqId: string, quoteId: string): Promise<ComboWithdrawReply>;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
2657
3500
|
/** Events that carry state on join, by channel name (topic prefix). */
|
|
2658
3501
|
declare const SNAPSHOT_EVENTS: Readonly<Record<string, readonly string[]>>;
|
|
2659
3502
|
/** One pushed frame. */
|
|
@@ -2712,6 +3555,8 @@ declare class Channel implements AsyncIterable<ChannelMessage> {
|
|
|
2712
3555
|
joinRef: string | null;
|
|
2713
3556
|
joined: boolean;
|
|
2714
3557
|
closed: boolean;
|
|
3558
|
+
/** @internal Runs before every (re)join, e.g. to refresh a geolocation packet in `joinPayload`. */
|
|
3559
|
+
_beforeJoin: (() => Promise<void>) | undefined;
|
|
2715
3560
|
constructor(ws: STXWebSocket, topic: string, joinPayload: Record<string, unknown>, onMessage: MessageHandler | undefined, opts: {
|
|
2716
3561
|
pingIntervalMs: number | null;
|
|
2717
3562
|
queueSize: number;
|
|
@@ -2817,7 +3662,7 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
|
|
|
2817
3662
|
* Phoenix-channels client for the documented STX topics. Build it from an
|
|
2818
3663
|
* `STX` client, which supplies the host, the key and your user id:
|
|
2819
3664
|
*
|
|
2820
|
-
* const client = new STX(
|
|
3665
|
+
* const client = new STX();
|
|
2821
3666
|
* const ws = await client.websocket().connect();
|
|
2822
3667
|
* const book = await ws.orderbook(["<market-id>"], { onMessage: console.log });
|
|
2823
3668
|
* const orders = await ws.orders();
|
|
@@ -2977,6 +3822,25 @@ declare class STXWebSocket {
|
|
|
2977
3822
|
userInfo(opts?: {
|
|
2978
3823
|
onMessage?: MessageHandler;
|
|
2979
3824
|
}): Promise<Channel>;
|
|
3825
|
+
/**
|
|
3826
|
+
* Join `rfq:{user_id}` and return a `ComboPlayer`: request quotes on a
|
|
3827
|
+
* combination, cash one out, accept, cancel and read a request.
|
|
3828
|
+
*
|
|
3829
|
+
* Preview: available on US demo; may change before general availability.
|
|
3830
|
+
* Where combos are not available, rejects with
|
|
3831
|
+
* `STXCombosUnavailableException`. Other join refusals (a read-only key, an
|
|
3832
|
+
* account that may not trade) reject with `STXComboRefusedException`.
|
|
3833
|
+
*/
|
|
3834
|
+
comboPlayer(opts?: ComboJoinOptions<ComboPlayerEvent>): Promise<ComboPlayer>;
|
|
3835
|
+
/**
|
|
3836
|
+
* Join `combo_quote:{user_id}` and return a `ComboMaker`: receive every
|
|
3837
|
+
* request opened from now on (`rfq_opened`), quote and withdraw quotes.
|
|
3838
|
+
*
|
|
3839
|
+
* Preview: available on US demo; may change before general availability.
|
|
3840
|
+
* Where combos are not available, rejects with
|
|
3841
|
+
* `STXCombosUnavailableException`.
|
|
3842
|
+
*/
|
|
3843
|
+
comboMaker(opts?: ComboJoinOptions<ComboMakerEvent>): Promise<ComboMaker>;
|
|
2980
3844
|
/**
|
|
2981
3845
|
* Join `topic` with `payload` and wait for the reply. Rejects with
|
|
2982
3846
|
* `STXChannelException` carrying the server's reason (for example
|
|
@@ -3007,7 +3871,7 @@ interface STXOptions {
|
|
|
3007
3871
|
env?: string | null;
|
|
3008
3872
|
/** A hostname or URL, overriding region/env: `"demo.stxapp.ca"`, `"http://localhost:4000"`. */
|
|
3009
3873
|
host?: string | null;
|
|
3010
|
-
/** The API key
|
|
3874
|
+
/** The API key ID. */
|
|
3011
3875
|
keyId?: string | null;
|
|
3012
3876
|
/** The Ed25519 private key: PEM text, a path to a PEM file, PEM bytes, or a KeyObject. */
|
|
3013
3877
|
privateKey?: PrivateKeyInput | null;
|
|
@@ -3082,6 +3946,7 @@ interface MarketsQuery {
|
|
|
3082
3946
|
eventIds?: StrList;
|
|
3083
3947
|
/** One status or a list, e.g. `["pre_open", "open"]`. */
|
|
3084
3948
|
status?: StrList;
|
|
3949
|
+
/** `true` for only the markets accepting orders now, `false` for only those that are not. */
|
|
3085
3950
|
trading?: boolean;
|
|
3086
3951
|
sports?: StrList;
|
|
3087
3952
|
competitions?: StrList;
|
|
@@ -3180,7 +4045,7 @@ declare function orderBody(marketId: string, action: string, orderType: string,
|
|
|
3180
4045
|
* The STX client. Configuration comes from the options, then
|
|
3181
4046
|
* environment variables, then a profile in ~/.stx/credentials:
|
|
3182
4047
|
*
|
|
3183
|
-
* const client = new STX(
|
|
4048
|
+
* const client = new STX();
|
|
3184
4049
|
* const me = await client.me();
|
|
3185
4050
|
* const page = await client.markets({ status: "open", limit: 10 });
|
|
3186
4051
|
*/
|
|
@@ -3230,6 +4095,32 @@ declare class STX {
|
|
|
3230
4095
|
events(query?: EventsQuery): Promise<Page<Event>>;
|
|
3231
4096
|
/** Every event matching the filters, following the cursor. */
|
|
3232
4097
|
iterEvents(query?: WithoutCursor<EventsQuery>): AsyncGenerator<Event, void, undefined>;
|
|
4098
|
+
/**
|
|
4099
|
+
* `GET /api/v1/events/{event_id}/players`: the event's team rosters and the
|
|
4100
|
+
* stats a market on it can use. `teams` is empty until the rosters are
|
|
4101
|
+
* published. Needs an OAuth app token with `events`, or an API key.
|
|
4102
|
+
*/
|
|
4103
|
+
eventPlayers(eventId: string): Promise<EventPlayers>;
|
|
4104
|
+
/** The stats `event` accepts for new markets. */
|
|
4105
|
+
statsFor(event: string | {
|
|
4106
|
+
event_id?: string | null;
|
|
4107
|
+
}): Promise<EventStat[]>;
|
|
4108
|
+
/**
|
|
4109
|
+
* `POST /api/v1/markets`: create player-prop markets on a scheduled event,
|
|
4110
|
+
* up to `MAX_MARKETS_PER_REQUEST` per call. Needs an OAuth app token with
|
|
4111
|
+
* `markets.write`, which STX grants, from the client's IP allow-list.
|
|
4112
|
+
*
|
|
4113
|
+
* Returns one result per market, in order: `created` or `exists` (both with
|
|
4114
|
+
* `market_id`), or `rejected` with a `reason`. A rejected market is a
|
|
4115
|
+
* result, not an error, and resending is safe: a market that is already
|
|
4116
|
+
* listed comes back `exists`. A refused request throws (`403` without
|
|
4117
|
+
* `markets.write`, `404` unknown event, `422` event not open).
|
|
4118
|
+
*
|
|
4119
|
+
* Each `line` must be a positive number ending in `.5`, e.g. `18.5`. More
|
|
4120
|
+
* than `MAX_MARKETS_PER_REQUEST` markets throws `TypeError` before any
|
|
4121
|
+
* request. `validate` also needs the `events` scope.
|
|
4122
|
+
*/
|
|
4123
|
+
createMarkets(eventId: string, markets: readonly NewMarketInput[], opts?: CreateMarketsOptions): Promise<CreateMarketResult[]>;
|
|
3233
4124
|
/** `GET /api/v1/orders`: one page of your orders, newest first. */
|
|
3234
4125
|
orders(query?: OrdersQuery): Promise<Page<Order>>;
|
|
3235
4126
|
/** Every order matching the filters, following the cursor. */
|
|
@@ -3352,4 +4243,4 @@ declare class STX {
|
|
|
3352
4243
|
websocket(opts?: Omit<STXWebSocketOptions, "rest">): STXWebSocket;
|
|
3353
4244
|
}
|
|
3354
4245
|
|
|
3355
|
-
export {
|
|
4246
|
+
export { type EventTeam as $, type AcceptTermsOptions as A, type Balance as B, type Cancellation as C, type ComboPlayerEvent as D, type ComboQuoteAcceptedEvent as E, type ComboQuoteClosedEvent as F, type ComboQuoteClosedReason as G, type ComboQuoteReply as H, type ComboRefusalReason as I, type ComboRequestClosedEvent as J, type ComboRequestClosedReason as K, type ComboRequestReply as L, type ComboRfqClosedEvent as M, type ComboRfqClosedReason as N, type ComboRfqLeg as O, type ComboRfqOpenedEvent as P, type ComboSnapshot as Q, type ComboWithdrawReply as R, type CreateMarketResult as S, type CreateMarketsOptions as T, Environment as U, Environments as V, type Error$1 as W, type Event as X, type EventPlayer as Y, type EventPlayers as Z, type EventStat as _, type AccountChange as a, STXInsufficientScopeException as a$, type EventsQuery as a0, type FeeTransaction as a1, type FetchLike as a2, type Fill as a3, type FillsQuery as a4, type GeoCheckResult as a5, type GeoLocationProvider as a6, type GeoOption as a7, type GeoRejection as a8, HOSTS as a9, Page as aA, type PageQuery as aB, type PaymentTransaction as aC, type Position as aD, type PrivateKeyInput as aE, type ProfileUpdate as aF, type RecentTrade as aG, ReconnectPolicy as aH, type ReconnectPolicyOptions as aI, Region as aJ, type ResponseEvent as aK, RetryPolicy as aL, type RetryPolicyOptions as aM, SIGNATURE_HEADER as aN, SNAPSHOT_EVENTS as aO, STX as aP, STXAPIException as aQ, STXAuthenticationException as aR, STXChannelException as aS, STXComboPriceMovedException as aT, STXComboRefusedException as aU, STXCombosUnavailableException as aV, STXConfigException as aW, type STXEnvironment as aX, STXException as aY, STXForbiddenException as aZ, STXGeoLocationException as a_, KEY_HEADER as aa, type KnownStat as ab, type Leaderboard as ac, type LeaderboardEntry as ad, type LeaderboardStanding as ae, type Logger as af, MAX_MARKETS_PER_REQUEST as ag, type Market as ah, type MarketFilter as ai, type MarketRejectionReason as aj, type MarketRequestEcho as ak, type MarketStat as al, type MarketStatsQuery as am, type MarketsQuery as an, type Me as ao, type MessageHandler as ap, NO_RETRY as aq, type NewMarketInput as ar, type NewOrder as as, type NewOrderInput as at, OPERATIONS as au, type Operation as av, type OperationId as aw, type Order as ax, type OrderOptions as ay, type OrdersQuery as az, type AccountChangeKind as b, STXInvalidTokenException as b0, STXNotFoundException as b1, type STXOptions as b2, STXRateLimitException as b3, STXRejectedException as b4, STXServerException as b5, STXTimeoutException as b6, STXTransportException as b7, STXValidationException as b8, STXWebSocket as b9, signerFromPrivateKey as bA, socketUrlFor as bB, type STXWebSocketOptions as ba, type Settlement as bb, type SettlementsQuery as bc, type Signer as bd, type Stat as be, type StatDetail as bf, Stats as bg, type StrList as bh, TERMINAL_ORDER_STATUSES as bi, TIMESTAMP_HEADER as bj, type Transaction as bk, USER_AGENT as bl, VERSION as bm, type WebSocketAuthContext as bn, baseUrlFor as bo, buildMessage as bp, environmentNamed as bq, errorForStatus as br, geoRejection as bs, handshakePath as bt, isValidLine as bu, loadPrivateKey as bv, models as bw, orderBody as bx, requestPath as by, resolveHost as bz, type AccountState as c, AccountView as d, type AccountViewOptions as e, ApiKeyCredentials as f, type AuthProvider as g, type AuthRequest as h, type BatchOrderResult as i, type BookLevel as j, Channel as k, ChannelMessage as l, type ComboBestQuote as m, type ComboBestQuoteEvent as n, type ComboCancelReply as o, type ComboCashOutReply as p, type ComboJoinOptions as q, type ComboJoinReply as r, type ComboLeg as s, ComboMaker as t, type ComboMakerEvent as u, type ComboMakerPlacedEvent as v, type ComboOutcome as w, type ComboPlacedEvent as x, type ComboPlacement as y, ComboPlayer as z };
|