@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 CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 (2026-11-17)
4
+
5
+ Post-only and fill-or-kill orders:
6
+
7
+ - `placeOrder()` and each `placeOrders()` order take `fillMode`: `"normal"` (the default), `"post_only"` or `"fill_or_kill"`, for limit orders. See https://docs.stxapp.io/sdks/typescript/trading/
8
+ - Before sending a post-only or fill-or-kill order, the client asks the exchange once (`GET /api_version`, cached on the client) whether it offers that mode. When it does not, the call throws `STXNotAvailableException` (`feature` `orders.post_only` or `orders.fill_or_kill`, with `apiVersion`) and sends nothing, so an exchange that does not know the mode never places a normal order instead. `capabilities()` reports both features.
9
+ - A post-only order that would have matched throws `STXPostOnlyWouldMatchException` (`reason` `auto_matching` with the cancelled `order`, or `match_with_self`). A fill mode on a combination market throws `STXFillModeNotAllowedException`. Both extend `STXRejectedException`.
10
+ - `Order` has `fill_mode`, `Market` has `rules_version` and `market_rules_pdf_url`, and `accountMarketStats()` takes `unsettledOnly`.
11
+
12
+ Blocked requests:
13
+
14
+ - A request blocked before it reaches the exchange throws `STXBlockedException` (a 403 `STXForbiddenException`) with `reason` and `reference` (the request id from the `x-amz-cf-id` response header, to quote to STX support), or its subclasses `STXRestrictedJurisdictionException` and `STXUnusualNetworkException`. A 403 that carries no reason says that requests need a `User-Agent` header. Blocked requests are never retried.
15
+ - A 429 from the same place is `STXRateLimitException` with `reference` as well as `retryAfter`. `Retry-After` given as an HTTP date is read too, and when it asks for longer than `RetryPolicy.maxBackoffMs` the exception is thrown at once instead of retrying early.
16
+
17
+ ## 0.10.0 (2026-11-11)
18
+
19
+ Breaking for anyone passing a geolocation option or using the location check: API key requests are now located from your connection, so the SDK no longer sends or reads geolocation data and no longer has its own location check.
20
+
21
+ - The `geoLocation` option is gone from `new STX()`, `placeOrder()`, `placeOrders()`, `cancelOrder()`, `cancelOrders()`, `cancelAllOrders()`, `geoCheck()`, `comboPlayer()` and `comboMaker()`, along with the `GeoOption` and `GeoLocationProvider` types and `STX.geoLocation`. A `geoLocation` key on a `placeOrders()` order is an unknown field. Remove the option; nothing else changes.
22
+ - `ComboJoinReply.next_geolocation_at`, `nextGeolocationAt` on the combo sessions, and `GeoCheckResult.sentPacket` are gone. The exchange may still send `next_geolocation_at`, and the SDK ignores it.
23
+ - `geoCheck()`, `STXGeoLocationException`, `geoRejection()` and the `GeoRejection` and `GeoCheckResult` types are gone. The exchange still refuses order requests from outside the region (422), and that refusal is now a plain `STXRejectedException` with the exchange's message. Catch `STXRejectedException` instead, and drop any `geoCheck()` call: the exchange checks every order write itself. See https://docs.stxapp.io/concepts/us-and-canada/
24
+
25
+ WebSocket reliability, for cancel-on-disconnect in particular:
26
+
27
+ - Cancel-on-disconnect pings at a third of the granted `ping_timeout` instead of 60%, so two pings can be lost before the exchange cancels your orders. At 60%, a client stall of about 2 seconds could let a 5 second timeout fire on a healthy connection.
28
+ - When the exchange closes or errors one channel while the socket stays up (for example, its cancel-on-disconnect timer fired), the client rejoins that channel with its filters and cancel-on-disconnect, then calls `onReconnect` so you can resync. `ws.channelRejoins` counts these. A close meant for an earlier join of the channel is ignored.
29
+ - Each channel is joined once per connection, even when joins or rejoins overlap. Before, two overlapping calls for one topic, or a rejoin racing a reconnect, could join it twice, and the exchange answers a second join by closing the first. Joining a channel while the socket is reconnecting now waits for that reconnect instead of opening a second socket.
30
+ - A `market(marketId)` channel that the exchange closes after the market results or is voided now ends instead of rejoining.
31
+ - If restoring a channel's `marketUpdates` watches fails after a rejoin, only the watches are retried, without joining again.
32
+ - An `onReconnect` that throws is logged and no longer drops the socket it just reconnected.
33
+ - A refused socket handshake (for example an expired OAuth token, answered 401 or 403) now only rejects `connect()` with an `STXTransportException` carrying the status. Before, closing the refused socket also raised an unhandled "WebSocket was closed before the connection was established" error on Node and on Bun 1.4.4 and later, which could stop the process and kept the OAuth token refresh from recovering.
34
+
35
+ Loyalty program:
36
+
37
+ - `loyalty()` and `iterLoyalty()` throw `STXNotAvailableException` (feature `loyalty`) where the exchange has the loyalty program switched off. The exchange answers `GET /api/v1/portfolio/loyalty` there with 404 `{"error": "Loyalty program is not enabled"}`, which was an `STXNotFoundException` before. US demo and US QA have it off since 2026-11-07.
38
+ - `capabilities()` reports `loyalty`, from a signed `GET /api/v1/portfolio/loyalty?limit=1`.
39
+
3
40
  ## 0.9.0 (2026-10-21)
4
41
 
5
42
  One SDK for every STX exchange. Features an exchange does not have yet say so instead of failing obscurely, so the same release works against Ontario production today and against the features on US demo.
package/README.md CHANGED
@@ -72,6 +72,8 @@ Every field is described in the [API reference](https://docs.stxapp.io/sdks/type
72
72
 
73
73
  </details>
74
74
 
75
+ `placeOrder(marketId, "buy", "limit", { price, quantity, fillMode: "post_only" })` places a limit order that only rests on the book, and `fillMode: "fill_or_kill"` one that fills in full or not at all. On an exchange that does not offer a fill mode, the call throws `STXNotAvailableException` and sends nothing. See [Trading](https://docs.stxapp.io/sdks/typescript/trading/).
76
+
75
77
  ## For apps: STX accounts and markets
76
78
 
77
79
  An app registered with STX can bring its members' STX accounts in, and can act as itself. This runs on your server; the client secret and the tokens never go to a browser or a mobile app. OAuth is on in US demo today; on an exchange without it these calls throw `STXNotAvailableException`, and `await stx.capabilities()` says which features an exchange has. There are two ways to bring a member's STX account in.