pmxtjs 1.3.3 → 1.4.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 +41 -1
- package/dist/esm/generated/src/apis/DefaultApi.js +71 -1
- package/dist/esm/generated/src/models/ExecutionPriceResult.d.ts +44 -0
- package/dist/esm/generated/src/models/ExecutionPriceResult.js +45 -0
- package/dist/esm/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
- package/dist/esm/generated/src/models/GetExecutionPrice200Response.js +46 -0
- package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
- package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.js +47 -0
- package/dist/esm/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
- package/dist/esm/generated/src/models/GetExecutionPriceRequest.js +47 -0
- package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
- package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.js +56 -0
- package/dist/esm/generated/src/models/index.d.ts +5 -0
- package/dist/esm/generated/src/models/index.js +5 -0
- package/dist/esm/pmxt/client.d.ts +36 -2
- package/dist/esm/pmxt/client.js +134 -4
- package/dist/esm/pmxt/models.d.ts +42 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +41 -1
- package/dist/generated/src/apis/DefaultApi.js +71 -1
- package/dist/generated/src/models/ExecutionPriceResult.d.ts +44 -0
- package/dist/generated/src/models/ExecutionPriceResult.js +52 -0
- package/dist/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
- package/dist/generated/src/models/GetExecutionPrice200Response.js +53 -0
- package/dist/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
- package/dist/generated/src/models/GetExecutionPriceDetailed200Response.js +54 -0
- package/dist/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
- package/dist/generated/src/models/GetExecutionPriceRequest.js +54 -0
- package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
- package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.js +62 -0
- package/dist/generated/src/models/index.d.ts +5 -0
- package/dist/generated/src/models/index.js +5 -0
- package/dist/pmxt/client.d.ts +36 -2
- package/dist/pmxt/client.js +134 -4
- package/dist/pmxt/models.d.ts +42 -0
- package/generated/.openapi-generator/FILES +10 -0
- package/generated/docs/DefaultApi.md +138 -0
- package/generated/docs/ExecutionPriceResult.md +38 -0
- package/generated/docs/GetExecutionPrice200Response.md +38 -0
- package/generated/docs/GetExecutionPriceDetailed200Response.md +38 -0
- package/generated/docs/GetExecutionPriceRequest.md +36 -0
- package/generated/docs/GetExecutionPriceRequestArgsInner.md +38 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +115 -0
- package/generated/src/models/ExecutionPriceResult.ts +81 -0
- package/generated/src/models/GetExecutionPrice200Response.ts +89 -0
- package/generated/src/models/GetExecutionPriceDetailed200Response.ts +96 -0
- package/generated/src/models/GetExecutionPriceRequest.ts +89 -0
- package/generated/src/models/GetExecutionPriceRequestArgsInner.ts +75 -0
- package/generated/src/models/index.ts +5 -0
- package/package.json +2 -2
- package/pmxt/client.ts +156 -4
- package/pmxt/models.ts +54 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi). 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 { ErrorDetail } from './ErrorDetail';
|
|
13
|
+
import type { ExecutionPriceResult } from './ExecutionPriceResult';
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface GetExecutionPriceDetailed200Response
|
|
18
|
+
*/
|
|
19
|
+
export interface GetExecutionPriceDetailed200Response {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {boolean}
|
|
23
|
+
* @memberof GetExecutionPriceDetailed200Response
|
|
24
|
+
*/
|
|
25
|
+
success?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {ErrorDetail}
|
|
29
|
+
* @memberof GetExecutionPriceDetailed200Response
|
|
30
|
+
*/
|
|
31
|
+
error?: ErrorDetail;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @type {ExecutionPriceResult}
|
|
35
|
+
* @memberof GetExecutionPriceDetailed200Response
|
|
36
|
+
*/
|
|
37
|
+
data?: ExecutionPriceResult;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if a given object implements the GetExecutionPriceDetailed200Response interface.
|
|
41
|
+
*/
|
|
42
|
+
export declare function instanceOfGetExecutionPriceDetailed200Response(value: object): value is GetExecutionPriceDetailed200Response;
|
|
43
|
+
export declare function GetExecutionPriceDetailed200ResponseFromJSON(json: any): GetExecutionPriceDetailed200Response;
|
|
44
|
+
export declare function GetExecutionPriceDetailed200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceDetailed200Response;
|
|
45
|
+
export declare function GetExecutionPriceDetailed200ResponseToJSON(json: any): GetExecutionPriceDetailed200Response;
|
|
46
|
+
export declare function GetExecutionPriceDetailed200ResponseToJSONTyped(value?: GetExecutionPriceDetailed200Response | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,54 @@
|
|
|
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). 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.instanceOfGetExecutionPriceDetailed200Response = instanceOfGetExecutionPriceDetailed200Response;
|
|
17
|
+
exports.GetExecutionPriceDetailed200ResponseFromJSON = GetExecutionPriceDetailed200ResponseFromJSON;
|
|
18
|
+
exports.GetExecutionPriceDetailed200ResponseFromJSONTyped = GetExecutionPriceDetailed200ResponseFromJSONTyped;
|
|
19
|
+
exports.GetExecutionPriceDetailed200ResponseToJSON = GetExecutionPriceDetailed200ResponseToJSON;
|
|
20
|
+
exports.GetExecutionPriceDetailed200ResponseToJSONTyped = GetExecutionPriceDetailed200ResponseToJSONTyped;
|
|
21
|
+
const ErrorDetail_1 = require("./ErrorDetail");
|
|
22
|
+
const ExecutionPriceResult_1 = require("./ExecutionPriceResult");
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the GetExecutionPriceDetailed200Response interface.
|
|
25
|
+
*/
|
|
26
|
+
function instanceOfGetExecutionPriceDetailed200Response(value) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function GetExecutionPriceDetailed200ResponseFromJSON(json) {
|
|
30
|
+
return GetExecutionPriceDetailed200ResponseFromJSONTyped(json, false);
|
|
31
|
+
}
|
|
32
|
+
function GetExecutionPriceDetailed200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
33
|
+
if (json == null) {
|
|
34
|
+
return json;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
'success': json['success'] == null ? undefined : json['success'],
|
|
38
|
+
'error': json['error'] == null ? undefined : (0, ErrorDetail_1.ErrorDetailFromJSON)(json['error']),
|
|
39
|
+
'data': json['data'] == null ? undefined : (0, ExecutionPriceResult_1.ExecutionPriceResultFromJSON)(json['data']),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function GetExecutionPriceDetailed200ResponseToJSON(json) {
|
|
43
|
+
return GetExecutionPriceDetailed200ResponseToJSONTyped(json, false);
|
|
44
|
+
}
|
|
45
|
+
function GetExecutionPriceDetailed200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
46
|
+
if (value == null) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
'success': value['success'],
|
|
51
|
+
'error': (0, ErrorDetail_1.ErrorDetailToJSON)(value['error']),
|
|
52
|
+
'data': (0, ExecutionPriceResult_1.ExecutionPriceResultToJSON)(value['data']),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi). 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 { GetExecutionPriceRequestArgsInner } from './GetExecutionPriceRequestArgsInner';
|
|
13
|
+
import type { ExchangeCredentials } from './ExchangeCredentials';
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface GetExecutionPriceRequest
|
|
18
|
+
*/
|
|
19
|
+
export interface GetExecutionPriceRequest {
|
|
20
|
+
/**
|
|
21
|
+
* [orderBook, side, amount]
|
|
22
|
+
* @type {Array<GetExecutionPriceRequestArgsInner>}
|
|
23
|
+
* @memberof GetExecutionPriceRequest
|
|
24
|
+
*/
|
|
25
|
+
args: Array<GetExecutionPriceRequestArgsInner>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {ExchangeCredentials}
|
|
29
|
+
* @memberof GetExecutionPriceRequest
|
|
30
|
+
*/
|
|
31
|
+
credentials?: ExchangeCredentials;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check if a given object implements the GetExecutionPriceRequest interface.
|
|
35
|
+
*/
|
|
36
|
+
export declare function instanceOfGetExecutionPriceRequest(value: object): value is GetExecutionPriceRequest;
|
|
37
|
+
export declare function GetExecutionPriceRequestFromJSON(json: any): GetExecutionPriceRequest;
|
|
38
|
+
export declare function GetExecutionPriceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequest;
|
|
39
|
+
export declare function GetExecutionPriceRequestToJSON(json: any): GetExecutionPriceRequest;
|
|
40
|
+
export declare function GetExecutionPriceRequestToJSONTyped(value?: GetExecutionPriceRequest | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,54 @@
|
|
|
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). 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.instanceOfGetExecutionPriceRequest = instanceOfGetExecutionPriceRequest;
|
|
17
|
+
exports.GetExecutionPriceRequestFromJSON = GetExecutionPriceRequestFromJSON;
|
|
18
|
+
exports.GetExecutionPriceRequestFromJSONTyped = GetExecutionPriceRequestFromJSONTyped;
|
|
19
|
+
exports.GetExecutionPriceRequestToJSON = GetExecutionPriceRequestToJSON;
|
|
20
|
+
exports.GetExecutionPriceRequestToJSONTyped = GetExecutionPriceRequestToJSONTyped;
|
|
21
|
+
const GetExecutionPriceRequestArgsInner_1 = require("./GetExecutionPriceRequestArgsInner");
|
|
22
|
+
const ExchangeCredentials_1 = require("./ExchangeCredentials");
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the GetExecutionPriceRequest interface.
|
|
25
|
+
*/
|
|
26
|
+
function instanceOfGetExecutionPriceRequest(value) {
|
|
27
|
+
if (!('args' in value) || value['args'] === undefined)
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function GetExecutionPriceRequestFromJSON(json) {
|
|
32
|
+
return GetExecutionPriceRequestFromJSONTyped(json, false);
|
|
33
|
+
}
|
|
34
|
+
function GetExecutionPriceRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
35
|
+
if (json == null) {
|
|
36
|
+
return json;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
'args': (json['args'].map(GetExecutionPriceRequestArgsInner_1.GetExecutionPriceRequestArgsInnerFromJSON)),
|
|
40
|
+
'credentials': json['credentials'] == null ? undefined : (0, ExchangeCredentials_1.ExchangeCredentialsFromJSON)(json['credentials']),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function GetExecutionPriceRequestToJSON(json) {
|
|
44
|
+
return GetExecutionPriceRequestToJSONTyped(json, false);
|
|
45
|
+
}
|
|
46
|
+
function GetExecutionPriceRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
47
|
+
if (value == null) {
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
'args': (value['args'].map(GetExecutionPriceRequestArgsInner_1.GetExecutionPriceRequestArgsInnerToJSON)),
|
|
52
|
+
'credentials': (0, ExchangeCredentials_1.ExchangeCredentialsToJSON)(value['credentials']),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi). 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 { OrderBook } from './OrderBook';
|
|
13
|
+
/**
|
|
14
|
+
* @type GetExecutionPriceRequestArgsInner
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export type GetExecutionPriceRequestArgsInner = OrderBook | number | string;
|
|
19
|
+
export declare function GetExecutionPriceRequestArgsInnerFromJSON(json: any): GetExecutionPriceRequestArgsInner;
|
|
20
|
+
export declare function GetExecutionPriceRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequestArgsInner;
|
|
21
|
+
export declare function GetExecutionPriceRequestArgsInnerToJSON(json: any): any;
|
|
22
|
+
export declare function GetExecutionPriceRequestArgsInnerToJSONTyped(value?: GetExecutionPriceRequestArgsInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,62 @@
|
|
|
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). 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.GetExecutionPriceRequestArgsInnerFromJSON = GetExecutionPriceRequestArgsInnerFromJSON;
|
|
17
|
+
exports.GetExecutionPriceRequestArgsInnerFromJSONTyped = GetExecutionPriceRequestArgsInnerFromJSONTyped;
|
|
18
|
+
exports.GetExecutionPriceRequestArgsInnerToJSON = GetExecutionPriceRequestArgsInnerToJSON;
|
|
19
|
+
exports.GetExecutionPriceRequestArgsInnerToJSONTyped = GetExecutionPriceRequestArgsInnerToJSONTyped;
|
|
20
|
+
const OrderBook_1 = require("./OrderBook");
|
|
21
|
+
function GetExecutionPriceRequestArgsInnerFromJSON(json) {
|
|
22
|
+
return GetExecutionPriceRequestArgsInnerFromJSONTyped(json, false);
|
|
23
|
+
}
|
|
24
|
+
function GetExecutionPriceRequestArgsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
if (json == null) {
|
|
26
|
+
return json;
|
|
27
|
+
}
|
|
28
|
+
if (typeof json !== 'object') {
|
|
29
|
+
return json;
|
|
30
|
+
}
|
|
31
|
+
if ((0, OrderBook_1.instanceOfOrderBook)(json)) {
|
|
32
|
+
return (0, OrderBook_1.OrderBookFromJSONTyped)(json, true);
|
|
33
|
+
}
|
|
34
|
+
if (typeof json === 'number') {
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
if (typeof json === 'string' && (json === 'buy' || json === 'sell')) {
|
|
38
|
+
return json;
|
|
39
|
+
}
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
function GetExecutionPriceRequestArgsInnerToJSON(json) {
|
|
43
|
+
return GetExecutionPriceRequestArgsInnerToJSONTyped(json, false);
|
|
44
|
+
}
|
|
45
|
+
function GetExecutionPriceRequestArgsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
46
|
+
if (value == null) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value !== 'object') {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
if ((0, OrderBook_1.instanceOfOrderBook)(value)) {
|
|
53
|
+
return (0, OrderBook_1.OrderBookToJSON)(value);
|
|
54
|
+
}
|
|
55
|
+
if (typeof value === 'number') {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
if (typeof value === 'string' && (value === 'buy' || value === 'sell')) {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
@@ -8,6 +8,7 @@ export * from './CreateOrderRequest';
|
|
|
8
8
|
export * from './ErrorDetail';
|
|
9
9
|
export * from './ErrorResponse';
|
|
10
10
|
export * from './ExchangeCredentials';
|
|
11
|
+
export * from './ExecutionPriceResult';
|
|
11
12
|
export * from './FetchBalance200Response';
|
|
12
13
|
export * from './FetchMarkets200Response';
|
|
13
14
|
export * from './FetchMarketsRequest';
|
|
@@ -22,6 +23,10 @@ export * from './FetchPositions200Response';
|
|
|
22
23
|
export * from './FetchPositionsRequest';
|
|
23
24
|
export * from './FetchTrades200Response';
|
|
24
25
|
export * from './FetchTradesRequest';
|
|
26
|
+
export * from './GetExecutionPrice200Response';
|
|
27
|
+
export * from './GetExecutionPriceDetailed200Response';
|
|
28
|
+
export * from './GetExecutionPriceRequest';
|
|
29
|
+
export * from './GetExecutionPriceRequestArgsInner';
|
|
25
30
|
export * from './GetMarketsBySlugRequest';
|
|
26
31
|
export * from './HealthCheck200Response';
|
|
27
32
|
export * from './HistoryFilterParams';
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./CreateOrderRequest"), exports);
|
|
|
26
26
|
__exportStar(require("./ErrorDetail"), exports);
|
|
27
27
|
__exportStar(require("./ErrorResponse"), exports);
|
|
28
28
|
__exportStar(require("./ExchangeCredentials"), exports);
|
|
29
|
+
__exportStar(require("./ExecutionPriceResult"), exports);
|
|
29
30
|
__exportStar(require("./FetchBalance200Response"), exports);
|
|
30
31
|
__exportStar(require("./FetchMarkets200Response"), exports);
|
|
31
32
|
__exportStar(require("./FetchMarketsRequest"), exports);
|
|
@@ -40,6 +41,10 @@ __exportStar(require("./FetchPositions200Response"), exports);
|
|
|
40
41
|
__exportStar(require("./FetchPositionsRequest"), exports);
|
|
41
42
|
__exportStar(require("./FetchTrades200Response"), exports);
|
|
42
43
|
__exportStar(require("./FetchTradesRequest"), exports);
|
|
44
|
+
__exportStar(require("./GetExecutionPrice200Response"), exports);
|
|
45
|
+
__exportStar(require("./GetExecutionPriceDetailed200Response"), exports);
|
|
46
|
+
__exportStar(require("./GetExecutionPriceRequest"), exports);
|
|
47
|
+
__exportStar(require("./GetExecutionPriceRequestArgsInner"), exports);
|
|
43
48
|
__exportStar(require("./GetMarketsBySlugRequest"), exports);
|
|
44
49
|
__exportStar(require("./HealthCheck200Response"), exports);
|
|
45
50
|
__exportStar(require("./HistoryFilterParams"), exports);
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This module provides clean, TypeScript-friendly wrappers around the auto-generated
|
|
5
5
|
* OpenAPI client, matching the Python API exactly.
|
|
6
6
|
*/
|
|
7
|
-
import { DefaultApi, ExchangeCredentials } from "../generated/src/index.js";
|
|
8
|
-
import { UnifiedMarket, PriceCandle, OrderBook, Trade, Order, Position, Balance, MarketFilterParams, HistoryFilterParams, CreateOrderParams } from "./models.js";
|
|
7
|
+
import { DefaultApi, Configuration, ExchangeCredentials } from "../generated/src/index.js";
|
|
8
|
+
import { UnifiedMarket, PriceCandle, OrderBook, Trade, Order, Position, Balance, MarketFilterParams, HistoryFilterParams, CreateOrderParams, UnifiedEvent, ExecutionPriceResult } from "./models.js";
|
|
9
9
|
import { ServerManager } from "./server-manager.js";
|
|
10
10
|
/**
|
|
11
11
|
* Base exchange client options.
|
|
@@ -31,6 +31,7 @@ export declare abstract class Exchange {
|
|
|
31
31
|
protected apiKey?: string;
|
|
32
32
|
protected privateKey?: string;
|
|
33
33
|
protected api: DefaultApi;
|
|
34
|
+
protected config: Configuration;
|
|
34
35
|
protected serverManager: ServerManager;
|
|
35
36
|
protected initPromise: Promise<void>;
|
|
36
37
|
constructor(exchangeName: string, options?: ExchangeOptions);
|
|
@@ -62,6 +63,19 @@ export declare abstract class Exchange {
|
|
|
62
63
|
* ```
|
|
63
64
|
*/
|
|
64
65
|
searchMarkets(query: string, params?: MarketFilterParams): Promise<UnifiedMarket[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Search events (groups of related markets) by keyword.
|
|
68
|
+
*
|
|
69
|
+
* @param query - Search query
|
|
70
|
+
* @param params - Optional filter parameters
|
|
71
|
+
* @returns List of matching events
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const events = await exchange.searchEvents("Trump");
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
searchEvents(query: string, params?: MarketFilterParams): Promise<UnifiedEvent[]>;
|
|
65
79
|
/**
|
|
66
80
|
* Fetch markets by URL slug/ticker.
|
|
67
81
|
*
|
|
@@ -220,6 +234,26 @@ export declare abstract class Exchange {
|
|
|
220
234
|
* @returns List of balances (by currency)
|
|
221
235
|
*/
|
|
222
236
|
fetchBalance(): Promise<Balance[]>;
|
|
237
|
+
/**
|
|
238
|
+
* Calculate the average execution price for a given amount by walking the order book.
|
|
239
|
+
* Uses the sidecar server for calculation to ensure consistency.
|
|
240
|
+
*
|
|
241
|
+
* @param orderBook - The current order book
|
|
242
|
+
* @param side - 'buy' or 'sell'
|
|
243
|
+
* @param amount - The amount to execute
|
|
244
|
+
* @returns The volume-weighted average price, or 0 if insufficient liquidity
|
|
245
|
+
*/
|
|
246
|
+
getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number>;
|
|
247
|
+
/**
|
|
248
|
+
* Calculate detailed execution price information.
|
|
249
|
+
* Uses the sidecar server for calculation to ensure consistency.
|
|
250
|
+
*
|
|
251
|
+
* @param orderBook - The current order book
|
|
252
|
+
* @param side - 'buy' or 'sell'
|
|
253
|
+
* @param amount - The amount to execute
|
|
254
|
+
* @returns Detailed execution result
|
|
255
|
+
*/
|
|
256
|
+
getExecutionPriceDetailed(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<ExecutionPriceResult>;
|
|
223
257
|
}
|
|
224
258
|
/**
|
|
225
259
|
* Polymarket exchange client.
|
package/dist/pmxt/client.js
CHANGED
|
@@ -115,6 +115,37 @@ function convertBalance(raw) {
|
|
|
115
115
|
locked: raw.locked,
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
+
function convertEvent(raw) {
|
|
119
|
+
const markets = (raw.markets || []).map(convertMarket);
|
|
120
|
+
return {
|
|
121
|
+
id: raw.id,
|
|
122
|
+
title: raw.title,
|
|
123
|
+
description: raw.description,
|
|
124
|
+
slug: raw.slug,
|
|
125
|
+
markets,
|
|
126
|
+
url: raw.url,
|
|
127
|
+
image: raw.image,
|
|
128
|
+
category: raw.category,
|
|
129
|
+
tags: raw.tags,
|
|
130
|
+
searchMarkets(query, searchIn = "both") {
|
|
131
|
+
const queryLower = query.toLowerCase();
|
|
132
|
+
return this.markets.filter(market => {
|
|
133
|
+
let match = false;
|
|
134
|
+
if (searchIn === "title" || searchIn === "both") {
|
|
135
|
+
if (market.title.toLowerCase().includes(queryLower)) {
|
|
136
|
+
match = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (searchIn === "description" || searchIn === "both") {
|
|
140
|
+
if (market.description?.toLowerCase().includes(queryLower)) {
|
|
141
|
+
match = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return match;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
118
149
|
/**
|
|
119
150
|
* Base class for prediction market exchanges.
|
|
120
151
|
*
|
|
@@ -126,6 +157,7 @@ class Exchange {
|
|
|
126
157
|
apiKey;
|
|
127
158
|
privateKey;
|
|
128
159
|
api;
|
|
160
|
+
config;
|
|
129
161
|
serverManager;
|
|
130
162
|
initPromise;
|
|
131
163
|
constructor(exchangeName, options = {}) {
|
|
@@ -137,8 +169,8 @@ class Exchange {
|
|
|
137
169
|
// Initialize server manager
|
|
138
170
|
this.serverManager = new server_manager_js_1.ServerManager({ baseUrl });
|
|
139
171
|
// Configure the API client with the initial base URL (will be updated if port changes)
|
|
140
|
-
|
|
141
|
-
this.api = new index_js_1.DefaultApi(config);
|
|
172
|
+
this.config = new index_js_1.Configuration({ basePath: baseUrl });
|
|
173
|
+
this.api = new index_js_1.DefaultApi(this.config);
|
|
142
174
|
// Initialize the server connection asynchronously
|
|
143
175
|
this.initPromise = this.initializeServer(autoStartServer);
|
|
144
176
|
}
|
|
@@ -156,11 +188,11 @@ class Exchange {
|
|
|
156
188
|
headers['x-pmxt-access-token'] = accessToken;
|
|
157
189
|
}
|
|
158
190
|
// Update API client with actual base URL
|
|
159
|
-
|
|
191
|
+
this.config = new index_js_1.Configuration({
|
|
160
192
|
basePath: newBaseUrl,
|
|
161
193
|
headers
|
|
162
194
|
});
|
|
163
|
-
this.api = new index_js_1.DefaultApi(
|
|
195
|
+
this.api = new index_js_1.DefaultApi(this.config);
|
|
164
196
|
}
|
|
165
197
|
catch (error) {
|
|
166
198
|
throw new Error(`Failed to start PMXT server: ${error}\n\n` +
|
|
@@ -253,6 +285,52 @@ class Exchange {
|
|
|
253
285
|
throw new Error(`Failed to search markets: ${error}`);
|
|
254
286
|
}
|
|
255
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Search events (groups of related markets) by keyword.
|
|
290
|
+
*
|
|
291
|
+
* @param query - Search query
|
|
292
|
+
* @param params - Optional filter parameters
|
|
293
|
+
* @returns List of matching events
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const events = await exchange.searchEvents("Trump");
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
async searchEvents(query, params) {
|
|
301
|
+
await this.initPromise;
|
|
302
|
+
try {
|
|
303
|
+
const args = [query];
|
|
304
|
+
if (params) {
|
|
305
|
+
args.push(params);
|
|
306
|
+
}
|
|
307
|
+
const body = { args };
|
|
308
|
+
const credentials = this.getCredentials();
|
|
309
|
+
if (credentials) {
|
|
310
|
+
body.credentials = credentials;
|
|
311
|
+
}
|
|
312
|
+
// Manual implementation since generated client is missing this
|
|
313
|
+
const url = `${this.config.basePath}/api/${this.exchangeName}/searchEvents`;
|
|
314
|
+
const response = await fetch(url, {
|
|
315
|
+
method: 'POST',
|
|
316
|
+
headers: {
|
|
317
|
+
'Content-Type': 'application/json',
|
|
318
|
+
...this.config.headers
|
|
319
|
+
},
|
|
320
|
+
body: JSON.stringify(body)
|
|
321
|
+
});
|
|
322
|
+
if (!response.ok) {
|
|
323
|
+
const error = await response.json().catch(() => ({}));
|
|
324
|
+
throw new Error(error.error?.message || response.statusText);
|
|
325
|
+
}
|
|
326
|
+
const json = await response.json();
|
|
327
|
+
const data = this.handleResponse(json);
|
|
328
|
+
return data.map(convertEvent);
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
throw new Error(`Failed to search events: ${error}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
256
334
|
/**
|
|
257
335
|
* Fetch markets by URL slug/ticker.
|
|
258
336
|
*
|
|
@@ -657,6 +735,58 @@ class Exchange {
|
|
|
657
735
|
throw new Error(`Failed to fetch balance: ${error}`);
|
|
658
736
|
}
|
|
659
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Calculate the average execution price for a given amount by walking the order book.
|
|
740
|
+
* Uses the sidecar server for calculation to ensure consistency.
|
|
741
|
+
*
|
|
742
|
+
* @param orderBook - The current order book
|
|
743
|
+
* @param side - 'buy' or 'sell'
|
|
744
|
+
* @param amount - The amount to execute
|
|
745
|
+
* @returns The volume-weighted average price, or 0 if insufficient liquidity
|
|
746
|
+
*/
|
|
747
|
+
async getExecutionPrice(orderBook, side, amount) {
|
|
748
|
+
const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
|
|
749
|
+
return result.fullyFilled ? result.price : 0;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Calculate detailed execution price information.
|
|
753
|
+
* Uses the sidecar server for calculation to ensure consistency.
|
|
754
|
+
*
|
|
755
|
+
* @param orderBook - The current order book
|
|
756
|
+
* @param side - 'buy' or 'sell'
|
|
757
|
+
* @param amount - The amount to execute
|
|
758
|
+
* @returns Detailed execution result
|
|
759
|
+
*/
|
|
760
|
+
async getExecutionPriceDetailed(orderBook, side, amount) {
|
|
761
|
+
await this.initPromise;
|
|
762
|
+
try {
|
|
763
|
+
const body = {
|
|
764
|
+
args: [orderBook, side, amount]
|
|
765
|
+
};
|
|
766
|
+
const credentials = this.getCredentials();
|
|
767
|
+
if (credentials) {
|
|
768
|
+
body.credentials = credentials;
|
|
769
|
+
}
|
|
770
|
+
const url = `${this.config.basePath}/api/${this.exchangeName}/getExecutionPriceDetailed`;
|
|
771
|
+
const response = await fetch(url, {
|
|
772
|
+
method: 'POST',
|
|
773
|
+
headers: {
|
|
774
|
+
'Content-Type': 'application/json',
|
|
775
|
+
...this.config.headers
|
|
776
|
+
},
|
|
777
|
+
body: JSON.stringify(body)
|
|
778
|
+
});
|
|
779
|
+
if (!response.ok) {
|
|
780
|
+
const error = await response.json().catch(() => ({}));
|
|
781
|
+
throw new Error(error.error?.message || response.statusText);
|
|
782
|
+
}
|
|
783
|
+
const json = await response.json();
|
|
784
|
+
return this.handleResponse(json);
|
|
785
|
+
}
|
|
786
|
+
catch (error) {
|
|
787
|
+
throw new Error(`Failed to get execution price: ${error}`);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
660
790
|
}
|
|
661
791
|
exports.Exchange = Exchange;
|
|
662
792
|
/**
|
package/dist/pmxt/models.d.ts
CHANGED
|
@@ -98,6 +98,17 @@ export interface OrderBook {
|
|
|
98
98
|
/** Unix timestamp (milliseconds) */
|
|
99
99
|
timestamp?: number;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Result of an execution price calculation.
|
|
103
|
+
*/
|
|
104
|
+
export interface ExecutionPriceResult {
|
|
105
|
+
/** The volume-weighted average price */
|
|
106
|
+
price: number;
|
|
107
|
+
/** The actual amount that can be filled */
|
|
108
|
+
filledAmount: number;
|
|
109
|
+
/** Whether the full requested amount can be filled */
|
|
110
|
+
fullyFilled: boolean;
|
|
111
|
+
}
|
|
101
112
|
/**
|
|
102
113
|
* A historical trade.
|
|
103
114
|
*/
|
|
@@ -224,3 +235,34 @@ export interface CreateOrderParams {
|
|
|
224
235
|
/** Limit price (required for limit orders, 0.0-1.0) */
|
|
225
236
|
price?: number;
|
|
226
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* A grouped collection of related markets (e.g., "Who will be Fed Chair?" contains multiple candidate markets)
|
|
240
|
+
*/
|
|
241
|
+
export interface UnifiedEvent {
|
|
242
|
+
/** Event ID */
|
|
243
|
+
id: string;
|
|
244
|
+
/** Event title */
|
|
245
|
+
title: string;
|
|
246
|
+
/** Event description */
|
|
247
|
+
description: string;
|
|
248
|
+
/** Event slug */
|
|
249
|
+
slug: string;
|
|
250
|
+
/** Related markets in this event */
|
|
251
|
+
markets: UnifiedMarket[];
|
|
252
|
+
/** Event URL */
|
|
253
|
+
url: string;
|
|
254
|
+
/** Event image URL */
|
|
255
|
+
image?: string;
|
|
256
|
+
/** Event category */
|
|
257
|
+
category?: string;
|
|
258
|
+
/** Event tags */
|
|
259
|
+
tags?: string[];
|
|
260
|
+
/**
|
|
261
|
+
* Search for markets within this event by keyword.
|
|
262
|
+
*
|
|
263
|
+
* @param query - Search query (case-insensitive)
|
|
264
|
+
* @param searchIn - Where to search - "title", "description", or "both"
|
|
265
|
+
* @returns List of matching markets
|
|
266
|
+
*/
|
|
267
|
+
searchMarkets(query: string, searchIn?: SearchIn): UnifiedMarket[];
|
|
268
|
+
}
|
|
@@ -12,6 +12,7 @@ docs/DefaultApi.md
|
|
|
12
12
|
docs/ErrorDetail.md
|
|
13
13
|
docs/ErrorResponse.md
|
|
14
14
|
docs/ExchangeCredentials.md
|
|
15
|
+
docs/ExecutionPriceResult.md
|
|
15
16
|
docs/FetchBalance200Response.md
|
|
16
17
|
docs/FetchMarkets200Response.md
|
|
17
18
|
docs/FetchMarketsRequest.md
|
|
@@ -26,6 +27,10 @@ docs/FetchPositions200Response.md
|
|
|
26
27
|
docs/FetchPositionsRequest.md
|
|
27
28
|
docs/FetchTrades200Response.md
|
|
28
29
|
docs/FetchTradesRequest.md
|
|
30
|
+
docs/GetExecutionPrice200Response.md
|
|
31
|
+
docs/GetExecutionPriceDetailed200Response.md
|
|
32
|
+
docs/GetExecutionPriceRequest.md
|
|
33
|
+
docs/GetExecutionPriceRequestArgsInner.md
|
|
29
34
|
docs/GetMarketsBySlugRequest.md
|
|
30
35
|
docs/HealthCheck200Response.md
|
|
31
36
|
docs/HistoryFilterParams.md
|
|
@@ -60,6 +65,7 @@ src/models/CreateOrderRequest.ts
|
|
|
60
65
|
src/models/ErrorDetail.ts
|
|
61
66
|
src/models/ErrorResponse.ts
|
|
62
67
|
src/models/ExchangeCredentials.ts
|
|
68
|
+
src/models/ExecutionPriceResult.ts
|
|
63
69
|
src/models/FetchBalance200Response.ts
|
|
64
70
|
src/models/FetchMarkets200Response.ts
|
|
65
71
|
src/models/FetchMarketsRequest.ts
|
|
@@ -74,6 +80,10 @@ src/models/FetchPositions200Response.ts
|
|
|
74
80
|
src/models/FetchPositionsRequest.ts
|
|
75
81
|
src/models/FetchTrades200Response.ts
|
|
76
82
|
src/models/FetchTradesRequest.ts
|
|
83
|
+
src/models/GetExecutionPrice200Response.ts
|
|
84
|
+
src/models/GetExecutionPriceDetailed200Response.ts
|
|
85
|
+
src/models/GetExecutionPriceRequest.ts
|
|
86
|
+
src/models/GetExecutionPriceRequestArgsInner.ts
|
|
77
87
|
src/models/GetMarketsBySlugRequest.ts
|
|
78
88
|
src/models/HealthCheck200Response.ts
|
|
79
89
|
src/models/HistoryFilterParams.ts
|