pmxtjs 2.27.9 → 2.28.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/dist/esm/generated/src/apis/DefaultApi.d.ts +32 -1
- package/dist/esm/generated/src/apis/DefaultApi.js +47 -1
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.d.ts +39 -0
- package/dist/esm/generated/src/models/UnwatchOrderBookRequest.js +46 -0
- package/dist/esm/generated/src/models/index.d.ts +1 -0
- package/dist/esm/generated/src/models/index.js +1 -0
- package/dist/esm/pmxt/client.d.ts +6 -0
- package/dist/esm/pmxt/client.js +31 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +32 -1
- package/dist/generated/src/apis/DefaultApi.js +47 -1
- package/dist/generated/src/models/UnwatchOrderBookRequest.d.ts +39 -0
- package/dist/generated/src/models/UnwatchOrderBookRequest.js +53 -0
- package/dist/generated/src/models/index.d.ts +1 -0
- package/dist/generated/src/models/index.js +1 -0
- package/dist/pmxt/client.d.ts +6 -0
- package/dist/pmxt/client.js +31 -0
- package/generated/.openapi-generator/FILES +2 -0
- package/generated/docs/DefaultApi.md +71 -0
- package/generated/docs/UnwatchOrderBookRequest.md +36 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +67 -0
- package/generated/src/models/UnwatchOrderBookRequest.ts +82 -0
- package/generated/src/models/index.ts +1 -0
- package/package.json +2 -2
- package/pmxt/client.ts +31 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime.js';
|
|
13
|
-
import type { BaseResponse, BuildOrder200Response, BuildOrderRequest, CancelOrderRequest, CloseRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchEvent200Response, FetchEvents200Response, FetchMarket200Response, FetchMarkets200Response, FetchMarketsPaginated200Response, FetchMyTrades200Response, FetchOHLCV200Response, FetchOpenOrders200Response, FetchOrderBook200Response, FetchPositions200Response, FetchTrades200Response, FilterEventsRequest, FilterMarketsRequest, GetExecutionPrice200Response, GetExecutionPriceDetailed200Response, GetExecutionPriceDetailedRequest, GetExecutionPriceRequest, HealthCheck200Response, LoadMarkets200Response, LoadMarketsRequest, SubmitOrderRequest, UnwatchAddressRequest, WatchAddress200Response, WatchAddressRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index.js';
|
|
13
|
+
import type { BaseResponse, BuildOrder200Response, BuildOrderRequest, CancelOrderRequest, CloseRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchEvent200Response, FetchEvents200Response, FetchMarket200Response, FetchMarkets200Response, FetchMarketsPaginated200Response, FetchMyTrades200Response, FetchOHLCV200Response, FetchOpenOrders200Response, FetchOrderBook200Response, FetchPositions200Response, FetchTrades200Response, FilterEventsRequest, FilterMarketsRequest, GetExecutionPrice200Response, GetExecutionPriceDetailed200Response, GetExecutionPriceDetailedRequest, GetExecutionPriceRequest, HealthCheck200Response, LoadMarkets200Response, LoadMarketsRequest, SubmitOrderRequest, UnwatchAddressRequest, UnwatchOrderBookRequest, WatchAddress200Response, WatchAddressRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index.js';
|
|
14
14
|
export interface BuildOrderOperationRequest {
|
|
15
15
|
exchange: BuildOrderOperationExchangeEnum;
|
|
16
16
|
buildOrderRequest?: BuildOrderRequest;
|
|
@@ -172,6 +172,10 @@ export interface UnwatchAddressOperationRequest {
|
|
|
172
172
|
exchange: UnwatchAddressOperationExchangeEnum;
|
|
173
173
|
unwatchAddressRequest?: UnwatchAddressRequest;
|
|
174
174
|
}
|
|
175
|
+
export interface UnwatchOrderBookOperationRequest {
|
|
176
|
+
exchange: UnwatchOrderBookOperationExchangeEnum;
|
|
177
|
+
unwatchOrderBookRequest?: UnwatchOrderBookRequest;
|
|
178
|
+
}
|
|
175
179
|
export interface WatchAddressOperationRequest {
|
|
176
180
|
exchange: WatchAddressOperationExchangeEnum;
|
|
177
181
|
watchAddressRequest?: WatchAddressRequest;
|
|
@@ -450,6 +454,16 @@ export declare class DefaultApi extends runtime.BaseAPI {
|
|
|
450
454
|
* Unwatch Address
|
|
451
455
|
*/
|
|
452
456
|
unwatchAddress(requestParameters: UnwatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
457
|
+
/**
|
|
458
|
+
* Unsubscribe from a previously watched order book stream.
|
|
459
|
+
* Unwatch Order Book
|
|
460
|
+
*/
|
|
461
|
+
unwatchOrderBookRaw(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseResponse>>;
|
|
462
|
+
/**
|
|
463
|
+
* Unsubscribe from a previously watched order book stream.
|
|
464
|
+
* Unwatch Order Book
|
|
465
|
+
*/
|
|
466
|
+
unwatchOrderBook(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
453
467
|
/**
|
|
454
468
|
* 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).
|
|
455
469
|
* Watch Address
|
|
@@ -1047,6 +1061,23 @@ export declare const UnwatchAddressOperationExchangeEnum: {
|
|
|
1047
1061
|
readonly PolymarketUs: "polymarket_us";
|
|
1048
1062
|
};
|
|
1049
1063
|
export type UnwatchAddressOperationExchangeEnum = typeof UnwatchAddressOperationExchangeEnum[keyof typeof UnwatchAddressOperationExchangeEnum];
|
|
1064
|
+
/**
|
|
1065
|
+
* @export
|
|
1066
|
+
*/
|
|
1067
|
+
export declare const UnwatchOrderBookOperationExchangeEnum: {
|
|
1068
|
+
readonly Polymarket: "polymarket";
|
|
1069
|
+
readonly Kalshi: "kalshi";
|
|
1070
|
+
readonly KalshiDemo: "kalshi-demo";
|
|
1071
|
+
readonly Limitless: "limitless";
|
|
1072
|
+
readonly Probable: "probable";
|
|
1073
|
+
readonly Baozi: "baozi";
|
|
1074
|
+
readonly Myriad: "myriad";
|
|
1075
|
+
readonly Opinion: "opinion";
|
|
1076
|
+
readonly Metaculus: "metaculus";
|
|
1077
|
+
readonly Smarkets: "smarkets";
|
|
1078
|
+
readonly PolymarketUs: "polymarket_us";
|
|
1079
|
+
};
|
|
1080
|
+
export type UnwatchOrderBookOperationExchangeEnum = typeof UnwatchOrderBookOperationExchangeEnum[keyof typeof UnwatchOrderBookOperationExchangeEnum];
|
|
1050
1081
|
/**
|
|
1051
1082
|
* @export
|
|
1052
1083
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
import * as runtime from '../runtime.js';
|
|
15
|
-
import { BaseResponseFromJSON, BuildOrder200ResponseFromJSON, BuildOrderRequestToJSON, CancelOrderRequestToJSON, CloseRequestToJSON, CreateOrder200ResponseFromJSON, CreateOrderRequestToJSON, FetchBalance200ResponseFromJSON, FetchEvent200ResponseFromJSON, FetchEvents200ResponseFromJSON, FetchMarket200ResponseFromJSON, FetchMarkets200ResponseFromJSON, FetchMarketsPaginated200ResponseFromJSON, FetchMyTrades200ResponseFromJSON, FetchOHLCV200ResponseFromJSON, FetchOpenOrders200ResponseFromJSON, FetchOrderBook200ResponseFromJSON, FetchPositions200ResponseFromJSON, FetchTrades200ResponseFromJSON, FilterEventsRequestToJSON, FilterMarketsRequestToJSON, GetExecutionPrice200ResponseFromJSON, GetExecutionPriceDetailed200ResponseFromJSON, GetExecutionPriceDetailedRequestToJSON, GetExecutionPriceRequestToJSON, HealthCheck200ResponseFromJSON, LoadMarkets200ResponseFromJSON, LoadMarketsRequestToJSON, SubmitOrderRequestToJSON, UnwatchAddressRequestToJSON, WatchAddress200ResponseFromJSON, WatchAddressRequestToJSON, WatchOrderBookRequestToJSON, WatchTradesRequestToJSON, } from '../models/index.js';
|
|
15
|
+
import { BaseResponseFromJSON, BuildOrder200ResponseFromJSON, BuildOrderRequestToJSON, CancelOrderRequestToJSON, CloseRequestToJSON, CreateOrder200ResponseFromJSON, CreateOrderRequestToJSON, FetchBalance200ResponseFromJSON, FetchEvent200ResponseFromJSON, FetchEvents200ResponseFromJSON, FetchMarket200ResponseFromJSON, FetchMarkets200ResponseFromJSON, FetchMarketsPaginated200ResponseFromJSON, FetchMyTrades200ResponseFromJSON, FetchOHLCV200ResponseFromJSON, FetchOpenOrders200ResponseFromJSON, FetchOrderBook200ResponseFromJSON, FetchPositions200ResponseFromJSON, FetchTrades200ResponseFromJSON, FilterEventsRequestToJSON, FilterMarketsRequestToJSON, GetExecutionPrice200ResponseFromJSON, GetExecutionPriceDetailed200ResponseFromJSON, GetExecutionPriceDetailedRequestToJSON, GetExecutionPriceRequestToJSON, HealthCheck200ResponseFromJSON, LoadMarkets200ResponseFromJSON, LoadMarketsRequestToJSON, SubmitOrderRequestToJSON, UnwatchAddressRequestToJSON, UnwatchOrderBookRequestToJSON, WatchAddress200ResponseFromJSON, WatchAddressRequestToJSON, WatchOrderBookRequestToJSON, WatchTradesRequestToJSON, } from '../models/index.js';
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
@@ -1011,6 +1011,36 @@ export class DefaultApi extends runtime.BaseAPI {
|
|
|
1011
1011
|
const response = await this.unwatchAddressRaw(requestParameters, initOverrides);
|
|
1012
1012
|
return await response.value();
|
|
1013
1013
|
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1016
|
+
* Unwatch Order Book
|
|
1017
|
+
*/
|
|
1018
|
+
async unwatchOrderBookRaw(requestParameters, initOverrides) {
|
|
1019
|
+
if (requestParameters['exchange'] == null) {
|
|
1020
|
+
throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling unwatchOrderBook().');
|
|
1021
|
+
}
|
|
1022
|
+
const queryParameters = {};
|
|
1023
|
+
const headerParameters = {};
|
|
1024
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1025
|
+
let urlPath = `/api/{exchange}/unwatchOrderBook`;
|
|
1026
|
+
urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
|
|
1027
|
+
const response = await this.request({
|
|
1028
|
+
path: urlPath,
|
|
1029
|
+
method: 'POST',
|
|
1030
|
+
headers: headerParameters,
|
|
1031
|
+
query: queryParameters,
|
|
1032
|
+
body: UnwatchOrderBookRequestToJSON(requestParameters['unwatchOrderBookRequest']),
|
|
1033
|
+
}, initOverrides);
|
|
1034
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BaseResponseFromJSON(jsonValue));
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1038
|
+
* Unwatch Order Book
|
|
1039
|
+
*/
|
|
1040
|
+
async unwatchOrderBook(requestParameters, initOverrides) {
|
|
1041
|
+
const response = await this.unwatchOrderBookRaw(requestParameters, initOverrides);
|
|
1042
|
+
return await response.value();
|
|
1043
|
+
}
|
|
1014
1044
|
/**
|
|
1015
1045
|
* 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).
|
|
1016
1046
|
* Watch Address
|
|
@@ -1629,6 +1659,22 @@ export const UnwatchAddressOperationExchangeEnum = {
|
|
|
1629
1659
|
Smarkets: 'smarkets',
|
|
1630
1660
|
PolymarketUs: 'polymarket_us'
|
|
1631
1661
|
};
|
|
1662
|
+
/**
|
|
1663
|
+
* @export
|
|
1664
|
+
*/
|
|
1665
|
+
export const UnwatchOrderBookOperationExchangeEnum = {
|
|
1666
|
+
Polymarket: 'polymarket',
|
|
1667
|
+
Kalshi: 'kalshi',
|
|
1668
|
+
KalshiDemo: 'kalshi-demo',
|
|
1669
|
+
Limitless: 'limitless',
|
|
1670
|
+
Probable: 'probable',
|
|
1671
|
+
Baozi: 'baozi',
|
|
1672
|
+
Myriad: 'myriad',
|
|
1673
|
+
Opinion: 'opinion',
|
|
1674
|
+
Metaculus: 'metaculus',
|
|
1675
|
+
Smarkets: 'smarkets',
|
|
1676
|
+
PolymarketUs: 'polymarket_us'
|
|
1677
|
+
};
|
|
1632
1678
|
/**
|
|
1633
1679
|
* @export
|
|
1634
1680
|
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.4.4
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExchangeCredentials } from './ExchangeCredentials.js';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface UnwatchOrderBookRequest
|
|
17
|
+
*/
|
|
18
|
+
export interface UnwatchOrderBookRequest {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<string>}
|
|
22
|
+
* @memberof UnwatchOrderBookRequest
|
|
23
|
+
*/
|
|
24
|
+
args: Array<string>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {ExchangeCredentials}
|
|
28
|
+
* @memberof UnwatchOrderBookRequest
|
|
29
|
+
*/
|
|
30
|
+
credentials?: ExchangeCredentials;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
34
|
+
*/
|
|
35
|
+
export declare function instanceOfUnwatchOrderBookRequest(value: object): value is UnwatchOrderBookRequest;
|
|
36
|
+
export declare function UnwatchOrderBookRequestFromJSON(json: any): UnwatchOrderBookRequest;
|
|
37
|
+
export declare function UnwatchOrderBookRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnwatchOrderBookRequest;
|
|
38
|
+
export declare function UnwatchOrderBookRequestToJSON(json: any): UnwatchOrderBookRequest;
|
|
39
|
+
export declare function UnwatchOrderBookRequestToJSONTyped(value?: UnwatchOrderBookRequest | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PMXT Sidecar API
|
|
5
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.4.4
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import { ExchangeCredentialsFromJSON, ExchangeCredentialsToJSON, } from './ExchangeCredentials.js';
|
|
15
|
+
/**
|
|
16
|
+
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
17
|
+
*/
|
|
18
|
+
export function instanceOfUnwatchOrderBookRequest(value) {
|
|
19
|
+
if (!('args' in value) || value['args'] === undefined)
|
|
20
|
+
return false;
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
export function UnwatchOrderBookRequestFromJSON(json) {
|
|
24
|
+
return UnwatchOrderBookRequestFromJSONTyped(json, false);
|
|
25
|
+
}
|
|
26
|
+
export function UnwatchOrderBookRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
27
|
+
if (json == null) {
|
|
28
|
+
return json;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
'args': json['args'],
|
|
32
|
+
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function UnwatchOrderBookRequestToJSON(json) {
|
|
36
|
+
return UnwatchOrderBookRequestToJSONTyped(json, false);
|
|
37
|
+
}
|
|
38
|
+
export function UnwatchOrderBookRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
39
|
+
if (value == null) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
'args': value['args'],
|
|
44
|
+
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -63,6 +63,7 @@ export * from './TradesParams.js';
|
|
|
63
63
|
export * from './UnifiedEvent.js';
|
|
64
64
|
export * from './UnifiedMarket.js';
|
|
65
65
|
export * from './UnwatchAddressRequest.js';
|
|
66
|
+
export * from './UnwatchOrderBookRequest.js';
|
|
66
67
|
export * from './UserTrade.js';
|
|
67
68
|
export * from './WatchAddress200Response.js';
|
|
68
69
|
export * from './WatchAddressRequest.js';
|
|
@@ -65,6 +65,7 @@ export * from './TradesParams.js';
|
|
|
65
65
|
export * from './UnifiedEvent.js';
|
|
66
66
|
export * from './UnifiedMarket.js';
|
|
67
67
|
export * from './UnwatchAddressRequest.js';
|
|
68
|
+
export * from './UnwatchOrderBookRequest.js';
|
|
68
69
|
export * from './UserTrade.js';
|
|
69
70
|
export * from './WatchAddress200Response.js';
|
|
70
71
|
export * from './WatchAddressRequest.js';
|
|
@@ -181,6 +181,12 @@ export declare abstract class Exchange {
|
|
|
181
181
|
* ```
|
|
182
182
|
*/
|
|
183
183
|
watchOrderBook(outcomeId: string | MarketOutcome, limit?: number): Promise<OrderBook>;
|
|
184
|
+
/**
|
|
185
|
+
* Unsubscribe from a previously watched order book stream.
|
|
186
|
+
*
|
|
187
|
+
* @param outcomeId - Outcome ID to stop watching
|
|
188
|
+
*/
|
|
189
|
+
unwatchOrderBook(outcomeId: string | MarketOutcome): Promise<void>;
|
|
184
190
|
/**
|
|
185
191
|
* Watch real-time trade updates via WebSocket.
|
|
186
192
|
*
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -852,6 +852,37 @@ export class Exchange {
|
|
|
852
852
|
throw new PmxtError(`Failed to watch order book: ${error}`);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
+
/**
|
|
856
|
+
* Unsubscribe from a previously watched order book stream.
|
|
857
|
+
*
|
|
858
|
+
* @param outcomeId - Outcome ID to stop watching
|
|
859
|
+
*/
|
|
860
|
+
async unwatchOrderBook(outcomeId) {
|
|
861
|
+
await this.initPromise;
|
|
862
|
+
const resolvedOutcomeId = resolveOutcomeId(outcomeId);
|
|
863
|
+
try {
|
|
864
|
+
const args = [resolvedOutcomeId];
|
|
865
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/unwatchOrderBook`, {
|
|
866
|
+
method: 'POST',
|
|
867
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
868
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
869
|
+
});
|
|
870
|
+
if (!response.ok) {
|
|
871
|
+
const body = await response.json().catch(() => ({}));
|
|
872
|
+
if (body.error && typeof body.error === "object") {
|
|
873
|
+
throw fromServerError(body.error);
|
|
874
|
+
}
|
|
875
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
876
|
+
}
|
|
877
|
+
const json = await response.json();
|
|
878
|
+
this.handleResponse(json);
|
|
879
|
+
}
|
|
880
|
+
catch (error) {
|
|
881
|
+
if (error instanceof PmxtError)
|
|
882
|
+
throw error;
|
|
883
|
+
throw new PmxtError(`Failed to unwatch order book: ${error}`);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
855
886
|
/**
|
|
856
887
|
* Watch real-time trade updates via WebSocket.
|
|
857
888
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
-
import type { BaseResponse, BuildOrder200Response, BuildOrderRequest, CancelOrderRequest, CloseRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchEvent200Response, FetchEvents200Response, FetchMarket200Response, FetchMarkets200Response, FetchMarketsPaginated200Response, FetchMyTrades200Response, FetchOHLCV200Response, FetchOpenOrders200Response, FetchOrderBook200Response, FetchPositions200Response, FetchTrades200Response, FilterEventsRequest, FilterMarketsRequest, GetExecutionPrice200Response, GetExecutionPriceDetailed200Response, GetExecutionPriceDetailedRequest, GetExecutionPriceRequest, HealthCheck200Response, LoadMarkets200Response, LoadMarketsRequest, SubmitOrderRequest, UnwatchAddressRequest, WatchAddress200Response, WatchAddressRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index';
|
|
13
|
+
import type { BaseResponse, BuildOrder200Response, BuildOrderRequest, CancelOrderRequest, CloseRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchEvent200Response, FetchEvents200Response, FetchMarket200Response, FetchMarkets200Response, FetchMarketsPaginated200Response, FetchMyTrades200Response, FetchOHLCV200Response, FetchOpenOrders200Response, FetchOrderBook200Response, FetchPositions200Response, FetchTrades200Response, FilterEventsRequest, FilterMarketsRequest, GetExecutionPrice200Response, GetExecutionPriceDetailed200Response, GetExecutionPriceDetailedRequest, GetExecutionPriceRequest, HealthCheck200Response, LoadMarkets200Response, LoadMarketsRequest, SubmitOrderRequest, UnwatchAddressRequest, UnwatchOrderBookRequest, WatchAddress200Response, WatchAddressRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index';
|
|
14
14
|
export interface BuildOrderOperationRequest {
|
|
15
15
|
exchange: BuildOrderOperationExchangeEnum;
|
|
16
16
|
buildOrderRequest?: BuildOrderRequest;
|
|
@@ -172,6 +172,10 @@ export interface UnwatchAddressOperationRequest {
|
|
|
172
172
|
exchange: UnwatchAddressOperationExchangeEnum;
|
|
173
173
|
unwatchAddressRequest?: UnwatchAddressRequest;
|
|
174
174
|
}
|
|
175
|
+
export interface UnwatchOrderBookOperationRequest {
|
|
176
|
+
exchange: UnwatchOrderBookOperationExchangeEnum;
|
|
177
|
+
unwatchOrderBookRequest?: UnwatchOrderBookRequest;
|
|
178
|
+
}
|
|
175
179
|
export interface WatchAddressOperationRequest {
|
|
176
180
|
exchange: WatchAddressOperationExchangeEnum;
|
|
177
181
|
watchAddressRequest?: WatchAddressRequest;
|
|
@@ -450,6 +454,16 @@ export declare class DefaultApi extends runtime.BaseAPI {
|
|
|
450
454
|
* Unwatch Address
|
|
451
455
|
*/
|
|
452
456
|
unwatchAddress(requestParameters: UnwatchAddressOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
457
|
+
/**
|
|
458
|
+
* Unsubscribe from a previously watched order book stream.
|
|
459
|
+
* Unwatch Order Book
|
|
460
|
+
*/
|
|
461
|
+
unwatchOrderBookRaw(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseResponse>>;
|
|
462
|
+
/**
|
|
463
|
+
* Unsubscribe from a previously watched order book stream.
|
|
464
|
+
* Unwatch Order Book
|
|
465
|
+
*/
|
|
466
|
+
unwatchOrderBook(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse>;
|
|
453
467
|
/**
|
|
454
468
|
* 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).
|
|
455
469
|
* Watch Address
|
|
@@ -1047,6 +1061,23 @@ export declare const UnwatchAddressOperationExchangeEnum: {
|
|
|
1047
1061
|
readonly PolymarketUs: "polymarket_us";
|
|
1048
1062
|
};
|
|
1049
1063
|
export type UnwatchAddressOperationExchangeEnum = typeof UnwatchAddressOperationExchangeEnum[keyof typeof UnwatchAddressOperationExchangeEnum];
|
|
1064
|
+
/**
|
|
1065
|
+
* @export
|
|
1066
|
+
*/
|
|
1067
|
+
export declare const UnwatchOrderBookOperationExchangeEnum: {
|
|
1068
|
+
readonly Polymarket: "polymarket";
|
|
1069
|
+
readonly Kalshi: "kalshi";
|
|
1070
|
+
readonly KalshiDemo: "kalshi-demo";
|
|
1071
|
+
readonly Limitless: "limitless";
|
|
1072
|
+
readonly Probable: "probable";
|
|
1073
|
+
readonly Baozi: "baozi";
|
|
1074
|
+
readonly Myriad: "myriad";
|
|
1075
|
+
readonly Opinion: "opinion";
|
|
1076
|
+
readonly Metaculus: "metaculus";
|
|
1077
|
+
readonly Smarkets: "smarkets";
|
|
1078
|
+
readonly PolymarketUs: "polymarket_us";
|
|
1079
|
+
};
|
|
1080
|
+
export type UnwatchOrderBookOperationExchangeEnum = typeof UnwatchOrderBookOperationExchangeEnum[keyof typeof UnwatchOrderBookOperationExchangeEnum];
|
|
1050
1081
|
/**
|
|
1051
1082
|
* @export
|
|
1052
1083
|
*/
|
|
@@ -46,7 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
};
|
|
47
47
|
})();
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.WatchTradesOperationExchangeEnum = exports.WatchOrderBookOperationExchangeEnum = exports.WatchAddressOperationExchangeEnum = exports.UnwatchAddressOperationExchangeEnum = exports.SubmitOrderOperationExchangeEnum = exports.LoadMarketsOperationExchangeEnum = exports.GetExecutionPriceDetailedOperationExchangeEnum = exports.GetExecutionPriceOperationExchangeEnum = exports.FilterMarketsOperationExchangeEnum = exports.FilterEventsOperationExchangeEnum = exports.FetchTradesExchangeEnum = exports.FetchPositionsExchangeEnum = exports.FetchOrderBookExchangeEnum = exports.FetchOrderExchangeEnum = exports.FetchOpenOrdersExchangeEnum = exports.FetchOHLCVResolutionEnum = exports.FetchOHLCVExchangeEnum = exports.FetchMyTradesExchangeEnum = exports.FetchMarketsPaginatedExchangeEnum = exports.FetchMarketsSearchInEnum = exports.FetchMarketsStatusEnum = exports.FetchMarketsSortEnum = exports.FetchMarketsExchangeEnum = exports.FetchMarketSearchInEnum = exports.FetchMarketStatusEnum = exports.FetchMarketSortEnum = exports.FetchMarketExchangeEnum = exports.FetchEventsSearchInEnum = exports.FetchEventsStatusEnum = exports.FetchEventsSortEnum = exports.FetchEventsExchangeEnum = exports.FetchEventSearchInEnum = exports.FetchEventStatusEnum = exports.FetchEventSortEnum = exports.FetchEventExchangeEnum = exports.FetchClosedOrdersExchangeEnum = exports.FetchBalanceExchangeEnum = exports.FetchAllOrdersExchangeEnum = exports.CreateOrderOperationExchangeEnum = exports.CloseOperationExchangeEnum = exports.CancelOrderOperationExchangeEnum = exports.BuildOrderOperationExchangeEnum = exports.DefaultApi = void 0;
|
|
49
|
+
exports.WatchTradesOperationExchangeEnum = exports.WatchOrderBookOperationExchangeEnum = exports.WatchAddressOperationExchangeEnum = exports.UnwatchOrderBookOperationExchangeEnum = exports.UnwatchAddressOperationExchangeEnum = exports.SubmitOrderOperationExchangeEnum = exports.LoadMarketsOperationExchangeEnum = exports.GetExecutionPriceDetailedOperationExchangeEnum = exports.GetExecutionPriceOperationExchangeEnum = exports.FilterMarketsOperationExchangeEnum = exports.FilterEventsOperationExchangeEnum = exports.FetchTradesExchangeEnum = exports.FetchPositionsExchangeEnum = exports.FetchOrderBookExchangeEnum = exports.FetchOrderExchangeEnum = exports.FetchOpenOrdersExchangeEnum = exports.FetchOHLCVResolutionEnum = exports.FetchOHLCVExchangeEnum = exports.FetchMyTradesExchangeEnum = exports.FetchMarketsPaginatedExchangeEnum = exports.FetchMarketsSearchInEnum = exports.FetchMarketsStatusEnum = exports.FetchMarketsSortEnum = exports.FetchMarketsExchangeEnum = exports.FetchMarketSearchInEnum = exports.FetchMarketStatusEnum = exports.FetchMarketSortEnum = exports.FetchMarketExchangeEnum = exports.FetchEventsSearchInEnum = exports.FetchEventsStatusEnum = exports.FetchEventsSortEnum = exports.FetchEventsExchangeEnum = exports.FetchEventSearchInEnum = exports.FetchEventStatusEnum = exports.FetchEventSortEnum = exports.FetchEventExchangeEnum = exports.FetchClosedOrdersExchangeEnum = exports.FetchBalanceExchangeEnum = exports.FetchAllOrdersExchangeEnum = exports.CreateOrderOperationExchangeEnum = exports.CloseOperationExchangeEnum = exports.CancelOrderOperationExchangeEnum = exports.BuildOrderOperationExchangeEnum = exports.DefaultApi = void 0;
|
|
50
50
|
const runtime = __importStar(require("../runtime"));
|
|
51
51
|
const index_1 = require("../models/index");
|
|
52
52
|
/**
|
|
@@ -1047,6 +1047,36 @@ class DefaultApi extends runtime.BaseAPI {
|
|
|
1047
1047
|
const response = await this.unwatchAddressRaw(requestParameters, initOverrides);
|
|
1048
1048
|
return await response.value();
|
|
1049
1049
|
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1052
|
+
* Unwatch Order Book
|
|
1053
|
+
*/
|
|
1054
|
+
async unwatchOrderBookRaw(requestParameters, initOverrides) {
|
|
1055
|
+
if (requestParameters['exchange'] == null) {
|
|
1056
|
+
throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling unwatchOrderBook().');
|
|
1057
|
+
}
|
|
1058
|
+
const queryParameters = {};
|
|
1059
|
+
const headerParameters = {};
|
|
1060
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1061
|
+
let urlPath = `/api/{exchange}/unwatchOrderBook`;
|
|
1062
|
+
urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
|
|
1063
|
+
const response = await this.request({
|
|
1064
|
+
path: urlPath,
|
|
1065
|
+
method: 'POST',
|
|
1066
|
+
headers: headerParameters,
|
|
1067
|
+
query: queryParameters,
|
|
1068
|
+
body: (0, index_1.UnwatchOrderBookRequestToJSON)(requestParameters['unwatchOrderBookRequest']),
|
|
1069
|
+
}, initOverrides);
|
|
1070
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.BaseResponseFromJSON)(jsonValue));
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1074
|
+
* Unwatch Order Book
|
|
1075
|
+
*/
|
|
1076
|
+
async unwatchOrderBook(requestParameters, initOverrides) {
|
|
1077
|
+
const response = await this.unwatchOrderBookRaw(requestParameters, initOverrides);
|
|
1078
|
+
return await response.value();
|
|
1079
|
+
}
|
|
1050
1080
|
/**
|
|
1051
1081
|
* 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).
|
|
1052
1082
|
* Watch Address
|
|
@@ -1666,6 +1696,22 @@ exports.UnwatchAddressOperationExchangeEnum = {
|
|
|
1666
1696
|
Smarkets: 'smarkets',
|
|
1667
1697
|
PolymarketUs: 'polymarket_us'
|
|
1668
1698
|
};
|
|
1699
|
+
/**
|
|
1700
|
+
* @export
|
|
1701
|
+
*/
|
|
1702
|
+
exports.UnwatchOrderBookOperationExchangeEnum = {
|
|
1703
|
+
Polymarket: 'polymarket',
|
|
1704
|
+
Kalshi: 'kalshi',
|
|
1705
|
+
KalshiDemo: 'kalshi-demo',
|
|
1706
|
+
Limitless: 'limitless',
|
|
1707
|
+
Probable: 'probable',
|
|
1708
|
+
Baozi: 'baozi',
|
|
1709
|
+
Myriad: 'myriad',
|
|
1710
|
+
Opinion: 'opinion',
|
|
1711
|
+
Metaculus: 'metaculus',
|
|
1712
|
+
Smarkets: 'smarkets',
|
|
1713
|
+
PolymarketUs: 'polymarket_us'
|
|
1714
|
+
};
|
|
1669
1715
|
/**
|
|
1670
1716
|
* @export
|
|
1671
1717
|
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.4.4
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExchangeCredentials } from './ExchangeCredentials';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface UnwatchOrderBookRequest
|
|
17
|
+
*/
|
|
18
|
+
export interface UnwatchOrderBookRequest {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<string>}
|
|
22
|
+
* @memberof UnwatchOrderBookRequest
|
|
23
|
+
*/
|
|
24
|
+
args: Array<string>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {ExchangeCredentials}
|
|
28
|
+
* @memberof UnwatchOrderBookRequest
|
|
29
|
+
*/
|
|
30
|
+
credentials?: ExchangeCredentials;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
34
|
+
*/
|
|
35
|
+
export declare function instanceOfUnwatchOrderBookRequest(value: object): value is UnwatchOrderBookRequest;
|
|
36
|
+
export declare function UnwatchOrderBookRequestFromJSON(json: any): UnwatchOrderBookRequest;
|
|
37
|
+
export declare function UnwatchOrderBookRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnwatchOrderBookRequest;
|
|
38
|
+
export declare function UnwatchOrderBookRequestToJSON(json: any): UnwatchOrderBookRequest;
|
|
39
|
+
export declare function UnwatchOrderBookRequestToJSONTyped(value?: UnwatchOrderBookRequest | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* PMXT Sidecar API
|
|
6
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.4.4
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.instanceOfUnwatchOrderBookRequest = instanceOfUnwatchOrderBookRequest;
|
|
17
|
+
exports.UnwatchOrderBookRequestFromJSON = UnwatchOrderBookRequestFromJSON;
|
|
18
|
+
exports.UnwatchOrderBookRequestFromJSONTyped = UnwatchOrderBookRequestFromJSONTyped;
|
|
19
|
+
exports.UnwatchOrderBookRequestToJSON = UnwatchOrderBookRequestToJSON;
|
|
20
|
+
exports.UnwatchOrderBookRequestToJSONTyped = UnwatchOrderBookRequestToJSONTyped;
|
|
21
|
+
const ExchangeCredentials_1 = require("./ExchangeCredentials");
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
24
|
+
*/
|
|
25
|
+
function instanceOfUnwatchOrderBookRequest(value) {
|
|
26
|
+
if (!('args' in value) || value['args'] === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function UnwatchOrderBookRequestFromJSON(json) {
|
|
31
|
+
return UnwatchOrderBookRequestFromJSONTyped(json, false);
|
|
32
|
+
}
|
|
33
|
+
function UnwatchOrderBookRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
34
|
+
if (json == null) {
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'args': json['args'],
|
|
39
|
+
'credentials': json['credentials'] == null ? undefined : (0, ExchangeCredentials_1.ExchangeCredentialsFromJSON)(json['credentials']),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function UnwatchOrderBookRequestToJSON(json) {
|
|
43
|
+
return UnwatchOrderBookRequestToJSONTyped(json, false);
|
|
44
|
+
}
|
|
45
|
+
function UnwatchOrderBookRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
46
|
+
if (value == null) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
'args': value['args'],
|
|
51
|
+
'credentials': (0, ExchangeCredentials_1.ExchangeCredentialsToJSON)(value['credentials']),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -63,6 +63,7 @@ export * from './TradesParams';
|
|
|
63
63
|
export * from './UnifiedEvent';
|
|
64
64
|
export * from './UnifiedMarket';
|
|
65
65
|
export * from './UnwatchAddressRequest';
|
|
66
|
+
export * from './UnwatchOrderBookRequest';
|
|
66
67
|
export * from './UserTrade';
|
|
67
68
|
export * from './WatchAddress200Response';
|
|
68
69
|
export * from './WatchAddressRequest';
|
|
@@ -81,6 +81,7 @@ __exportStar(require("./TradesParams"), exports);
|
|
|
81
81
|
__exportStar(require("./UnifiedEvent"), exports);
|
|
82
82
|
__exportStar(require("./UnifiedMarket"), exports);
|
|
83
83
|
__exportStar(require("./UnwatchAddressRequest"), exports);
|
|
84
|
+
__exportStar(require("./UnwatchOrderBookRequest"), exports);
|
|
84
85
|
__exportStar(require("./UserTrade"), exports);
|
|
85
86
|
__exportStar(require("./WatchAddress200Response"), exports);
|
|
86
87
|
__exportStar(require("./WatchAddressRequest"), exports);
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -181,6 +181,12 @@ export declare abstract class Exchange {
|
|
|
181
181
|
* ```
|
|
182
182
|
*/
|
|
183
183
|
watchOrderBook(outcomeId: string | MarketOutcome, limit?: number): Promise<OrderBook>;
|
|
184
|
+
/**
|
|
185
|
+
* Unsubscribe from a previously watched order book stream.
|
|
186
|
+
*
|
|
187
|
+
* @param outcomeId - Outcome ID to stop watching
|
|
188
|
+
*/
|
|
189
|
+
unwatchOrderBook(outcomeId: string | MarketOutcome): Promise<void>;
|
|
184
190
|
/**
|
|
185
191
|
* Watch real-time trade updates via WebSocket.
|
|
186
192
|
*
|
package/dist/pmxt/client.js
CHANGED
|
@@ -855,6 +855,37 @@ class Exchange {
|
|
|
855
855
|
throw new errors_js_1.PmxtError(`Failed to watch order book: ${error}`);
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
+
/**
|
|
859
|
+
* Unsubscribe from a previously watched order book stream.
|
|
860
|
+
*
|
|
861
|
+
* @param outcomeId - Outcome ID to stop watching
|
|
862
|
+
*/
|
|
863
|
+
async unwatchOrderBook(outcomeId) {
|
|
864
|
+
await this.initPromise;
|
|
865
|
+
const resolvedOutcomeId = resolveOutcomeId(outcomeId);
|
|
866
|
+
try {
|
|
867
|
+
const args = [resolvedOutcomeId];
|
|
868
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/unwatchOrderBook`, {
|
|
869
|
+
method: 'POST',
|
|
870
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
871
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
872
|
+
});
|
|
873
|
+
if (!response.ok) {
|
|
874
|
+
const body = await response.json().catch(() => ({}));
|
|
875
|
+
if (body.error && typeof body.error === "object") {
|
|
876
|
+
throw (0, errors_js_1.fromServerError)(body.error);
|
|
877
|
+
}
|
|
878
|
+
throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
|
|
879
|
+
}
|
|
880
|
+
const json = await response.json();
|
|
881
|
+
this.handleResponse(json);
|
|
882
|
+
}
|
|
883
|
+
catch (error) {
|
|
884
|
+
if (error instanceof errors_js_1.PmxtError)
|
|
885
|
+
throw error;
|
|
886
|
+
throw new errors_js_1.PmxtError(`Failed to unwatch order book: ${error}`);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
858
889
|
/**
|
|
859
890
|
* Watch real-time trade updates via WebSocket.
|
|
860
891
|
*
|
|
@@ -68,6 +68,7 @@ docs/TradesParams.md
|
|
|
68
68
|
docs/UnifiedEvent.md
|
|
69
69
|
docs/UnifiedMarket.md
|
|
70
70
|
docs/UnwatchAddressRequest.md
|
|
71
|
+
docs/UnwatchOrderBookRequest.md
|
|
71
72
|
docs/UserTrade.md
|
|
72
73
|
docs/WatchAddress200Response.md
|
|
73
74
|
docs/WatchAddressRequest.md
|
|
@@ -144,6 +145,7 @@ src/models/TradesParams.ts
|
|
|
144
145
|
src/models/UnifiedEvent.ts
|
|
145
146
|
src/models/UnifiedMarket.ts
|
|
146
147
|
src/models/UnwatchAddressRequest.ts
|
|
148
|
+
src/models/UnwatchOrderBookRequest.ts
|
|
147
149
|
src/models/UserTrade.ts
|
|
148
150
|
src/models/WatchAddress200Response.ts
|
|
149
151
|
src/models/WatchAddressRequest.ts
|
|
@@ -31,6 +31,7 @@ All URIs are relative to *http://localhost:3847*
|
|
|
31
31
|
| [**loadMarkets**](DefaultApi.md#loadmarketsoperation) | **POST** /api/{exchange}/loadMarkets | Load Markets |
|
|
32
32
|
| [**submitOrder**](DefaultApi.md#submitorderoperation) | **POST** /api/{exchange}/submitOrder | Submit Order |
|
|
33
33
|
| [**unwatchAddress**](DefaultApi.md#unwatchaddressoperation) | **POST** /api/{exchange}/unwatchAddress | Unwatch Address |
|
|
34
|
+
| [**unwatchOrderBook**](DefaultApi.md#unwatchorderbookoperation) | **POST** /api/{exchange}/unwatchOrderBook | Unwatch Order Book |
|
|
34
35
|
| [**watchAddress**](DefaultApi.md#watchaddressoperation) | **POST** /api/{exchange}/watchAddress | Watch Address |
|
|
35
36
|
| [**watchOrderBook**](DefaultApi.md#watchorderbookoperation) | **POST** /api/{exchange}/watchOrderBook | Watch Order Book |
|
|
36
37
|
| [**watchTrades**](DefaultApi.md#watchtradesoperation) | **POST** /api/{exchange}/watchTrades | Watch Trades |
|
|
@@ -2079,6 +2080,76 @@ No authorization required
|
|
|
2079
2080
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
2080
2081
|
|
|
2081
2082
|
|
|
2083
|
+
## unwatchOrderBook
|
|
2084
|
+
|
|
2085
|
+
> BaseResponse unwatchOrderBook(exchange, unwatchOrderBookRequest)
|
|
2086
|
+
|
|
2087
|
+
Unwatch Order Book
|
|
2088
|
+
|
|
2089
|
+
Unsubscribe from a previously watched order book stream.
|
|
2090
|
+
|
|
2091
|
+
### Example
|
|
2092
|
+
|
|
2093
|
+
```ts
|
|
2094
|
+
import {
|
|
2095
|
+
Configuration,
|
|
2096
|
+
DefaultApi,
|
|
2097
|
+
} from 'pmxtjs';
|
|
2098
|
+
import type { UnwatchOrderBookOperationRequest } from 'pmxtjs';
|
|
2099
|
+
|
|
2100
|
+
async function example() {
|
|
2101
|
+
console.log("🚀 Testing pmxtjs SDK...");
|
|
2102
|
+
const api = new DefaultApi();
|
|
2103
|
+
|
|
2104
|
+
const body = {
|
|
2105
|
+
// 'polymarket' | 'kalshi' | 'kalshi-demo' | 'limitless' | 'probable' | 'baozi' | 'myriad' | 'opinion' | 'metaculus' | 'smarkets' | 'polymarket_us' | The prediction market exchange to target.
|
|
2106
|
+
exchange: exchange_example,
|
|
2107
|
+
// UnwatchOrderBookRequest (optional)
|
|
2108
|
+
unwatchOrderBookRequest: ...,
|
|
2109
|
+
} satisfies UnwatchOrderBookOperationRequest;
|
|
2110
|
+
|
|
2111
|
+
try {
|
|
2112
|
+
const data = await api.unwatchOrderBook(body);
|
|
2113
|
+
console.log(data);
|
|
2114
|
+
} catch (error) {
|
|
2115
|
+
console.error(error);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// Run the test
|
|
2120
|
+
example().catch(console.error);
|
|
2121
|
+
```
|
|
2122
|
+
|
|
2123
|
+
### Parameters
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
| Name | Type | Description | Notes |
|
|
2127
|
+
|------------- | ------------- | ------------- | -------------|
|
|
2128
|
+
| **exchange** | `polymarket`, `kalshi`, `kalshi-demo`, `limitless`, `probable`, `baozi`, `myriad`, `opinion`, `metaculus`, `smarkets`, `polymarket_us` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us] |
|
|
2129
|
+
| **unwatchOrderBookRequest** | [UnwatchOrderBookRequest](UnwatchOrderBookRequest.md) | | [Optional] |
|
|
2130
|
+
|
|
2131
|
+
### Return type
|
|
2132
|
+
|
|
2133
|
+
[**BaseResponse**](BaseResponse.md)
|
|
2134
|
+
|
|
2135
|
+
### Authorization
|
|
2136
|
+
|
|
2137
|
+
No authorization required
|
|
2138
|
+
|
|
2139
|
+
### HTTP request headers
|
|
2140
|
+
|
|
2141
|
+
- **Content-Type**: `application/json`
|
|
2142
|
+
- **Accept**: `application/json`
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
### HTTP response details
|
|
2146
|
+
| Status code | Description | Response headers |
|
|
2147
|
+
|-------------|-------------|------------------|
|
|
2148
|
+
| **200** | Unwatch Order Book response | - |
|
|
2149
|
+
|
|
2150
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
2151
|
+
|
|
2152
|
+
|
|
2082
2153
|
## watchAddress
|
|
2083
2154
|
|
|
2084
2155
|
> WatchAddress200Response watchAddress(exchange, watchAddressRequest)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# UnwatchOrderBookRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`args` | Array<string>
|
|
10
|
+
`credentials` | [ExchangeCredentials](ExchangeCredentials.md)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { UnwatchOrderBookRequest } from 'pmxtjs'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"args": null,
|
|
20
|
+
"credentials": null,
|
|
21
|
+
} satisfies UnwatchOrderBookRequest
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as UnwatchOrderBookRequest
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
package/generated/package.json
CHANGED
|
@@ -45,6 +45,7 @@ import type {
|
|
|
45
45
|
LoadMarketsRequest,
|
|
46
46
|
SubmitOrderRequest,
|
|
47
47
|
UnwatchAddressRequest,
|
|
48
|
+
UnwatchOrderBookRequest,
|
|
48
49
|
WatchAddress200Response,
|
|
49
50
|
WatchAddressRequest,
|
|
50
51
|
WatchOrderBookRequest,
|
|
@@ -111,6 +112,8 @@ import {
|
|
|
111
112
|
SubmitOrderRequestToJSON,
|
|
112
113
|
UnwatchAddressRequestFromJSON,
|
|
113
114
|
UnwatchAddressRequestToJSON,
|
|
115
|
+
UnwatchOrderBookRequestFromJSON,
|
|
116
|
+
UnwatchOrderBookRequestToJSON,
|
|
114
117
|
WatchAddress200ResponseFromJSON,
|
|
115
118
|
WatchAddress200ResponseToJSON,
|
|
116
119
|
WatchAddressRequestFromJSON,
|
|
@@ -308,6 +311,11 @@ export interface UnwatchAddressOperationRequest {
|
|
|
308
311
|
unwatchAddressRequest?: UnwatchAddressRequest;
|
|
309
312
|
}
|
|
310
313
|
|
|
314
|
+
export interface UnwatchOrderBookOperationRequest {
|
|
315
|
+
exchange: UnwatchOrderBookOperationExchangeEnum;
|
|
316
|
+
unwatchOrderBookRequest?: UnwatchOrderBookRequest;
|
|
317
|
+
}
|
|
318
|
+
|
|
311
319
|
export interface WatchAddressOperationRequest {
|
|
312
320
|
exchange: WatchAddressOperationExchangeEnum;
|
|
313
321
|
watchAddressRequest?: WatchAddressRequest;
|
|
@@ -1714,6 +1722,48 @@ export class DefaultApi extends runtime.BaseAPI {
|
|
|
1714
1722
|
return await response.value();
|
|
1715
1723
|
}
|
|
1716
1724
|
|
|
1725
|
+
/**
|
|
1726
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1727
|
+
* Unwatch Order Book
|
|
1728
|
+
*/
|
|
1729
|
+
async unwatchOrderBookRaw(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BaseResponse>> {
|
|
1730
|
+
if (requestParameters['exchange'] == null) {
|
|
1731
|
+
throw new runtime.RequiredError(
|
|
1732
|
+
'exchange',
|
|
1733
|
+
'Required parameter "exchange" was null or undefined when calling unwatchOrderBook().'
|
|
1734
|
+
);
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
const queryParameters: any = {};
|
|
1738
|
+
|
|
1739
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1740
|
+
|
|
1741
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
let urlPath = `/api/{exchange}/unwatchOrderBook`;
|
|
1745
|
+
urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
|
|
1746
|
+
|
|
1747
|
+
const response = await this.request({
|
|
1748
|
+
path: urlPath,
|
|
1749
|
+
method: 'POST',
|
|
1750
|
+
headers: headerParameters,
|
|
1751
|
+
query: queryParameters,
|
|
1752
|
+
body: UnwatchOrderBookRequestToJSON(requestParameters['unwatchOrderBookRequest']),
|
|
1753
|
+
}, initOverrides);
|
|
1754
|
+
|
|
1755
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BaseResponseFromJSON(jsonValue));
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
* Unsubscribe from a previously watched order book stream.
|
|
1760
|
+
* Unwatch Order Book
|
|
1761
|
+
*/
|
|
1762
|
+
async unwatchOrderBook(requestParameters: UnwatchOrderBookOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BaseResponse> {
|
|
1763
|
+
const response = await this.unwatchOrderBookRaw(requestParameters, initOverrides);
|
|
1764
|
+
return await response.value();
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1717
1767
|
/**
|
|
1718
1768
|
* 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).
|
|
1719
1769
|
* Watch Address
|
|
@@ -2408,6 +2458,23 @@ export const UnwatchAddressOperationExchangeEnum = {
|
|
|
2408
2458
|
PolymarketUs: 'polymarket_us'
|
|
2409
2459
|
} as const;
|
|
2410
2460
|
export type UnwatchAddressOperationExchangeEnum = typeof UnwatchAddressOperationExchangeEnum[keyof typeof UnwatchAddressOperationExchangeEnum];
|
|
2461
|
+
/**
|
|
2462
|
+
* @export
|
|
2463
|
+
*/
|
|
2464
|
+
export const UnwatchOrderBookOperationExchangeEnum = {
|
|
2465
|
+
Polymarket: 'polymarket',
|
|
2466
|
+
Kalshi: 'kalshi',
|
|
2467
|
+
KalshiDemo: 'kalshi-demo',
|
|
2468
|
+
Limitless: 'limitless',
|
|
2469
|
+
Probable: 'probable',
|
|
2470
|
+
Baozi: 'baozi',
|
|
2471
|
+
Myriad: 'myriad',
|
|
2472
|
+
Opinion: 'opinion',
|
|
2473
|
+
Metaculus: 'metaculus',
|
|
2474
|
+
Smarkets: 'smarkets',
|
|
2475
|
+
PolymarketUs: 'polymarket_us'
|
|
2476
|
+
} as const;
|
|
2477
|
+
export type UnwatchOrderBookOperationExchangeEnum = typeof UnwatchOrderBookOperationExchangeEnum[keyof typeof UnwatchOrderBookOperationExchangeEnum];
|
|
2411
2478
|
/**
|
|
2412
2479
|
* @export
|
|
2413
2480
|
*/
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PMXT Sidecar API
|
|
5
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.4.4
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { ExchangeCredentials } from './ExchangeCredentials';
|
|
17
|
+
import {
|
|
18
|
+
ExchangeCredentialsFromJSON,
|
|
19
|
+
ExchangeCredentialsFromJSONTyped,
|
|
20
|
+
ExchangeCredentialsToJSON,
|
|
21
|
+
ExchangeCredentialsToJSONTyped,
|
|
22
|
+
} from './ExchangeCredentials';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @interface UnwatchOrderBookRequest
|
|
28
|
+
*/
|
|
29
|
+
export interface UnwatchOrderBookRequest {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {Array<string>}
|
|
33
|
+
* @memberof UnwatchOrderBookRequest
|
|
34
|
+
*/
|
|
35
|
+
args: Array<string>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {ExchangeCredentials}
|
|
39
|
+
* @memberof UnwatchOrderBookRequest
|
|
40
|
+
*/
|
|
41
|
+
credentials?: ExchangeCredentials;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Check if a given object implements the UnwatchOrderBookRequest interface.
|
|
46
|
+
*/
|
|
47
|
+
export function instanceOfUnwatchOrderBookRequest(value: object): value is UnwatchOrderBookRequest {
|
|
48
|
+
if (!('args' in value) || value['args'] === undefined) return false;
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function UnwatchOrderBookRequestFromJSON(json: any): UnwatchOrderBookRequest {
|
|
53
|
+
return UnwatchOrderBookRequestFromJSONTyped(json, false);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function UnwatchOrderBookRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnwatchOrderBookRequest {
|
|
57
|
+
if (json == null) {
|
|
58
|
+
return json;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
|
|
62
|
+
'args': json['args'],
|
|
63
|
+
'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function UnwatchOrderBookRequestToJSON(json: any): UnwatchOrderBookRequest {
|
|
68
|
+
return UnwatchOrderBookRequestToJSONTyped(json, false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function UnwatchOrderBookRequestToJSONTyped(value?: UnwatchOrderBookRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
72
|
+
if (value == null) {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
|
|
78
|
+
'args': value['args'],
|
|
79
|
+
'credentials': ExchangeCredentialsToJSON(value['credentials']),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
@@ -65,6 +65,7 @@ export * from './TradesParams';
|
|
|
65
65
|
export * from './UnifiedEvent';
|
|
66
66
|
export * from './UnifiedMarket';
|
|
67
67
|
export * from './UnwatchAddressRequest';
|
|
68
|
+
export * from './UnwatchOrderBookRequest';
|
|
68
69
|
export * from './UserTrade';
|
|
69
70
|
export * from './WatchAddress200Response';
|
|
70
71
|
export * from './WatchAddressRequest';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "Unified prediction market data API - The ccxt for prediction markets",
|
|
5
5
|
"author": "PMXT Contributors",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unified"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pmxt-core": "2.
|
|
46
|
+
"pmxt-core": "2.28.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jest": "^30.0.0",
|
package/pmxt/client.ts
CHANGED
|
@@ -974,6 +974,37 @@ export abstract class Exchange {
|
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
976
|
|
|
977
|
+
/**
|
|
978
|
+
* Unsubscribe from a previously watched order book stream.
|
|
979
|
+
*
|
|
980
|
+
* @param outcomeId - Outcome ID to stop watching
|
|
981
|
+
*/
|
|
982
|
+
async unwatchOrderBook(outcomeId: string | MarketOutcome): Promise<void> {
|
|
983
|
+
await this.initPromise;
|
|
984
|
+
const resolvedOutcomeId = resolveOutcomeId(outcomeId);
|
|
985
|
+
try {
|
|
986
|
+
const args: any[] = [resolvedOutcomeId];
|
|
987
|
+
|
|
988
|
+
const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/unwatchOrderBook`, {
|
|
989
|
+
method: 'POST',
|
|
990
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
991
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
992
|
+
});
|
|
993
|
+
if (!response.ok) {
|
|
994
|
+
const body = await response.json().catch(() => ({}));
|
|
995
|
+
if (body.error && typeof body.error === "object") {
|
|
996
|
+
throw fromServerError(body.error);
|
|
997
|
+
}
|
|
998
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
999
|
+
}
|
|
1000
|
+
const json = await response.json();
|
|
1001
|
+
this.handleResponse(json);
|
|
1002
|
+
} catch (error) {
|
|
1003
|
+
if (error instanceof PmxtError) throw error;
|
|
1004
|
+
throw new PmxtError(`Failed to unwatch order book: ${error}`);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
977
1008
|
/**
|
|
978
1009
|
* Watch real-time trade updates via WebSocket.
|
|
979
1010
|
*
|