pmxtjs 2.40.6 → 2.41.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/dist/esm/generated/src/apis/DefaultApi.d.ts +24 -24
- package/dist/esm/generated/src/apis/DefaultApi.js +24 -24
- package/dist/esm/generated/src/models/UnwatchAddressRequest.d.ts +1 -1
- package/dist/esm/generated/src/models/UnwatchAddressRequest.js +1 -3
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.d.ts +1 -1
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.js +1 -3
- package/dist/esm/generated/src/models/WatchAddressRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchAddressRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchOrderBookRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchOrderBookRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchOrderBooksRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchOrderBooksRequest.js +2 -5
- package/dist/esm/generated/src/models/WatchTradesRequest.d.ts +2 -3
- package/dist/esm/generated/src/models/WatchTradesRequest.js +2 -5
- package/dist/esm/generated/src/models/index.d.ts +0 -3
- package/dist/esm/generated/src/models/index.js +0 -3
- package/dist/esm/pmxt/client.d.ts +27 -6
- package/dist/esm/pmxt/client.js +132 -14
- package/dist/esm/pmxt/models.d.ts +11 -0
- package/dist/esm/pmxt/ws-client.d.ts +2 -1
- package/dist/esm/pmxt/ws-client.js +25 -14
- package/dist/generated/src/apis/DefaultApi.d.ts +24 -24
- package/dist/generated/src/apis/DefaultApi.js +24 -24
- package/dist/generated/src/models/UnwatchAddressRequest.d.ts +1 -1
- package/dist/generated/src/models/UnwatchAddressRequest.js +1 -3
- package/dist/generated/src/models/UnwatchOrderBookRequest.d.ts +1 -1
- package/dist/generated/src/models/UnwatchOrderBookRequest.js +1 -3
- package/dist/generated/src/models/WatchAddressRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchAddressRequest.js +2 -5
- package/dist/generated/src/models/WatchOrderBookRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchOrderBookRequest.js +2 -5
- package/dist/generated/src/models/WatchOrderBooksRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchOrderBooksRequest.js +2 -5
- package/dist/generated/src/models/WatchTradesRequest.d.ts +2 -3
- package/dist/generated/src/models/WatchTradesRequest.js +2 -5
- package/dist/generated/src/models/index.d.ts +0 -3
- package/dist/generated/src/models/index.js +0 -3
- package/dist/pmxt/client.d.ts +27 -6
- package/dist/pmxt/client.js +132 -14
- package/dist/pmxt/models.d.ts +11 -0
- package/dist/pmxt/ws-client.d.ts +2 -1
- package/dist/pmxt/ws-client.js +25 -14
- package/generated/.openapi-generator/FILES +0 -6
- package/generated/docs/DefaultApi.md +24 -24
- package/generated/docs/WatchAddressRequest.md +1 -1
- package/generated/docs/WatchOrderBookRequest.md +1 -1
- package/generated/docs/WatchOrderBooksRequest.md +1 -1
- package/generated/docs/WatchTradesRequest.md +1 -1
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +24 -24
- package/generated/src/models/UnwatchAddressRequest.ts +2 -3
- package/generated/src/models/UnwatchOrderBookRequest.ts +2 -3
- package/generated/src/models/WatchAddressRequest.ts +4 -12
- package/generated/src/models/WatchOrderBookRequest.ts +4 -12
- package/generated/src/models/WatchOrderBooksRequest.ts +4 -12
- package/generated/src/models/WatchTradesRequest.ts +4 -12
- package/generated/src/models/index.ts +0 -3
- package/package.json +3 -2
- package/pmxt/client.ts +137 -16
- package/pmxt/models.ts +14 -0
- package/pmxt/ws-client.ts +26 -13
- package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.js +0 -37
- package/dist/esm/generated/src/models/WatchOrderBookRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchOrderBookRequestArgsInner.js +0 -43
- package/dist/esm/generated/src/models/WatchOrderBooksRequestArgsInner.d.ts +0 -21
- package/dist/esm/generated/src/models/WatchOrderBooksRequestArgsInner.js +0 -47
- package/dist/generated/src/models/WatchAddressRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchAddressRequestArgsInner.js +0 -43
- package/dist/generated/src/models/WatchOrderBookRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchOrderBookRequestArgsInner.js +0 -49
- package/dist/generated/src/models/WatchOrderBooksRequestArgsInner.d.ts +0 -21
- package/dist/generated/src/models/WatchOrderBooksRequestArgsInner.js +0 -53
- package/generated/docs/WatchAddressRequestArgsInner.md +0 -32
- package/generated/docs/WatchOrderBookRequestArgsInner.md +0 -32
- package/generated/docs/WatchOrderBooksRequestArgsInner.md +0 -32
- package/generated/src/models/WatchAddressRequestArgsInner.ts +0 -49
- package/generated/src/models/WatchOrderBookRequestArgsInner.ts +0 -55
- package/generated/src/models/WatchOrderBooksRequestArgsInner.ts +0 -59
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -131,6 +131,8 @@ export class Exchange {
|
|
|
131
131
|
serverManager;
|
|
132
132
|
initPromise;
|
|
133
133
|
isHosted;
|
|
134
|
+
_hostedAccount;
|
|
135
|
+
_accountDiscoveryPromise;
|
|
134
136
|
/**
|
|
135
137
|
* Sticky flag: set to `true` the first time a GET read is rejected by
|
|
136
138
|
* the sidecar with 404/405 (i.e. an older pmxt-core that only supports
|
|
@@ -188,9 +190,14 @@ export class Exchange {
|
|
|
188
190
|
this.api = new DefaultApi(this.config);
|
|
189
191
|
}
|
|
190
192
|
catch (error) {
|
|
191
|
-
|
|
193
|
+
const msg = `Failed to start PMXT server: ${error instanceof Error ? error.message : error}\n\n` +
|
|
192
194
|
`Please ensure 'pmxt-core' is installed: npm install -g pmxt-core\n` +
|
|
193
|
-
`Or start the server manually: pmxt-server
|
|
195
|
+
`Or start the server manually: pmxt-server`;
|
|
196
|
+
const pmxtError = new PmxtError(msg);
|
|
197
|
+
if (error instanceof Error) {
|
|
198
|
+
pmxtError.cause = error;
|
|
199
|
+
}
|
|
200
|
+
throw pmxtError;
|
|
194
201
|
}
|
|
195
202
|
}
|
|
196
203
|
}
|
|
@@ -289,8 +296,11 @@ export class Exchange {
|
|
|
289
296
|
if (this._wsClient?.connected)
|
|
290
297
|
return this._wsClient;
|
|
291
298
|
const host = this.resolveBaseUrl();
|
|
292
|
-
const accessToken = this.
|
|
293
|
-
|
|
299
|
+
const accessToken = this.isHosted
|
|
300
|
+
? this.pmxtApiKey
|
|
301
|
+
: this.serverManager.getAccessToken();
|
|
302
|
+
const authParamName = this.isHosted ? "apiKey" : "token";
|
|
303
|
+
const client = new SidecarWsClient(host, accessToken || undefined, authParamName);
|
|
294
304
|
try {
|
|
295
305
|
// Trigger connection to validate the endpoint exists.
|
|
296
306
|
// subscribe() calls ensureConnected internally, but we want
|
|
@@ -325,8 +335,12 @@ export class Exchange {
|
|
|
325
335
|
try {
|
|
326
336
|
return await ws.subscribe(this.exchangeName, method, args, this.getCredentials());
|
|
327
337
|
}
|
|
328
|
-
catch {
|
|
329
|
-
|
|
338
|
+
catch (error) {
|
|
339
|
+
// Only fall back to HTTP for transport-level failures
|
|
340
|
+
if (error instanceof PmxtError && /connection failed|no websocket/i.test(error.message)) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
throw error;
|
|
330
344
|
}
|
|
331
345
|
}
|
|
332
346
|
// Low-Level API Access
|
|
@@ -1423,8 +1437,11 @@ export class Exchange {
|
|
|
1423
1437
|
return result;
|
|
1424
1438
|
}
|
|
1425
1439
|
}
|
|
1426
|
-
catch {
|
|
1427
|
-
// fall through to HTTP
|
|
1440
|
+
catch (error) {
|
|
1441
|
+
// Only fall through to HTTP for transport-level WS failures
|
|
1442
|
+
if (!(error instanceof PmxtError) || !/connection failed|no websocket/i.test(error.message)) {
|
|
1443
|
+
throw error;
|
|
1444
|
+
}
|
|
1428
1445
|
}
|
|
1429
1446
|
}
|
|
1430
1447
|
// HTTP fallback
|
|
@@ -1450,7 +1467,7 @@ export class Exchange {
|
|
|
1450
1467
|
}
|
|
1451
1468
|
return result;
|
|
1452
1469
|
}
|
|
1453
|
-
|
|
1470
|
+
throw new PmxtError("watchOrderBooks: unexpected response shape from server");
|
|
1454
1471
|
}
|
|
1455
1472
|
catch (error) {
|
|
1456
1473
|
if (error instanceof PmxtError)
|
|
@@ -1458,6 +1475,45 @@ export class Exchange {
|
|
|
1458
1475
|
throw new PmxtError(`Failed to watch order books: ${error}`);
|
|
1459
1476
|
}
|
|
1460
1477
|
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Stream all orderbook updates across venues via the hosted WebSocket API.
|
|
1480
|
+
*
|
|
1481
|
+
* Returns a promise that resolves with the next book event.
|
|
1482
|
+
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1483
|
+
* Requires hosted mode (`pmxtApiKey` set).
|
|
1484
|
+
*
|
|
1485
|
+
* @param venues - Optional venue filter (e.g. ["polymarket", "limitless"])
|
|
1486
|
+
* @returns Next event with source, symbol, and orderbook
|
|
1487
|
+
*
|
|
1488
|
+
* @example
|
|
1489
|
+
* ```typescript
|
|
1490
|
+
* const poly = new Polymarket({ pmxtApiKey: "pmxt_xxx" });
|
|
1491
|
+
* while (true) {
|
|
1492
|
+
* const event = await poly.watchAllOrderBooks();
|
|
1493
|
+
* console.log(event.source, event.symbol, event.orderbook.bids[0]);
|
|
1494
|
+
* }
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1497
|
+
async watchAllOrderBooks(venues) {
|
|
1498
|
+
await this.initPromise;
|
|
1499
|
+
if (!this.isHosted) {
|
|
1500
|
+
throw new PmxtError("watchAllOrderBooks() requires hosted mode (set pmxtApiKey)");
|
|
1501
|
+
}
|
|
1502
|
+
const args = venues ? [venues] : [];
|
|
1503
|
+
const wsData = await this.watchViaWs("watchAllOrderBooks", args);
|
|
1504
|
+
if (wsData !== null) {
|
|
1505
|
+
return {
|
|
1506
|
+
source: wsData._source || "",
|
|
1507
|
+
symbol: wsData._symbol || "",
|
|
1508
|
+
orderbook: convertOrderBook(wsData),
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
throw new PmxtError("watchAllOrderBooks() requires WebSocket transport — connection failed");
|
|
1512
|
+
}
|
|
1513
|
+
/** @deprecated Use {@link watchAllOrderBooks} instead. */
|
|
1514
|
+
async firehose(venues) {
|
|
1515
|
+
return this.watchAllOrderBooks(venues);
|
|
1516
|
+
}
|
|
1461
1517
|
/**
|
|
1462
1518
|
* Watch real-time trade updates via WebSocket.
|
|
1463
1519
|
*
|
|
@@ -1660,12 +1716,71 @@ export class Exchange {
|
|
|
1660
1716
|
throw new PmxtError(`Failed to build order: ${error}`);
|
|
1661
1717
|
}
|
|
1662
1718
|
}
|
|
1719
|
+
async _discoverHostedAccount() {
|
|
1720
|
+
if (this._hostedAccount)
|
|
1721
|
+
return;
|
|
1722
|
+
if (!this._accountDiscoveryPromise) {
|
|
1723
|
+
this._accountDiscoveryPromise = (async () => {
|
|
1724
|
+
try {
|
|
1725
|
+
const res = await this.fetchWithRetry(`${this.resolveBaseUrl()}/v0/account`, { method: 'GET', headers: { ...this.getAuthHeaders() } });
|
|
1726
|
+
if (res.ok) {
|
|
1727
|
+
const body = await res.json();
|
|
1728
|
+
this._hostedAccount = { depositWallet: body.deposit_wallet, signatureType: body.signature_type };
|
|
1729
|
+
}
|
|
1730
|
+
else {
|
|
1731
|
+
this._hostedAccount = {};
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
catch {
|
|
1735
|
+
this._hostedAccount = {};
|
|
1736
|
+
}
|
|
1737
|
+
})();
|
|
1738
|
+
}
|
|
1739
|
+
await this._accountDiscoveryPromise;
|
|
1740
|
+
}
|
|
1741
|
+
async _executeSorOrder(params) {
|
|
1742
|
+
await this._discoverHostedAccount();
|
|
1743
|
+
const buildRes = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/sor/buildOrder`, {
|
|
1744
|
+
method: 'POST',
|
|
1745
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
1746
|
+
body: JSON.stringify({ args: [params] }),
|
|
1747
|
+
});
|
|
1748
|
+
if (!buildRes.ok)
|
|
1749
|
+
throw new PmxtError(`buildOrder failed: ${await buildRes.text()}`);
|
|
1750
|
+
const buildJson = await buildRes.json();
|
|
1751
|
+
const { orderId, legs } = buildJson.data || buildJson;
|
|
1752
|
+
const fills = [];
|
|
1753
|
+
for (const leg of legs) {
|
|
1754
|
+
try {
|
|
1755
|
+
const { Polymarket, Limitless } = require('pmxt-core');
|
|
1756
|
+
const VenueClass = leg.venue === 'polymarket' ? Polymarket : leg.venue === 'limitless' ? Limitless : null;
|
|
1757
|
+
if (!VenueClass)
|
|
1758
|
+
throw new Error(`unsupported venue: ${leg.venue}`);
|
|
1759
|
+
const venueOpts = { privateKey: this.privateKey };
|
|
1760
|
+
if (leg.venue === 'polymarket' && this._hostedAccount?.depositWallet) {
|
|
1761
|
+
venueOpts.funderAddress = this._hostedAccount.depositWallet;
|
|
1762
|
+
venueOpts.signatureType = this._hostedAccount.signatureType || 3;
|
|
1763
|
+
}
|
|
1764
|
+
const venue = new VenueClass(venueOpts);
|
|
1765
|
+
const order = await venue.createOrder({ outcomeId: leg.tokenId, side: leg.side, amount: leg.shares, price: leg.price });
|
|
1766
|
+
const filledShares = order.filled || 0;
|
|
1767
|
+
fills.push({ venue: leg.venue, venueOrderId: order.id, venueMarketId: leg.venueMarketId, venueOutcomeId: leg.venueOutcomeId, shares: filledShares > 0 ? filledShares : leg.shares, price: order.price || leg.price, status: filledShares > 0 ? 'filled' : 'open' });
|
|
1768
|
+
}
|
|
1769
|
+
catch (err) {
|
|
1770
|
+
fills.push({ venue: leg.venue, venueMarketId: leg.venueMarketId, venueOutcomeId: leg.venueOutcomeId, shares: leg.shares, price: leg.price, status: 'failed', error: err.message });
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
const submitRes = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/sor/submitOrder`, {
|
|
1774
|
+
method: 'POST',
|
|
1775
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
1776
|
+
body: JSON.stringify({ args: [{ orderId, fills }] }),
|
|
1777
|
+
});
|
|
1778
|
+
if (!submitRes.ok)
|
|
1779
|
+
throw new PmxtError(`submitOrder failed: ${await submitRes.text()}`);
|
|
1780
|
+
const submitJson = await submitRes.json();
|
|
1781
|
+
return convertOrder(submitJson.data || submitJson);
|
|
1782
|
+
}
|
|
1663
1783
|
/**
|
|
1664
|
-
* Create a new order.
|
|
1665
|
-
*
|
|
1666
|
-
* @param params - Order parameters
|
|
1667
|
-
* @returns Created order
|
|
1668
|
-
*
|
|
1669
1784
|
* @example
|
|
1670
1785
|
* ```typescript
|
|
1671
1786
|
* const order = await exchange.createOrder({
|
|
@@ -1680,6 +1795,9 @@ export class Exchange {
|
|
|
1680
1795
|
*/
|
|
1681
1796
|
async createOrder(params) {
|
|
1682
1797
|
if (this.isHosted) {
|
|
1798
|
+
if (this.exchangeName === 'sor' && this.privateKey) {
|
|
1799
|
+
return this._executeSorOrder(params);
|
|
1800
|
+
}
|
|
1683
1801
|
throw new PmxtError("Trade execution is not available through the hosted API. " +
|
|
1684
1802
|
"Use the local PMXT SDK with your venue credentials instead. " +
|
|
1685
1803
|
"See https://pmxt.dev/docs/quickstart for setup instructions.");
|
|
@@ -112,6 +112,17 @@ export interface OrderBook {
|
|
|
112
112
|
/** Unix timestamp (milliseconds) */
|
|
113
113
|
timestamp?: number;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A single event from the firehose stream.
|
|
117
|
+
*/
|
|
118
|
+
export interface FirehoseEvent {
|
|
119
|
+
/** The venue this event originated from (e.g. "polymarket", "limitless") */
|
|
120
|
+
source: string;
|
|
121
|
+
/** The outcome token id / asset id */
|
|
122
|
+
symbol: string;
|
|
123
|
+
/** The order book snapshot */
|
|
124
|
+
orderbook: OrderBook;
|
|
125
|
+
}
|
|
115
126
|
/**
|
|
116
127
|
* Result of an execution price calculation.
|
|
117
128
|
*/
|
|
@@ -16,6 +16,7 @@ export declare class SidecarWsClient {
|
|
|
16
16
|
private ws;
|
|
17
17
|
private host;
|
|
18
18
|
private accessToken;
|
|
19
|
+
private authParamName;
|
|
19
20
|
private closed;
|
|
20
21
|
/** requestId -> latest data payload */
|
|
21
22
|
private dataStore;
|
|
@@ -24,7 +25,7 @@ export declare class SidecarWsClient {
|
|
|
24
25
|
/** (method:symbolKey) -> requestId -- avoids duplicate subscribes */
|
|
25
26
|
private activeSubs;
|
|
26
27
|
private connectPromise;
|
|
27
|
-
constructor(host: string, accessToken?: string);
|
|
28
|
+
constructor(host: string, accessToken?: string, authParamName?: string);
|
|
28
29
|
private ensureConnected;
|
|
29
30
|
private connect;
|
|
30
31
|
private getWebSocketConstructor;
|
|
@@ -17,6 +17,7 @@ export class SidecarWsClient {
|
|
|
17
17
|
ws = null;
|
|
18
18
|
host;
|
|
19
19
|
accessToken;
|
|
20
|
+
authParamName;
|
|
20
21
|
closed = false;
|
|
21
22
|
/** requestId -> latest data payload */
|
|
22
23
|
dataStore = new Map();
|
|
@@ -25,9 +26,10 @@ export class SidecarWsClient {
|
|
|
25
26
|
/** (method:symbolKey) -> requestId -- avoids duplicate subscribes */
|
|
26
27
|
activeSubs = new Map();
|
|
27
28
|
connectPromise = null;
|
|
28
|
-
constructor(host, accessToken) {
|
|
29
|
+
constructor(host, accessToken, authParamName = "token") {
|
|
29
30
|
this.host = host;
|
|
30
31
|
this.accessToken = accessToken;
|
|
32
|
+
this.authParamName = authParamName;
|
|
31
33
|
}
|
|
32
34
|
// ------------------------------------------------------------------
|
|
33
35
|
// Connection lifecycle
|
|
@@ -58,7 +60,7 @@ export class SidecarWsClient {
|
|
|
58
60
|
}
|
|
59
61
|
let url = `${scheme}://${hostPart}/ws`;
|
|
60
62
|
if (this.accessToken) {
|
|
61
|
-
url = `${url}
|
|
63
|
+
url = `${url}?${this.authParamName}=${this.accessToken}`;
|
|
62
64
|
}
|
|
63
65
|
// Use the ws package in Node.js, native WebSocket in browsers
|
|
64
66
|
const WsConstructor = this.getWebSocketConstructor();
|
|
@@ -77,22 +79,30 @@ export class SidecarWsClient {
|
|
|
77
79
|
// Connection failed during handshake
|
|
78
80
|
reject(new PmxtError(`WebSocket connection failed: ${err.message || err}`));
|
|
79
81
|
}
|
|
82
|
+
else {
|
|
83
|
+
// Post-handshake error — propagate to all pending subscribers
|
|
84
|
+
const error = new PmxtError(`WebSocket error: ${err.message || err}`);
|
|
85
|
+
for (const sub of this.subscriptions.values()) {
|
|
86
|
+
if (sub.reject) {
|
|
87
|
+
sub.reject(error);
|
|
88
|
+
sub.reject = null;
|
|
89
|
+
sub.resolve = null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this.closed = true;
|
|
93
|
+
this.ws = null;
|
|
94
|
+
}
|
|
80
95
|
};
|
|
81
96
|
ws.onclose = () => {
|
|
82
97
|
this.closed = true;
|
|
83
98
|
this.ws = null;
|
|
84
99
|
};
|
|
85
100
|
ws.onmessage = (event) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.dispatch(msg);
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
// Ignore unparseable frames
|
|
95
|
-
}
|
|
101
|
+
const raw = typeof event.data === "string"
|
|
102
|
+
? event.data
|
|
103
|
+
: event.data.toString();
|
|
104
|
+
const msg = JSON.parse(raw);
|
|
105
|
+
this.dispatch(msg);
|
|
96
106
|
};
|
|
97
107
|
});
|
|
98
108
|
}
|
|
@@ -101,14 +111,15 @@ export class SidecarWsClient {
|
|
|
101
111
|
if (typeof globalThis !== "undefined" && globalThis.WebSocket) {
|
|
102
112
|
return globalThis.WebSocket;
|
|
103
113
|
}
|
|
104
|
-
// Node.js --
|
|
114
|
+
// Node.js -- require ws
|
|
105
115
|
try {
|
|
106
116
|
// Dynamic require to avoid bundler issues
|
|
107
117
|
const wsModule = require("ws");
|
|
108
118
|
return wsModule.default || wsModule;
|
|
109
119
|
}
|
|
110
120
|
catch {
|
|
111
|
-
|
|
121
|
+
throw new PmxtError("WebSocket support in Node.js requires the 'ws' package. " +
|
|
122
|
+
"Install it with: npm install ws");
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
dispatch(msg) {
|
|
@@ -647,63 +647,63 @@ export declare class DefaultApi extends runtime.BaseAPI {
|
|
|
647
647
|
*/
|
|
648
648
|
testDummyMethod(requestParameters: TestDummyMethodOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TestDummyMethod200Response>;
|
|
649
649
|
/**
|
|
650
|
-
* Stop watching a previously registered wallet address and release its resource updates.
|
|
651
|
-
* Unwatch Address
|
|
650
|
+
* Stop watching a previously registered wallet address and release its resource updates. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
651
|
+
* Unwatch Address (WebSocket)
|
|
652
652
|
*/
|
|
653
653
|
unwatchAddressRaw(requestParameters: UnwatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseResponse>>;
|
|
654
654
|
/**
|
|
655
|
-
* Stop watching a previously registered wallet address and release its resource updates.
|
|
656
|
-
* Unwatch Address
|
|
655
|
+
* Stop watching a previously registered wallet address and release its resource updates. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
656
|
+
* Unwatch Address (WebSocket)
|
|
657
657
|
*/
|
|
658
658
|
unwatchAddress(requestParameters: UnwatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
659
659
|
/**
|
|
660
|
-
* Unsubscribe from a previously watched order book stream.
|
|
661
|
-
* Unwatch Order Book
|
|
660
|
+
* Unsubscribe from a previously watched order book stream. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
661
|
+
* Unwatch Order Book (WebSocket)
|
|
662
662
|
*/
|
|
663
663
|
unwatchOrderBookRaw(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseResponse>>;
|
|
664
664
|
/**
|
|
665
|
-
* Unsubscribe from a previously watched order book stream.
|
|
666
|
-
* Unwatch Order Book
|
|
665
|
+
* Unsubscribe from a previously watched order book stream. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
666
|
+
* Unwatch Order Book (WebSocket)
|
|
667
667
|
*/
|
|
668
668
|
unwatchOrderBook(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
669
669
|
/**
|
|
670
|
-
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
671
|
-
* Watch Address
|
|
670
|
+
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
671
|
+
* Watch Address (WebSocket)
|
|
672
672
|
*/
|
|
673
673
|
watchAddressRaw(requestParameters: WatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchAddress200Response>>;
|
|
674
674
|
/**
|
|
675
|
-
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
676
|
-
* Watch Address
|
|
675
|
+
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
676
|
+
* Watch Address (WebSocket)
|
|
677
677
|
*/
|
|
678
678
|
watchAddress(requestParameters: WatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchAddress200Response>;
|
|
679
679
|
/**
|
|
680
|
-
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
681
|
-
* Watch Order Book
|
|
680
|
+
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
681
|
+
* Watch Order Book (WebSocket)
|
|
682
682
|
*/
|
|
683
683
|
watchOrderBookRaw(requestParameters: WatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FetchOrderBook200Response>>;
|
|
684
684
|
/**
|
|
685
|
-
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
686
|
-
* Watch Order Book
|
|
685
|
+
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
686
|
+
* Watch Order Book (WebSocket)
|
|
687
687
|
*/
|
|
688
688
|
watchOrderBook(requestParameters: WatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FetchOrderBook200Response>;
|
|
689
689
|
/**
|
|
690
|
-
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls.
|
|
691
|
-
* Watch Order Books
|
|
690
|
+
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBooks\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBooks\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
691
|
+
* Watch Order Books (WebSocket)
|
|
692
692
|
*/
|
|
693
693
|
watchOrderBooksRaw(requestParameters: WatchOrderBooksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchOrderBooks200Response>>;
|
|
694
694
|
/**
|
|
695
|
-
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls.
|
|
696
|
-
* Watch Order Books
|
|
695
|
+
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBooks\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBooks\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
696
|
+
* Watch Order Books (WebSocket)
|
|
697
697
|
*/
|
|
698
698
|
watchOrderBooks(requestParameters: WatchOrderBooksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchOrderBooks200Response>;
|
|
699
699
|
/**
|
|
700
|
-
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
701
|
-
* Watch Trades
|
|
700
|
+
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchTrades\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchTrades\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
701
|
+
* Watch Trades (WebSocket)
|
|
702
702
|
*/
|
|
703
703
|
watchTradesRaw(requestParameters: WatchTradesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FetchTrades200Response>>;
|
|
704
704
|
/**
|
|
705
|
-
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
706
|
-
* Watch Trades
|
|
705
|
+
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchTrades\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchTrades\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
706
|
+
* Watch Trades (WebSocket)
|
|
707
707
|
*/
|
|
708
708
|
watchTrades(requestParameters: WatchTradesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FetchTrades200Response>;
|
|
709
709
|
}
|
|
@@ -1505,8 +1505,8 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1505
1505
|
return await response.value();
|
|
1506
1506
|
}
|
|
1507
1507
|
/**
|
|
1508
|
-
* Stop watching a previously registered wallet address and release its resource updates.
|
|
1509
|
-
* Unwatch Address
|
|
1508
|
+
* Stop watching a previously registered wallet address and release its resource updates. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1509
|
+
* Unwatch Address (WebSocket)
|
|
1510
1510
|
*/
|
|
1511
1511
|
async unwatchAddressRaw(requestParameters, initOverrides) {
|
|
1512
1512
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1527,16 +1527,16 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1527
1527
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.BaseResponseFromJSON)(jsonValue));
|
|
1528
1528
|
}
|
|
1529
1529
|
/**
|
|
1530
|
-
* Stop watching a previously registered wallet address and release its resource updates.
|
|
1531
|
-
* Unwatch Address
|
|
1530
|
+
* Stop watching a previously registered wallet address and release its resource updates. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1531
|
+
* Unwatch Address (WebSocket)
|
|
1532
1532
|
*/
|
|
1533
1533
|
async unwatchAddress(requestParameters, initOverrides) {
|
|
1534
1534
|
const response = await this.unwatchAddressRaw(requestParameters, initOverrides);
|
|
1535
1535
|
return await response.value();
|
|
1536
1536
|
}
|
|
1537
1537
|
/**
|
|
1538
|
-
* Unsubscribe from a previously watched order book stream.
|
|
1539
|
-
* Unwatch Order Book
|
|
1538
|
+
* Unsubscribe from a previously watched order book stream. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1539
|
+
* Unwatch Order Book (WebSocket)
|
|
1540
1540
|
*/
|
|
1541
1541
|
async unwatchOrderBookRaw(requestParameters, initOverrides) {
|
|
1542
1542
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1557,16 +1557,16 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1557
1557
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.BaseResponseFromJSON)(jsonValue));
|
|
1558
1558
|
}
|
|
1559
1559
|
/**
|
|
1560
|
-
* Unsubscribe from a previously watched order book stream.
|
|
1561
|
-
* Unwatch Order Book
|
|
1560
|
+
* Unsubscribe from a previously watched order book stream. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"unwatchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"unwatchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1561
|
+
* Unwatch Order Book (WebSocket)
|
|
1562
1562
|
*/
|
|
1563
1563
|
async unwatchOrderBook(requestParameters, initOverrides) {
|
|
1564
1564
|
const response = await this.unwatchOrderBookRaw(requestParameters, initOverrides);
|
|
1565
1565
|
return await response.value();
|
|
1566
1566
|
}
|
|
1567
1567
|
/**
|
|
1568
|
-
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1569
|
-
* Watch Address
|
|
1568
|
+
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1569
|
+
* Watch Address (WebSocket)
|
|
1570
1570
|
*/
|
|
1571
1571
|
async watchAddressRaw(requestParameters, initOverrides) {
|
|
1572
1572
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1587,16 +1587,16 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1587
1587
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WatchAddress200ResponseFromJSON)(jsonValue));
|
|
1588
1588
|
}
|
|
1589
1589
|
/**
|
|
1590
|
-
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1591
|
-
* Watch Address
|
|
1590
|
+
* Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchAddress\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchAddress\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1591
|
+
* Watch Address (WebSocket)
|
|
1592
1592
|
*/
|
|
1593
1593
|
async watchAddress(requestParameters, initOverrides) {
|
|
1594
1594
|
const response = await this.watchAddressRaw(requestParameters, initOverrides);
|
|
1595
1595
|
return await response.value();
|
|
1596
1596
|
}
|
|
1597
1597
|
/**
|
|
1598
|
-
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1599
|
-
* Watch Order Book
|
|
1598
|
+
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1599
|
+
* Watch Order Book (WebSocket)
|
|
1600
1600
|
*/
|
|
1601
1601
|
async watchOrderBookRaw(requestParameters, initOverrides) {
|
|
1602
1602
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1617,16 +1617,16 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1617
1617
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FetchOrderBook200ResponseFromJSON)(jsonValue));
|
|
1618
1618
|
}
|
|
1619
1619
|
/**
|
|
1620
|
-
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1621
|
-
* Watch Order Book
|
|
1620
|
+
* Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book update. Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBook\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBook\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1621
|
+
* Watch Order Book (WebSocket)
|
|
1622
1622
|
*/
|
|
1623
1623
|
async watchOrderBook(requestParameters, initOverrides) {
|
|
1624
1624
|
const response = await this.watchOrderBookRaw(requestParameters, initOverrides);
|
|
1625
1625
|
return await response.value();
|
|
1626
1626
|
}
|
|
1627
1627
|
/**
|
|
1628
|
-
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls.
|
|
1629
|
-
* Watch Order Books
|
|
1628
|
+
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBooks\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBooks\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1629
|
+
* Watch Order Books (WebSocket)
|
|
1630
1630
|
*/
|
|
1631
1631
|
async watchOrderBooksRaw(requestParameters, initOverrides) {
|
|
1632
1632
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1647,16 +1647,16 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1647
1647
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WatchOrderBooks200ResponseFromJSON)(jsonValue));
|
|
1648
1648
|
}
|
|
1649
1649
|
/**
|
|
1650
|
-
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls.
|
|
1651
|
-
* Watch Order Books
|
|
1650
|
+
* Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message for all tickers; others fall back to individual watchOrderBook calls. **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchOrderBooks\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchOrderBooks\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1651
|
+
* Watch Order Books (WebSocket)
|
|
1652
1652
|
*/
|
|
1653
1653
|
async watchOrderBooks(requestParameters, initOverrides) {
|
|
1654
1654
|
const response = await this.watchOrderBooksRaw(requestParameters, initOverrides);
|
|
1655
1655
|
return await response.value();
|
|
1656
1656
|
}
|
|
1657
1657
|
/**
|
|
1658
|
-
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1659
|
-
* Watch Trades
|
|
1658
|
+
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchTrades\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchTrades\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1659
|
+
* Watch Trades (WebSocket)
|
|
1660
1660
|
*/
|
|
1661
1661
|
async watchTradesRaw(requestParameters, initOverrides) {
|
|
1662
1662
|
if (requestParameters['exchange'] == null) {
|
|
@@ -1677,8 +1677,8 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1677
1677
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FetchTrades200ResponseFromJSON)(jsonValue));
|
|
1678
1678
|
}
|
|
1679
1679
|
/**
|
|
1680
|
-
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1681
|
-
* Watch Trades
|
|
1680
|
+
* Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern). **Transport:** WebSocket | Environment | URL | |---|---| | Local sidecar | `ws://localhost:3847/ws` | | Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` | **Subscribe:** ```json { \"id\": \"req-1\", \"action\": \"subscribe\", \"method\": \"watchTrades\", \"args\": [...] } ``` **Server response:** ```json { \"event\": \"data\", \"id\": \"req-1\", \"method\": \"watchTrades\", \"symbol\": \"...\", \"data\": { ... } } ``` **Unsubscribe:** ```json { \"id\": \"req-1\", \"action\": \"unsubscribe\" } ```
|
|
1681
|
+
* Watch Trades (WebSocket)
|
|
1682
1682
|
*/
|
|
1683
1683
|
async watchTrades(requestParameters, initOverrides) {
|
|
1684
1684
|
const response = await this.watchTradesRaw(requestParameters, initOverrides);
|
|
@@ -23,8 +23,6 @@ const ExchangeCredentials_1 = require("./ExchangeCredentials");
|
|
|
23
23
|
* Check if a given object implements the UnwatchAddressRequest interface.
|
|
24
24
|
*/
|
|
25
25
|
function instanceOfUnwatchAddressRequest(value) {
|
|
26
|
-
if (!('args' in value) || value['args'] === undefined)
|
|
27
|
-
return false;
|
|
28
26
|
return true;
|
|
29
27
|
}
|
|
30
28
|
function UnwatchAddressRequestFromJSON(json) {
|
|
@@ -35,7 +33,7 @@ function UnwatchAddressRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
35
33
|
return json;
|
|
36
34
|
}
|
|
37
35
|
return {
|
|
38
|
-
'args': json['args'],
|
|
36
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
39
37
|
'credentials': json['credentials'] == null ? undefined : (0, ExchangeCredentials_1.ExchangeCredentialsFromJSON)(json['credentials']),
|
|
40
38
|
};
|
|
41
39
|
}
|
|
@@ -23,8 +23,6 @@ const ExchangeCredentials_1 = require("./ExchangeCredentials");
|
|
|
23
23
|
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
24
24
|
*/
|
|
25
25
|
function instanceOfUnwatchOrderBookRequest(value) {
|
|
26
|
-
if (!('args' in value) || value['args'] === undefined)
|
|
27
|
-
return false;
|
|
28
26
|
return true;
|
|
29
27
|
}
|
|
30
28
|
function UnwatchOrderBookRequestFromJSON(json) {
|
|
@@ -35,7 +33,7 @@ function UnwatchOrderBookRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
35
33
|
return json;
|
|
36
34
|
}
|
|
37
35
|
return {
|
|
38
|
-
'args': json['args'],
|
|
36
|
+
'args': json['args'] == null ? undefined : json['args'],
|
|
39
37
|
'credentials': json['credentials'] == null ? undefined : (0, ExchangeCredentials_1.ExchangeCredentialsFromJSON)(json['credentials']),
|
|
40
38
|
};
|
|
41
39
|
}
|