@stxapp/stx-typescript 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +2 -0
- package/dist/{chunk-46XK6VDD.js → chunk-2PYJI3JS.js} +430 -159
- package/dist/chunk-2PYJI3JS.js.map +1 -0
- package/dist/{chunk-R77AZ5UH.cjs → chunk-BSX65XEA.cjs} +459 -188
- package/dist/chunk-BSX65XEA.cjs.map +1 -0
- package/dist/{client-B-MMKiRt.d.ts → client-DxY8eJ58.d.cts} +252 -156
- package/dist/{client-B-MMKiRt.d.cts → client-DxY8eJ58.d.ts} +252 -156
- package/dist/index.cjs +8 -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 +11 -5
- package/dist/oauth.cjs +30 -30
- package/dist/oauth.d.cts +2 -2
- package/dist/oauth.d.ts +2 -2
- package/dist/oauth.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-46XK6VDD.js.map +0 -1
- package/dist/chunk-R77AZ5UH.cjs.map +0 -1
|
@@ -31,7 +31,7 @@ interface WebSocketAuthContext {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** The features `STX.capabilities()` reports, by stable id. */
|
|
34
|
-
declare const FEATURES: readonly ["oauth", "oauth.member", "oauth.app", "connect", "terms.stx_page", "markets.create", "market_types", "event_players", "leaderboard", "combos"];
|
|
34
|
+
declare const FEATURES: readonly ["oauth", "oauth.member", "oauth.app", "connect", "terms.stx_page", "markets.create", "market_types", "event_players", "leaderboard", "loyalty", "combos", "orders.post_only", "orders.fill_or_kill"];
|
|
35
35
|
/** A feature id `STX.capabilities()` reports. */
|
|
36
36
|
type Feature = (typeof FEATURES)[number];
|
|
37
37
|
/**
|
|
@@ -150,36 +150,6 @@ declare function baseUrlFor(region: string | null | undefined, env: string | nul
|
|
|
150
150
|
/** The WebSocket URL for an API base URL: https maps to wss, http to ws. */
|
|
151
151
|
declare function socketUrlFor(baseUrl: string): string;
|
|
152
152
|
|
|
153
|
-
/** Why the exchange's geo-fencing refused a request. */
|
|
154
|
-
interface GeoRejection {
|
|
155
|
-
reason: "ip_not_allowed" | "packet_invalid" | "packet_other_user" | "packet_ip_mismatch" | "location_not_allowed";
|
|
156
|
-
/** The address the exchange saw, when its message names one. */
|
|
157
|
-
ipAddress?: string;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* A geolocation packet, or a function returning one (sync or async). Return
|
|
161
|
-
* `undefined` to send none for that request.
|
|
162
|
-
*/
|
|
163
|
-
type GeoLocationProvider = string | (() => string | undefined | null | Promise<string | undefined | null>);
|
|
164
|
-
/**
|
|
165
|
-
* Classify a 422 message from an order write. Returns undefined for a refusal
|
|
166
|
-
* that is not geo-fencing (funds, market closed, price step).
|
|
167
|
-
*/
|
|
168
|
-
declare function geoRejection(message: string): GeoRejection | undefined;
|
|
169
|
-
/** The outcome of `STX.geoCheck()`. */
|
|
170
|
-
interface GeoCheckResult {
|
|
171
|
-
/** True when the exchange would accept an order write from here now. */
|
|
172
|
-
allowed: boolean;
|
|
173
|
-
/** Set when `allowed` is false. */
|
|
174
|
-
reason?: GeoRejection["reason"];
|
|
175
|
-
/** The exchange's message when `allowed` is false. */
|
|
176
|
-
message?: string;
|
|
177
|
-
/** The address the exchange saw, when its message names one. */
|
|
178
|
-
ipAddress?: string;
|
|
179
|
-
/** Whether a geolocation packet was sent with the check. */
|
|
180
|
-
sentPacket: boolean;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
153
|
/**
|
|
184
154
|
* Player stats by sport, as the exchange names them. Use these for
|
|
185
155
|
* autocomplete; the stats a given event accepts are the ones
|
|
@@ -701,8 +671,8 @@ interface FeeTransaction {
|
|
|
701
671
|
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
702
672
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
703
673
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
704
|
-
* `fee_refund`, `casino`, `adjustment`, `loyalty`,
|
|
705
|
-
* `loyalty_points_referral`.
|
|
674
|
+
* `fee_refund`, `maker_rebate`, `casino`, `adjustment`, `loyalty`,
|
|
675
|
+
* `loyalty_points_rollup`, `loyalty_points_referral`.
|
|
706
676
|
*/
|
|
707
677
|
type?: string | null;
|
|
708
678
|
/** Fields the server added after this SDK was generated. */
|
|
@@ -942,12 +912,13 @@ interface Fill {
|
|
|
942
912
|
time?: string | null;
|
|
943
913
|
/**
|
|
944
914
|
* Sum of on-trade fee plus fees paid from settlements linked with the trade.
|
|
945
|
-
*
|
|
915
|
+
* Negative when a maker rebate exceeds the fees paid. In dollars. Money as a
|
|
916
|
+
* decimal string, as sent by the API.
|
|
946
917
|
*/
|
|
947
918
|
total_fee?: string | null;
|
|
948
919
|
/**
|
|
949
|
-
* Per-trade fee (on-trade fee schedule). Included in total_fee.
|
|
950
|
-
* Money as a decimal string, as sent by the API.
|
|
920
|
+
* Per-trade fee (on-trade fee schedule). Included in total_fee. Negative for
|
|
921
|
+
* a maker rebate. In dollars. Money as a decimal string, as sent by the API.
|
|
951
922
|
*/
|
|
952
923
|
trade_fee?: string | null;
|
|
953
924
|
/**
|
|
@@ -960,9 +931,10 @@ interface Fill {
|
|
|
960
931
|
*/
|
|
961
932
|
traded_contracts?: string | null;
|
|
962
933
|
/**
|
|
963
|
-
* Fee before rounding. Use the rounded fee for
|
|
964
|
-
* Carries up to 9 decimal places; parse money
|
|
965
|
-
* type, not a fixed-width one. Money as a
|
|
934
|
+
* Fee before rounding; negative for a maker rebate. Use the rounded fee for
|
|
935
|
+
* reconciliation. In dollars. Carries up to 9 decimal places; parse money
|
|
936
|
+
* with a variable-scale decimal type, not a fixed-width one. Money as a
|
|
937
|
+
* decimal string, as sent by the API.
|
|
966
938
|
*/
|
|
967
939
|
unrounded_trade_fee?: string | null;
|
|
968
940
|
/**
|
|
@@ -977,6 +949,28 @@ interface Fill {
|
|
|
977
949
|
/** Fields the server added after this SDK was generated. */
|
|
978
950
|
[key: string]: unknown;
|
|
979
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* The 403 failure envelope. A refusal on the member's STX terms adds
|
|
954
|
+
* `error_description` and `terms_url` to `error`.
|
|
955
|
+
*/
|
|
956
|
+
interface ForbiddenError {
|
|
957
|
+
/**
|
|
958
|
+
* Failure reason: `terms_required` or `terms_not_delegable` for a terms
|
|
959
|
+
* refusal, otherwise a human-readable message.
|
|
960
|
+
*/
|
|
961
|
+
error?: string | null;
|
|
962
|
+
/**
|
|
963
|
+
* Present on a terms refusal: what the app should do, in plain words.
|
|
964
|
+
*/
|
|
965
|
+
error_description?: string | null;
|
|
966
|
+
/**
|
|
967
|
+
* Present on a terms refusal: the STX page where the member accepts the
|
|
968
|
+
* terms, e.g. `<STX host>/connect/terms?client_id=<client_id>`.
|
|
969
|
+
*/
|
|
970
|
+
terms_url?: string | null;
|
|
971
|
+
/** Fields the server added after this SDK was generated. */
|
|
972
|
+
[key: string]: unknown;
|
|
973
|
+
}
|
|
980
974
|
/**
|
|
981
975
|
* One ranked board.
|
|
982
976
|
*/
|
|
@@ -1229,6 +1223,12 @@ interface Market {
|
|
|
1229
1223
|
* The market this record relates to.
|
|
1230
1224
|
*/
|
|
1231
1225
|
market_id?: string | null;
|
|
1226
|
+
/**
|
|
1227
|
+
* The contract rules document for this market, as a PDF, the same version as
|
|
1228
|
+
* `rules_version`. `null` where rules documents are not published, or before
|
|
1229
|
+
* one takes effect.
|
|
1230
|
+
*/
|
|
1231
|
+
market_rules_pdf_url?: string | null;
|
|
1232
1232
|
/**
|
|
1233
1233
|
* The settlement value of one winning contract, and the ceiling on order
|
|
1234
1234
|
* prices: an order must price strictly below it. Read it per market. In
|
|
@@ -1259,7 +1259,7 @@ interface Market {
|
|
|
1259
1259
|
*/
|
|
1260
1260
|
position?: string | null;
|
|
1261
1261
|
/**
|
|
1262
|
-
* The provider used to result this market.
|
|
1262
|
+
* The provider used to result this market, or `null` when there is none.
|
|
1263
1263
|
*/
|
|
1264
1264
|
powered_by?: Record<string, unknown> | null;
|
|
1265
1265
|
/**
|
|
@@ -1292,6 +1292,11 @@ interface Market {
|
|
|
1292
1292
|
* The rules for this market.
|
|
1293
1293
|
*/
|
|
1294
1294
|
rules?: string | null;
|
|
1295
|
+
/**
|
|
1296
|
+
* The version number of the contract rules document in force for this market.
|
|
1297
|
+
* `null` where rules documents are not published, or before one takes effect.
|
|
1298
|
+
*/
|
|
1299
|
+
rules_version?: number | null;
|
|
1295
1300
|
/**
|
|
1296
1301
|
* When the market was resulted or voided. A raw microsecond integer, unlike
|
|
1297
1302
|
* the ISO-8601 `timestamp` and `event_start` beside it. UNIX microseconds.
|
|
@@ -1919,18 +1924,21 @@ interface NewOrder {
|
|
|
1919
1924
|
*/
|
|
1920
1925
|
expiration_time?: number | null;
|
|
1921
1926
|
/**
|
|
1922
|
-
*
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
1931
|
-
*
|
|
1932
|
-
|
|
1933
|
-
|
|
1927
|
+
* `post_only` makes a limit order rest only as a maker. When it would match
|
|
1928
|
+
* on arrival, it is cancelled with `cancellation_reason` `auto_matching` and
|
|
1929
|
+
* the response carries the cancelled order; when the first order it would
|
|
1930
|
+
* match is your own, it is a 422 (`match_with_self`). `fill_or_kill` makes a
|
|
1931
|
+
* limit order fill in full when it is matched, at its price or better, or not
|
|
1932
|
+
* at all. The response carries it `accepted` before it is matched, or
|
|
1933
|
+
* `delayed` during the in-play delay; it then becomes `filled`, or
|
|
1934
|
+
* `cancelled` with `cancellation_reason` `auto_matching`, nothing filled and
|
|
1935
|
+
* nothing left on the book, or `rejected` for a reason any order can be
|
|
1936
|
+
* (`match_with_self`, `market_liability_limit`). Either is a 400 on a
|
|
1937
|
+
* `market` order or where it is not enabled, and a 422 on a combination
|
|
1938
|
+
* market. `normal` is the default; any other value is a 400. One of:
|
|
1939
|
+
* `normal`, `post_only`, `fill_or_kill`.
|
|
1940
|
+
*/
|
|
1941
|
+
fill_mode?: string | null;
|
|
1934
1942
|
/**
|
|
1935
1943
|
* The market to place the order on.
|
|
1936
1944
|
*/
|
|
@@ -1941,18 +1949,15 @@ interface NewOrder {
|
|
|
1941
1949
|
*/
|
|
1942
1950
|
order_type?: string | null;
|
|
1943
1951
|
/**
|
|
1944
|
-
* Limit price in dollars, as a string: `"0.42"` is 42 cents. A number
|
|
1945
|
-
* rejected
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
* decimal places, not counting trailing zeros. So "0.42" and "0.4200" are the
|
|
1954
|
-
* same accepted value, and "0.001" is rejected. Money as a decimal string, as
|
|
1955
|
-
* sent by the API.
|
|
1952
|
+
* Limit price in dollars, as a string: `"0.42"` is 42 cents. A number such as
|
|
1953
|
+
* `42` is rejected, since it could mean cents or dollars. Must be strictly
|
|
1954
|
+
* less than the market's `max_price`, read per market. Required for `limit`
|
|
1955
|
+
* orders. A `market` order ignores it but still rejects a malformed or
|
|
1956
|
+
* sub-cent price with a 400; an explicit `null` is the same as omitting it.
|
|
1957
|
+
* Must be greater than zero and a whole number of cents: at most two decimal
|
|
1958
|
+
* places, not counting trailing zeros. So "0.42" and "0.4200" are the same
|
|
1959
|
+
* accepted value, and "0.001" is rejected. Money as a decimal string, as sent
|
|
1960
|
+
* by the API.
|
|
1956
1961
|
*/
|
|
1957
1962
|
price?: string | null;
|
|
1958
1963
|
/**
|
|
@@ -2023,6 +2028,12 @@ interface Order {
|
|
|
2023
2028
|
* the market has no event. Not the same as `expiration_time`.
|
|
2024
2029
|
*/
|
|
2025
2030
|
expires_at?: number | null;
|
|
2031
|
+
/**
|
|
2032
|
+
* How the order matches: `normal`, `post_only` or `fill_or_kill` for a limit
|
|
2033
|
+
* order you placed, `cancel_unfilled` for a market order, `rfq` or `quote`
|
|
2034
|
+
* for an order of a combination bind.
|
|
2035
|
+
*/
|
|
2036
|
+
fill_mode?: string | null;
|
|
2026
2037
|
/**
|
|
2027
2038
|
* Contracts filled so far. Compare with `quantity` to get remaining size.
|
|
2028
2039
|
* Quantity as a decimal string, as sent by the API.
|
|
@@ -2176,8 +2187,8 @@ interface PaymentTransaction {
|
|
|
2176
2187
|
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
2177
2188
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
2178
2189
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
2179
|
-
* `fee_refund`, `casino`, `adjustment`, `loyalty`,
|
|
2180
|
-
* `loyalty_points_referral`.
|
|
2190
|
+
* `fee_refund`, `maker_rebate`, `casino`, `adjustment`, `loyalty`,
|
|
2191
|
+
* `loyalty_points_rollup`, `loyalty_points_referral`.
|
|
2181
2192
|
*/
|
|
2182
2193
|
type?: string | null;
|
|
2183
2194
|
/** Fields the server added after this SDK was generated. */
|
|
@@ -2238,6 +2249,12 @@ interface Position {
|
|
|
2238
2249
|
* loss. In dollars. Money as a decimal string, as sent by the API.
|
|
2239
2250
|
*/
|
|
2240
2251
|
max_risk?: string | null;
|
|
2252
|
+
/**
|
|
2253
|
+
* A combination position's payout per dollar risked: max price over the
|
|
2254
|
+
* buy-side average fill, floored to two places. `null` for any market that is
|
|
2255
|
+
* not a combination.
|
|
2256
|
+
*/
|
|
2257
|
+
multiplier?: number | null;
|
|
2241
2258
|
/**
|
|
2242
2259
|
* Potential fee on the open contracts when they settle. In dollars. Money as
|
|
2243
2260
|
* a decimal string, as sent by the API.
|
|
@@ -2289,6 +2306,21 @@ interface Position {
|
|
|
2289
2306
|
/** Fields the server added after this SDK was generated. */
|
|
2290
2307
|
[key: string]: unknown;
|
|
2291
2308
|
}
|
|
2309
|
+
/**
|
|
2310
|
+
* The data provider that results a market.
|
|
2311
|
+
*/
|
|
2312
|
+
interface PoweredBy {
|
|
2313
|
+
/**
|
|
2314
|
+
* A link to the provider, or to its page for the event.
|
|
2315
|
+
*/
|
|
2316
|
+
link?: string | null;
|
|
2317
|
+
/**
|
|
2318
|
+
* The provider's name, e.g. `ESPN`.
|
|
2319
|
+
*/
|
|
2320
|
+
provider?: string | null;
|
|
2321
|
+
/** Fields the server added after this SDK was generated. */
|
|
2322
|
+
[key: string]: unknown;
|
|
2323
|
+
}
|
|
2292
2324
|
/**
|
|
2293
2325
|
* The public-profile fields to change. Every key is optional, but at least one
|
|
2294
2326
|
* is required.
|
|
@@ -2542,8 +2574,8 @@ interface Transaction {
|
|
|
2542
2574
|
* What moved the money or the points, for example a deposit, a trade fee, a
|
|
2543
2575
|
* referral, or a manual adjustment. Each endpoint returns only its own subset
|
|
2544
2576
|
* of these. One of: `deposit`, `withdrawal`, `settlement`, `fee`,
|
|
2545
|
-
* `fee_refund`, `casino`, `adjustment`, `loyalty`,
|
|
2546
|
-
* `loyalty_points_referral`.
|
|
2577
|
+
* `fee_refund`, `maker_rebate`, `casino`, `adjustment`, `loyalty`,
|
|
2578
|
+
* `loyalty_points_rollup`, `loyalty_points_referral`.
|
|
2547
2579
|
*/
|
|
2548
2580
|
type?: string | null;
|
|
2549
2581
|
/** Fields the server added after this SDK was generated. */
|
|
@@ -2556,6 +2588,7 @@ type models_Cancellation = Cancellation;
|
|
|
2556
2588
|
type models_Event = Event;
|
|
2557
2589
|
type models_FeeTransaction = FeeTransaction;
|
|
2558
2590
|
type models_Fill = Fill;
|
|
2591
|
+
type models_ForbiddenError = ForbiddenError;
|
|
2559
2592
|
type models_Leaderboard = Leaderboard;
|
|
2560
2593
|
type models_LeaderboardEntry = LeaderboardEntry;
|
|
2561
2594
|
type models_LeaderboardStanding = LeaderboardStanding;
|
|
@@ -2567,13 +2600,14 @@ type models_NewOrder = NewOrder;
|
|
|
2567
2600
|
type models_Order = Order;
|
|
2568
2601
|
type models_PaymentTransaction = PaymentTransaction;
|
|
2569
2602
|
type models_Position = Position;
|
|
2603
|
+
type models_PoweredBy = PoweredBy;
|
|
2570
2604
|
type models_ProfileUpdate = ProfileUpdate;
|
|
2571
2605
|
type models_RecentTrade = RecentTrade;
|
|
2572
2606
|
type models_Settlement = Settlement;
|
|
2573
2607
|
type models_StatDetail = StatDetail;
|
|
2574
2608
|
type models_Transaction = Transaction;
|
|
2575
2609
|
declare namespace models {
|
|
2576
|
-
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 };
|
|
2610
|
+
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_ForbiddenError as ForbiddenError, 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_PoweredBy as PoweredBy, models_ProfileUpdate as ProfileUpdate, models_RecentTrade as RecentTrade, models_Settlement as Settlement, models_StatDetail as StatDetail, models_Transaction as Transaction };
|
|
2577
2611
|
}
|
|
2578
2612
|
|
|
2579
2613
|
interface Operation {
|
|
@@ -2602,7 +2636,7 @@ declare const OPERATIONS: {
|
|
|
2602
2636
|
readonly account_market_stats_get: {
|
|
2603
2637
|
readonly method: "GET";
|
|
2604
2638
|
readonly path: "/api/v1/account/market_stats";
|
|
2605
|
-
readonly query: readonly ["market_ids", "event_ids", "exclude_zero_settlements", "from_time", "to_time", "sports", "competitions", "limit", "cursor"];
|
|
2639
|
+
readonly query: readonly ["market_ids", "event_ids", "exclude_zero_settlements", "unsettled_only", "from_time", "to_time", "sports", "competitions", "limit", "cursor"];
|
|
2606
2640
|
readonly pathParams: readonly [];
|
|
2607
2641
|
readonly hasBody: false;
|
|
2608
2642
|
readonly responseKey: "market_stats";
|
|
@@ -2993,34 +3027,75 @@ declare class STXTermsRequiredException extends STXForbiddenException {
|
|
|
2993
3027
|
*/
|
|
2994
3028
|
declare class STXIPNotAllowedException extends STXForbiddenException {
|
|
2995
3029
|
}
|
|
3030
|
+
/**
|
|
3031
|
+
* 403 from the network edge in front of the exchange: the request never
|
|
3032
|
+
* reached it, so nothing was done. `reason` is `restricted_jurisdiction`,
|
|
3033
|
+
* `unusual_network`, or `blocked` when the edge sent no reason (most often a
|
|
3034
|
+
* request without a `User-Agent` header). `reference` identifies the block for
|
|
3035
|
+
* support, when sent. Retrying will not help, so it is never retried.
|
|
3036
|
+
*/
|
|
3037
|
+
declare class STXBlockedException extends STXForbiddenException {
|
|
3038
|
+
readonly reason: string;
|
|
3039
|
+
readonly reference: string | undefined;
|
|
3040
|
+
constructor(message: string, opts?: STXExceptionOptions & {
|
|
3041
|
+
reason?: string;
|
|
3042
|
+
reference?: string;
|
|
3043
|
+
});
|
|
3044
|
+
}
|
|
3045
|
+
/** 403 `restricted_jurisdiction`: the request came from a location the exchange does not serve. */
|
|
3046
|
+
declare class STXRestrictedJurisdictionException extends STXBlockedException {
|
|
3047
|
+
}
|
|
3048
|
+
/**
|
|
3049
|
+
* 403 `unusual_network`: the request came from a network the exchange does
|
|
3050
|
+
* not accept traffic from, such as some hosting providers, proxies or VPNs.
|
|
3051
|
+
*/
|
|
3052
|
+
declare class STXUnusualNetworkException extends STXBlockedException {
|
|
3053
|
+
}
|
|
2996
3054
|
/** 404: the resource does not exist, or belongs to another account. */
|
|
2997
3055
|
declare class STXNotFoundException extends STXAPIException {
|
|
2998
3056
|
}
|
|
2999
3057
|
/**
|
|
3000
|
-
* 422: the exchange refused the request, e.g. insufficient funds
|
|
3001
|
-
* market.
|
|
3058
|
+
* 422: the exchange refused the request, e.g. insufficient funds, a closed
|
|
3059
|
+
* market or an order from outside the region.
|
|
3002
3060
|
*/
|
|
3003
3061
|
declare class STXRejectedException extends STXAPIException {
|
|
3004
3062
|
}
|
|
3005
3063
|
/**
|
|
3006
|
-
* 422
|
|
3007
|
-
*
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3064
|
+
* 422: this market does not take the order's `fillMode`. Combination markets
|
|
3065
|
+
* accept only normal orders. `fillMode` is the mode sent.
|
|
3066
|
+
*/
|
|
3067
|
+
declare class STXFillModeNotAllowedException extends STXRejectedException {
|
|
3068
|
+
readonly fillMode: string;
|
|
3069
|
+
constructor(message: string, opts: STXExceptionOptions & {
|
|
3070
|
+
fillMode: string;
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3074
|
+
* A `post_only` order would have matched on arrival, so it was not left on the
|
|
3075
|
+
* book and nothing filled. `reason` is `auto_matching` when the exchange
|
|
3076
|
+
* accepted and cancelled it (`order` is that cancelled order), or
|
|
3077
|
+
* `match_with_self` when the first order it would match is your own (a 422;
|
|
3078
|
+
* `order` is undefined).
|
|
3013
3079
|
*/
|
|
3014
|
-
declare class
|
|
3015
|
-
readonly reason:
|
|
3016
|
-
readonly
|
|
3017
|
-
constructor(message: string,
|
|
3080
|
+
declare class STXPostOnlyWouldMatchException extends STXRejectedException {
|
|
3081
|
+
readonly reason: "auto_matching" | "match_with_self";
|
|
3082
|
+
readonly order: Order | undefined;
|
|
3083
|
+
constructor(message: string, opts: STXExceptionOptions & {
|
|
3084
|
+
reason: "auto_matching" | "match_with_self";
|
|
3085
|
+
order?: Order;
|
|
3086
|
+
});
|
|
3018
3087
|
}
|
|
3019
|
-
/**
|
|
3088
|
+
/**
|
|
3089
|
+
* 429: too many requests. `retryAfter` is seconds, when sent. `reference`
|
|
3090
|
+
* identifies the block for support when the network edge in front of the
|
|
3091
|
+
* exchange answered (`{"error": "rate_limited", ...}`), else it is undefined.
|
|
3092
|
+
*/
|
|
3020
3093
|
declare class STXRateLimitException extends STXAPIException {
|
|
3021
3094
|
readonly retryAfter: number | undefined;
|
|
3095
|
+
readonly reference: string | undefined;
|
|
3022
3096
|
constructor(message: string, opts?: STXExceptionOptions & {
|
|
3023
3097
|
retryAfter?: number;
|
|
3098
|
+
reference?: string;
|
|
3024
3099
|
});
|
|
3025
3100
|
}
|
|
3026
3101
|
/** 5xx: the server failed. Retried by the default policy on GET and DELETE. */
|
|
@@ -3053,7 +3128,7 @@ declare class STXChannelException extends STXException {
|
|
|
3053
3128
|
declare class STXTimeoutException extends STXChannelException {
|
|
3054
3129
|
}
|
|
3055
3130
|
/** The sentence an `STXNotAvailableException` carries: `Combos are not available on demo.stxapp.ca yet.` */
|
|
3056
|
-
declare function notAvailableMessage(feature: string, host: string): string;
|
|
3131
|
+
declare function notAvailableMessage(feature: string, host: string, apiVersion?: string | null): string;
|
|
3057
3132
|
/**
|
|
3058
3133
|
* This exchange does not have the feature yet: combos on an exchange without
|
|
3059
3134
|
* them, OAuth where it is not switched on, a scope the exchange does not offer
|
|
@@ -3064,7 +3139,9 @@ declare function notAvailableMessage(feature: string, host: string): string;
|
|
|
3064
3139
|
*
|
|
3065
3140
|
* `feature` is a stable id (`oauth`, `oauth.member`, `oauth.app`, `connect`,
|
|
3066
3141
|
* `terms.stx_page`, `markets.create`, `market_types`, `event_players`,
|
|
3067
|
-
* `leaderboard`, `combos`,
|
|
3142
|
+
* `leaderboard`, `loyalty`, `combos`, `orders.post_only`, `orders.fill_or_kill`, or
|
|
3143
|
+
* `scope:<name>`); `host` is the exchange that answered, and `apiVersion` its
|
|
3144
|
+
* build when known.
|
|
3068
3145
|
* `statusCode` and `body` are the HTTP answer the decision came from, when
|
|
3069
3146
|
* there was one.
|
|
3070
3147
|
*/
|
|
@@ -3073,8 +3150,11 @@ declare class STXNotAvailableException extends STXAPIException {
|
|
|
3073
3150
|
readonly feature: string;
|
|
3074
3151
|
/** The exchange host that lacks it, e.g. `"demo.stxapp.ca"`. */
|
|
3075
3152
|
readonly host: string;
|
|
3153
|
+
/** The exchange build, e.g. `"3.4.24"`, when known. */
|
|
3154
|
+
readonly apiVersion: string | undefined;
|
|
3076
3155
|
constructor(feature: string, host: string, opts?: STXExceptionOptions & {
|
|
3077
3156
|
message?: string;
|
|
3157
|
+
apiVersion?: string | null;
|
|
3078
3158
|
});
|
|
3079
3159
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
3080
3160
|
}
|
|
@@ -3143,6 +3223,10 @@ declare function errorForStatus(statusCode: number, body: unknown, opts: {
|
|
|
3143
3223
|
path: string;
|
|
3144
3224
|
retryAfter?: string | null;
|
|
3145
3225
|
wwwAuthenticate?: string | null;
|
|
3226
|
+
/** The `x-stx-error` response header: the exchange sets it, an edge block never does. */
|
|
3227
|
+
stxError?: string | null;
|
|
3228
|
+
/** The `x-amz-cf-id` response header: the reference of an edge block. */
|
|
3229
|
+
cfId?: string | null;
|
|
3146
3230
|
}): STXAPIException;
|
|
3147
3231
|
|
|
3148
3232
|
type ExceptionClass = abstract new (...args: never[]) => STXException;
|
|
@@ -3238,8 +3322,8 @@ declare class ApiKeyCredentials implements AuthProvider {
|
|
|
3238
3322
|
toString(): string;
|
|
3239
3323
|
}
|
|
3240
3324
|
|
|
3241
|
-
declare const VERSION = "0.
|
|
3242
|
-
declare const USER_AGENT = "stx-typescript/0.
|
|
3325
|
+
declare const VERSION = "0.11.0";
|
|
3326
|
+
declare const USER_AGENT = "stx-typescript/0.11.0";
|
|
3243
3327
|
/**
|
|
3244
3328
|
* `Symbol.asyncDispose` where the runtime has it (Node 20+, Bun), so
|
|
3245
3329
|
* `await using client = new STX()` works there; a registered stand-in on
|
|
@@ -3348,12 +3432,6 @@ interface ComboLeg {
|
|
|
3348
3432
|
}
|
|
3349
3433
|
/** Options for `STXWebSocket.comboPlayer()` and `STXWebSocket.comboMaker()`. */
|
|
3350
3434
|
interface ComboJoinOptions<E> {
|
|
3351
|
-
/**
|
|
3352
|
-
* A geolocation packet, or a function returning one, sent on every join
|
|
3353
|
-
* where the exchange is geo-fenced. A function is called again on each
|
|
3354
|
-
* rejoin, so a reconnect sends a fresh packet.
|
|
3355
|
-
*/
|
|
3356
|
-
geoLocation?: GeoLocationProvider;
|
|
3357
3435
|
/** Called for every typed event, as it arrives. */
|
|
3358
3436
|
onEvent?: (event: E) => void | Promise<void>;
|
|
3359
3437
|
}
|
|
@@ -3361,8 +3439,6 @@ interface ComboJoinOptions<E> {
|
|
|
3361
3439
|
interface ComboJoinReply {
|
|
3362
3440
|
/** Your account's pseudonym for counterparties. Makers see the player's on requests and quotes. */
|
|
3363
3441
|
external_id: string;
|
|
3364
|
-
/** ISO 8601 time the geolocation packet expires, or null when no packet was needed. Rejoin before it. */
|
|
3365
|
-
next_geolocation_at: string | null;
|
|
3366
3442
|
}
|
|
3367
3443
|
/** `requestQuote()` reply. */
|
|
3368
3444
|
interface ComboRequestReply {
|
|
@@ -3553,8 +3629,6 @@ declare abstract class ComboSession<E extends {
|
|
|
3553
3629
|
constructor(channel: Channel, events: ReadonlySet<string>, onEvent: ((event: E) => void | Promise<void>) | undefined);
|
|
3554
3630
|
/** Your account's pseudonym for counterparties, from the join reply. */
|
|
3555
3631
|
get externalId(): string;
|
|
3556
|
-
/** When the geolocation packet this join used expires (ISO 8601), or null. Rejoin before it. */
|
|
3557
|
-
get nextGeolocationAt(): string | null;
|
|
3558
3632
|
/** @internal */
|
|
3559
3633
|
_typed(msg: ChannelMessage): E | undefined;
|
|
3560
3634
|
/** @internal Called for every message on the channel, before it is queued. */
|
|
@@ -3604,10 +3678,8 @@ declare abstract class ComboSession<E extends {
|
|
|
3604
3678
|
* The player's side of combos, on `rfq:<user_id>`. Get one with
|
|
3605
3679
|
* `ws.comboPlayer()`.
|
|
3606
3680
|
*
|
|
3607
|
-
*
|
|
3608
|
-
*
|
|
3609
|
-
* A request belongs to this channel: leaving, a dropped socket or a geo lapse
|
|
3610
|
-
* ends it `cancelled`, and the SDK's automatic rejoin does not bring it back.
|
|
3681
|
+
* A request belongs to this channel: leaving or a dropped socket ends it
|
|
3682
|
+
* `cancelled`, and the SDK's automatic rejoin does not bring it back.
|
|
3611
3683
|
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
3612
3684
|
* `reason` in `code`.
|
|
3613
3685
|
*/
|
|
@@ -3662,8 +3734,6 @@ declare class ComboPlayer extends ComboSession<ComboPlayerEvent> {
|
|
|
3662
3734
|
* `ws.comboMaker()`. Joining subscribes to every request opened after the
|
|
3663
3735
|
* join (`rfq_opened`); earlier requests are not replayed.
|
|
3664
3736
|
*
|
|
3665
|
-
* Available on US demo.
|
|
3666
|
-
*
|
|
3667
3737
|
* A quote belongs to this channel: leaving or a dropped socket withdraws it.
|
|
3668
3738
|
* Every refusal throws `STXComboRefusedException` with the exchange's
|
|
3669
3739
|
* `reason` in `code`.
|
|
@@ -3752,8 +3822,19 @@ declare class Channel implements AsyncIterable<ChannelMessage> {
|
|
|
3752
3822
|
joinRef: string | null;
|
|
3753
3823
|
joined: boolean;
|
|
3754
3824
|
closed: boolean;
|
|
3755
|
-
/** @internal
|
|
3756
|
-
|
|
3825
|
+
/** @internal Milliseconds between pings while joined; null when none are sent. */
|
|
3826
|
+
_pingEveryMs: number | null;
|
|
3827
|
+
/** @internal */
|
|
3828
|
+
_joinTail: Promise<unknown>;
|
|
3829
|
+
/** @internal */
|
|
3830
|
+
_joinedConnection: number;
|
|
3831
|
+
/** @internal The connection whose join also restored watches and the pinger. */
|
|
3832
|
+
_restoredConnection: number;
|
|
3833
|
+
/** @internal A phx_close/phx_error for the join in flight. */
|
|
3834
|
+
_endedJoin: {
|
|
3835
|
+
joinRef: string;
|
|
3836
|
+
event: string;
|
|
3837
|
+
} | null;
|
|
3757
3838
|
constructor(ws: STXWebSocket, topic: string, joinPayload: Record<string, unknown>, onMessage: MessageHandler | undefined, opts: {
|
|
3758
3839
|
pingIntervalMs: number | null;
|
|
3759
3840
|
queueSize: number;
|
|
@@ -3814,6 +3895,8 @@ declare class Channel implements AsyncIterable<ChannelMessage> {
|
|
|
3814
3895
|
_stopPinger(): void;
|
|
3815
3896
|
/** @internal */
|
|
3816
3897
|
_resetForRejoin(): void;
|
|
3898
|
+
/** @internal End the channel after every queued message is read. */
|
|
3899
|
+
_finish(): void;
|
|
3817
3900
|
/** @internal */
|
|
3818
3901
|
_close(): void;
|
|
3819
3902
|
}
|
|
@@ -3842,7 +3925,11 @@ interface STXWebSocketOptions extends Pick<STXOptions, "environment" | "region"
|
|
|
3842
3925
|
/** Reconnect after a drop. Default true. */
|
|
3843
3926
|
reconnect?: boolean;
|
|
3844
3927
|
reconnectPolicy?: ReconnectPolicy;
|
|
3845
|
-
/**
|
|
3928
|
+
/**
|
|
3929
|
+
* Called after every successful reconnect and rejoin, and after rejoining a
|
|
3930
|
+
* channel the server closed or errored while the socket stayed up: the
|
|
3931
|
+
* moment to read open orders and anything else you loaded with `STX` again.
|
|
3932
|
+
*/
|
|
3846
3933
|
onReconnect?: () => void | Promise<void>;
|
|
3847
3934
|
/**
|
|
3848
3935
|
* Called when the socket gives up because its credentials are dead: an OAuth
|
|
@@ -3891,6 +3978,8 @@ declare class STXWebSocket {
|
|
|
3891
3978
|
readonly channels: Map<string, Channel>;
|
|
3892
3979
|
/** Successful reconnects so far. */
|
|
3893
3980
|
reconnects: number;
|
|
3981
|
+
/** Channels rejoined after the server closed or errored them while the socket stayed up. */
|
|
3982
|
+
channelRejoins: number;
|
|
3894
3983
|
constructor(opts?: STXWebSocketOptions);
|
|
3895
3984
|
toString(): string;
|
|
3896
3985
|
get connected(): boolean;
|
|
@@ -3974,7 +4063,7 @@ declare class STXWebSocket {
|
|
|
3974
4063
|
* `cancelOnDisconnect: true` arms cancel-on-disconnect for orders placed
|
|
3975
4064
|
* with `cancelOnDisconnect: true`. `pingTimeout` is in milliseconds,
|
|
3976
4065
|
* clamped by the server to 5000 to 20000; the granted value is in
|
|
3977
|
-
* `channel.reply.ping_timeout` and the SDK pings at
|
|
4066
|
+
* `channel.reply.ping_timeout` and the SDK pings at a third of it for as long
|
|
3978
4067
|
* as the channel is joined.
|
|
3979
4068
|
*/
|
|
3980
4069
|
orders(opts?: {
|
|
@@ -4027,7 +4116,6 @@ declare class STXWebSocket {
|
|
|
4027
4116
|
* Join `rfq:{user_id}` and return a `ComboPlayer`: request quotes on a
|
|
4028
4117
|
* combination, cash one out, accept, cancel and read a request.
|
|
4029
4118
|
*
|
|
4030
|
-
* Available on US demo.
|
|
4031
4119
|
* Where combos are not available, rejects with
|
|
4032
4120
|
* `STXCombosUnavailableException`. Other join refusals (a read-only key, an
|
|
4033
4121
|
* account that may not trade) reject with `STXComboRefusedException`.
|
|
@@ -4037,7 +4125,6 @@ declare class STXWebSocket {
|
|
|
4037
4125
|
* Join `combo_quote:{user_id}` and return a `ComboMaker`: receive every
|
|
4038
4126
|
* request opened from now on (`rfq_opened`), quote and withdraw quotes.
|
|
4039
4127
|
*
|
|
4040
|
-
* Available on US demo.
|
|
4041
4128
|
* Where combos are not available, rejects with
|
|
4042
4129
|
* `STXCombosUnavailableException`.
|
|
4043
4130
|
*/
|
|
@@ -4095,12 +4182,6 @@ interface STXOptions {
|
|
|
4095
4182
|
retry?: RetryPolicy;
|
|
4096
4183
|
/** Milliseconds per HTTP request. Default 30000. */
|
|
4097
4184
|
timeoutMs?: number;
|
|
4098
|
-
/**
|
|
4099
|
-
* A geolocation packet, or a function returning one, sent as `geo_location`
|
|
4100
|
-
* with every order write. Only needed where the exchange is geo-fenced and
|
|
4101
|
-
* this machine's IP address is not whitelisted for the account.
|
|
4102
|
-
*/
|
|
4103
|
-
geoLocation?: GeoLocationProvider;
|
|
4104
4185
|
/** Inject a fetch implementation (tests, proxies). */
|
|
4105
4186
|
fetch?: FetchLike;
|
|
4106
4187
|
/**
|
|
@@ -4137,11 +4218,6 @@ interface ResponseEvent {
|
|
|
4137
4218
|
*/
|
|
4138
4219
|
responseBody?: string | null;
|
|
4139
4220
|
}
|
|
4140
|
-
/** The per-call geolocation override accepted by every order write. */
|
|
4141
|
-
interface GeoOption {
|
|
4142
|
-
/** Overrides the client's `geoLocation` for this call; `null` sends none. */
|
|
4143
|
-
geoLocation?: string | null;
|
|
4144
|
-
}
|
|
4145
4221
|
interface MarketsQuery {
|
|
4146
4222
|
marketIds?: StrList;
|
|
4147
4223
|
eventIds?: StrList;
|
|
@@ -4177,7 +4253,7 @@ interface OrdersQuery {
|
|
|
4177
4253
|
orderIds?: StrList;
|
|
4178
4254
|
clientOrderIds?: StrList;
|
|
4179
4255
|
marketIds?: StrList;
|
|
4180
|
-
/** One status or a list, e.g. `["
|
|
4256
|
+
/** One status or a list, e.g. `["accepted", "delayed", "open"]`. */
|
|
4181
4257
|
status?: StrList;
|
|
4182
4258
|
limit?: number;
|
|
4183
4259
|
cursor?: string;
|
|
@@ -4194,6 +4270,12 @@ interface MarketStatsQuery {
|
|
|
4194
4270
|
marketIds?: StrList;
|
|
4195
4271
|
eventIds?: StrList;
|
|
4196
4272
|
excludeZeroSettlements?: boolean;
|
|
4273
|
+
/**
|
|
4274
|
+
* Only markets not yet resulted or voided, ordered by market id so a row
|
|
4275
|
+
* keeps its place between pages. Not combinable with `fromTime`, `toTime` or
|
|
4276
|
+
* `excludeZeroSettlements: true`.
|
|
4277
|
+
*/
|
|
4278
|
+
unsettledOnly?: boolean;
|
|
4197
4279
|
fromTime?: number;
|
|
4198
4280
|
toTime?: number;
|
|
4199
4281
|
sports?: StrList;
|
|
@@ -4223,7 +4305,7 @@ interface PageQuery {
|
|
|
4223
4305
|
}
|
|
4224
4306
|
type WithoutCursor<T> = Omit<T, "cursor">;
|
|
4225
4307
|
/** The optional fields of one new order. */
|
|
4226
|
-
interface OrderOptions
|
|
4308
|
+
interface OrderOptions {
|
|
4227
4309
|
/** Dollars, as a decimal string: `"0.58"`. Required for a limit order. */
|
|
4228
4310
|
price?: string;
|
|
4229
4311
|
/** Contracts, as a decimal string: `"100"`. */
|
|
@@ -4235,9 +4317,17 @@ interface OrderOptions extends GeoOption {
|
|
|
4235
4317
|
expirationTime?: number;
|
|
4236
4318
|
cancelOnDisconnect?: boolean;
|
|
4237
4319
|
deviceId?: string;
|
|
4320
|
+
/**
|
|
4321
|
+
* `"normal"` (the default), `"post_only"` (only ever rests on the book as a
|
|
4322
|
+
* maker) or `"fill_or_kill"` (fills in full or not at all). Limit orders
|
|
4323
|
+
* only.
|
|
4324
|
+
*/
|
|
4325
|
+
fillMode?: FillMode;
|
|
4238
4326
|
}
|
|
4327
|
+
/** How a limit order matches. */
|
|
4328
|
+
type FillMode = "normal" | "post_only" | "fill_or_kill";
|
|
4239
4329
|
/** One order in a `placeOrders` batch. */
|
|
4240
|
-
interface NewOrderInput extends
|
|
4330
|
+
interface NewOrderInput extends OrderOptions {
|
|
4241
4331
|
marketId: string;
|
|
4242
4332
|
/** `"buy"` or `"sell"`. */
|
|
4243
4333
|
action: string;
|
|
@@ -4249,8 +4339,11 @@ interface AcceptTermsOptions {
|
|
|
4249
4339
|
acceptPrivacy?: boolean;
|
|
4250
4340
|
acceptHouseRules?: boolean;
|
|
4251
4341
|
}
|
|
4252
|
-
/**
|
|
4253
|
-
|
|
4342
|
+
/**
|
|
4343
|
+
* The JSON body for one new order. Fields left undefined are omitted, and so is
|
|
4344
|
+
* `fillMode: "normal"`, the default.
|
|
4345
|
+
*/
|
|
4346
|
+
declare function orderBody(marketId: string, action: string, orderType: string, opts: OrderOptions): Record<string, unknown>;
|
|
4254
4347
|
/**
|
|
4255
4348
|
* The STX client. Configuration comes from the options, then
|
|
4256
4349
|
* environment variables, then a profile in ~/.stx/credentials:
|
|
@@ -4274,7 +4367,6 @@ declare class STX {
|
|
|
4274
4367
|
readonly verifyTls: boolean;
|
|
4275
4368
|
readonly retry: RetryPolicy;
|
|
4276
4369
|
readonly timeoutMs: number;
|
|
4277
|
-
geoLocation: GeoLocationProvider | undefined;
|
|
4278
4370
|
onResponse: ((event: ResponseEvent) => void) | undefined;
|
|
4279
4371
|
/** Test hook: how retries wait. */
|
|
4280
4372
|
_sleep: (ms: number) => Promise<void>;
|
|
@@ -4380,47 +4472,47 @@ declare class STX {
|
|
|
4380
4472
|
* are decimal strings, e.g. `{ price: "0.58", quantity: "100" }`. Numbers are
|
|
4381
4473
|
* refused client-side.
|
|
4382
4474
|
*
|
|
4475
|
+
* `fillMode` (limit orders only) is `"normal"` (the default), `"post_only"`
|
|
4476
|
+
* or `"fill_or_kill"`. A post-only order that would match on arrival is not
|
|
4477
|
+
* placed: this throws `STXPostOnlyWouldMatchException`. A fill-or-kill order
|
|
4478
|
+
* comes back `accepted` (or `delayed` in play); follow it on the `orders`
|
|
4479
|
+
* channel or with `order()` to see it `filled` or `cancelled`.
|
|
4480
|
+
*
|
|
4481
|
+
* Before sending either mode, the client checks once that the exchange offers
|
|
4482
|
+
* it (`GET /api_version`, cached) and throws `STXNotAvailableException`
|
|
4483
|
+
* (`orders.post_only`, `orders.fill_or_kill`) without sending the order when
|
|
4484
|
+
* it does not. A combination market throws `STXFillModeNotAllowedException`.
|
|
4485
|
+
*
|
|
4383
4486
|
* The exchange validates the order: a bad price step or a fractional
|
|
4384
4487
|
* quantity throws `STXValidationException` (400) or `STXRejectedException`
|
|
4385
|
-
* (422) with the API's message
|
|
4386
|
-
* `
|
|
4488
|
+
* (422) with the API's message. An order from outside the region is also
|
|
4489
|
+
* an `STXRejectedException`.
|
|
4387
4490
|
*
|
|
4388
4491
|
* A POST is never retried after a 5xx or a dropped connection; pass
|
|
4389
4492
|
* `clientOrderId` so you can look the order up if that happens.
|
|
4390
4493
|
*/
|
|
4391
4494
|
placeOrder(marketId: string, action: string, orderType: string, opts: OrderOptions): Promise<Order>;
|
|
4392
4495
|
/**
|
|
4393
|
-
* `POST /api/v1/orders/batched`: place several orders in one call.
|
|
4394
|
-
*
|
|
4395
|
-
*
|
|
4396
|
-
*
|
|
4496
|
+
* `POST /api/v1/orders/batched`: place several orders in one call. Returns
|
|
4497
|
+
* one result per order, in order; a rejected order has `errors` instead of
|
|
4498
|
+
* `order` and does not stop the others. A post-only order that would have
|
|
4499
|
+
* matched comes back as its order, `cancelled` with `cancellation_reason`
|
|
4500
|
+
* `auto_matching`.
|
|
4501
|
+
*
|
|
4502
|
+
* When any order has a `fillMode` other than `"normal"`, the exchange is
|
|
4503
|
+
* checked first as in `placeOrder()`, and `STXNotAvailableException` is
|
|
4504
|
+
* thrown with nothing sent.
|
|
4397
4505
|
*/
|
|
4398
|
-
placeOrders(orders: readonly NewOrderInput[]
|
|
4506
|
+
placeOrders(orders: readonly NewOrderInput[]): Promise<BatchOrderResult[]>;
|
|
4399
4507
|
/**
|
|
4400
4508
|
* `DELETE /api/v1/orders/{order_id}`: request a cancel. A cancel is a
|
|
4401
4509
|
* request: a fill already in flight can still land.
|
|
4402
4510
|
*/
|
|
4403
|
-
cancelOrder(orderId: string
|
|
4511
|
+
cancelOrder(orderId: string): Promise<Cancellation>;
|
|
4404
4512
|
/** `DELETE /api/v1/orders/batched`: cancel the named orders. */
|
|
4405
|
-
cancelOrders(orderIds: readonly string[]
|
|
4513
|
+
cancelOrders(orderIds: readonly string[]): Promise<Cancellation[]>;
|
|
4406
4514
|
/** `DELETE /api/v1/orders/all`: cancel everything resting on the account. */
|
|
4407
|
-
cancelAllOrders(
|
|
4408
|
-
/**
|
|
4409
|
-
* Ask the exchange whether this machine may trade right now, without
|
|
4410
|
-
* placing or cancelling anything.
|
|
4411
|
-
*
|
|
4412
|
-
* Sends `DELETE /api/v1/orders/00000000-0000-0000-0000-000000000000` (an
|
|
4413
|
-
* order id that cannot exist) with the geolocation packet, if one is
|
|
4414
|
-
* configured. The exchange runs its geo check before it looks the order
|
|
4415
|
-
* up, so a 404 means the check passed, and a geo 422 means it did not. On
|
|
4416
|
-
* an exchange without geo-fencing it always passes.
|
|
4417
|
-
*
|
|
4418
|
-
* Needs a `read_write` key (the probe is a write route). The exchange
|
|
4419
|
-
* records a failed check in its geolocation log exactly as it would a real
|
|
4420
|
-
* order from the same place, and may raise a compliance alert, so call it
|
|
4421
|
-
* once at start-up, not in a loop.
|
|
4422
|
-
*/
|
|
4423
|
-
geoCheck(opts?: GeoOption): Promise<GeoCheckResult>;
|
|
4515
|
+
cancelAllOrders(): Promise<Cancellation[]>;
|
|
4424
4516
|
/** `GET /api/v1/fills`: one page of your executions. */
|
|
4425
4517
|
fills(query?: FillsQuery): Promise<Page<Fill>>;
|
|
4426
4518
|
/** Every fill matching the filters, following the cursor. */
|
|
@@ -4473,9 +4565,13 @@ declare class STX {
|
|
|
4473
4565
|
iterFees(query?: {
|
|
4474
4566
|
limit?: number;
|
|
4475
4567
|
}): AsyncGenerator<FeeTransaction, void, undefined>;
|
|
4476
|
-
/**
|
|
4568
|
+
/**
|
|
4569
|
+
* `GET /api/v1/portfolio/loyalty`: loyalty entries. Throws
|
|
4570
|
+
* `STXNotAvailableException` (feature `loyalty`) where the exchange has the
|
|
4571
|
+
* loyalty program switched off.
|
|
4572
|
+
*/
|
|
4477
4573
|
loyalty(query?: PageQuery): Promise<Page<Transaction>>;
|
|
4478
|
-
/** Every loyalty entry, following the cursor. */
|
|
4574
|
+
/** Every loyalty entry, following the cursor. Throws like `loyalty()`. */
|
|
4479
4575
|
iterLoyalty(query?: {
|
|
4480
4576
|
limit?: number;
|
|
4481
4577
|
}): AsyncGenerator<Transaction, void, undefined>;
|
|
@@ -4509,4 +4605,4 @@ declare class STX {
|
|
|
4509
4605
|
websocket(opts?: Omit<STXWebSocketOptions, "rest">): STXWebSocket;
|
|
4510
4606
|
}
|
|
4511
4607
|
|
|
4512
|
-
export { type EventPlayers as $, type AcceptTermsOptions as A, type Balance as B, type Cancellation as C, ComboPlayer as D, type ComboPlayerEvent as E, type ComboQuoteAcceptedEvent as F, type ComboQuoteClosedEvent as G, type ComboQuoteClosedReason as H, type ComboQuoteReply as I, type ComboRefusalReason as J, type ComboRequestClosedEvent as K, type ComboRequestClosedReason as L, type ComboRequestReply as M, type ComboRfqClosedEvent as N, type ComboRfqClosedReason as O, type ComboRfqLeg as P, type ComboRfqOpenedEvent as Q, type ComboSnapshot as R, type ComboWithdrawReply as S, type CreatableMarketType as T, type CreateMarketResult as U, type CreateMarketsOptions as V, Environment as W, Environments as X, type Error$1 as Y, type Event as Z, type EventPlayer as _, type AccountChange as a,
|
|
4608
|
+
export { type EventPlayers as $, type AcceptTermsOptions as A, type Balance as B, type Cancellation as C, ComboPlayer as D, type ComboPlayerEvent as E, type ComboQuoteAcceptedEvent as F, type ComboQuoteClosedEvent as G, type ComboQuoteClosedReason as H, type ComboQuoteReply as I, type ComboRefusalReason as J, type ComboRequestClosedEvent as K, type ComboRequestClosedReason as L, type ComboRequestReply as M, type ComboRfqClosedEvent as N, type ComboRfqClosedReason as O, type ComboRfqLeg as P, type ComboRfqOpenedEvent as Q, type ComboSnapshot as R, type ComboWithdrawReply as S, type CreatableMarketType as T, type CreateMarketResult as U, type CreateMarketsOptions as V, Environment as W, Environments as X, type Error$1 as Y, type Event as Z, type EventPlayer as _, type AccountChange as a, SNAPSHOT_EVENTS as a$, type EventStat as a0, type EventTeam as a1, type EventsQuery as a2, FEATURES as a3, type Feature as a4, type FeatureMap as a5, type FeeTransaction as a6, type FetchLike as a7, type Fill as a8, type FillMode as a9, NO_RETRY as aA, type NewMarket as aB, type NewMarketInput as aC, type NewOrder as aD, type NewOrderInput as aE, OPERATIONS as aF, type Operation as aG, type OperationId as aH, type Order as aI, type OrderOptions as aJ, type OrdersQuery as aK, Page as aL, type PageQuery as aM, type PaymentTransaction as aN, type PlayerStatLineMarket as aO, type Position as aP, type PoweredBy as aQ, type PrivateKeyInput as aR, type ProfileUpdate as aS, type RecentTrade as aT, ReconnectPolicy as aU, type ReconnectPolicyOptions as aV, Region as aW, type ResponseEvent as aX, RetryPolicy as aY, type RetryPolicyOptions as aZ, SIGNATURE_HEADER as a_, type FillsQuery as aa, type ForbiddenError as ab, HOSTS as ac, KEY_HEADER as ad, type KnownStat as ae, type Leaderboard as af, type LeaderboardEntry as ag, type LeaderboardQuery as ah, type LeaderboardStanding as ai, type ListedMarketType as aj, type Logger as ak, MAX_MARKETS_PER_REQUEST as al, type Market as am, type MarketFilter as an, type MarketRejectionReason as ao, type MarketRequestEcho as ap, type MarketRule as aq, type MarketStat as ar, type MarketStatsQuery as as, type MarketType as at, type MarketTypeEventType as au, type MarketTypeField as av, type MarketTypes as aw, type MarketsQuery as ax, type Me as ay, type MessageHandler as az, type AccountChangeKind as b, STX as b0, STXAPIException as b1, STXAuthenticationException as b2, STXBlockedException as b3, STXChannelException as b4, STXComboPriceMovedException as b5, STXComboRefusedException as b6, STXCombosUnavailableException as b7, STXConfigException as b8, type STXEnvironment as b9, Stats as bA, type StrList as bB, TERMINAL_ORDER_STATUSES as bC, TIMESTAMP_HEADER as bD, type Transaction as bE, USER_AGENT as bF, VERSION as bG, type WebSocketAuthContext as bH, baseUrlFor as bI, buildMessage as bJ, environmentNamed as bK, errorForStatus as bL, handshakePath as bM, isValidLine as bN, loadPrivateKey as bO, models as bP, notAvailableMessage as bQ, orderBody as bR, requestPath as bS, resolveHost as bT, signerFromPrivateKey as bU, socketUrlFor as bV, STXException as ba, STXFillModeNotAllowedException as bb, STXForbiddenException as bc, STXIPNotAllowedException as bd, STXInsufficientScopeException as be, STXInvalidTokenException as bf, STXNotAvailableException as bg, STXNotFoundException as bh, type STXOptions as bi, STXPostOnlyWouldMatchException as bj, STXRateLimitException as bk, STXRejectedException as bl, STXRestrictedJurisdictionException as bm, STXServerException as bn, STXTermsRequiredException as bo, STXTimeoutException as bp, STXTransportException as bq, STXUnusualNetworkException as br, STXValidationException as bs, STXWebSocket as bt, type STXWebSocketOptions as bu, type Settlement as bv, type SettlementsQuery as bw, type Signer as bx, type Stat as by, type StatDetail 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, Capabilities as k, Channel as l, ChannelMessage as m, type ComboBestQuote as n, type ComboBestQuoteEvent as o, type ComboCancelReply as p, type ComboCashOutReply as q, type ComboJoinOptions as r, type ComboJoinReply as s, type ComboLeg as t, ComboMaker as u, type ComboMakerEvent as v, type ComboMakerPlacedEvent as w, type ComboOutcome as x, type ComboPlacedEvent as y, type ComboPlacement as z };
|