pmxtjs 1.3.4 → 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.
Files changed (52) hide show
  1. package/dist/esm/generated/src/apis/DefaultApi.d.ts +41 -1
  2. package/dist/esm/generated/src/apis/DefaultApi.js +71 -1
  3. package/dist/esm/generated/src/models/ExecutionPriceResult.d.ts +44 -0
  4. package/dist/esm/generated/src/models/ExecutionPriceResult.js +45 -0
  5. package/dist/esm/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
  6. package/dist/esm/generated/src/models/GetExecutionPrice200Response.js +46 -0
  7. package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
  8. package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.js +47 -0
  9. package/dist/esm/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
  10. package/dist/esm/generated/src/models/GetExecutionPriceRequest.js +47 -0
  11. package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
  12. package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.js +56 -0
  13. package/dist/esm/generated/src/models/index.d.ts +5 -0
  14. package/dist/esm/generated/src/models/index.js +5 -0
  15. package/dist/esm/pmxt/client.d.ts +21 -1
  16. package/dist/esm/pmxt/client.js +52 -0
  17. package/dist/esm/pmxt/models.d.ts +11 -0
  18. package/dist/generated/src/apis/DefaultApi.d.ts +41 -1
  19. package/dist/generated/src/apis/DefaultApi.js +71 -1
  20. package/dist/generated/src/models/ExecutionPriceResult.d.ts +44 -0
  21. package/dist/generated/src/models/ExecutionPriceResult.js +52 -0
  22. package/dist/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
  23. package/dist/generated/src/models/GetExecutionPrice200Response.js +53 -0
  24. package/dist/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
  25. package/dist/generated/src/models/GetExecutionPriceDetailed200Response.js +54 -0
  26. package/dist/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
  27. package/dist/generated/src/models/GetExecutionPriceRequest.js +54 -0
  28. package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
  29. package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.js +62 -0
  30. package/dist/generated/src/models/index.d.ts +5 -0
  31. package/dist/generated/src/models/index.js +5 -0
  32. package/dist/pmxt/client.d.ts +21 -1
  33. package/dist/pmxt/client.js +52 -0
  34. package/dist/pmxt/models.d.ts +11 -0
  35. package/generated/.openapi-generator/FILES +10 -0
  36. package/generated/docs/DefaultApi.md +138 -0
  37. package/generated/docs/ExecutionPriceResult.md +38 -0
  38. package/generated/docs/GetExecutionPrice200Response.md +38 -0
  39. package/generated/docs/GetExecutionPriceDetailed200Response.md +38 -0
  40. package/generated/docs/GetExecutionPriceRequest.md +36 -0
  41. package/generated/docs/GetExecutionPriceRequestArgsInner.md +38 -0
  42. package/generated/package.json +1 -1
  43. package/generated/src/apis/DefaultApi.ts +115 -0
  44. package/generated/src/models/ExecutionPriceResult.ts +81 -0
  45. package/generated/src/models/GetExecutionPrice200Response.ts +89 -0
  46. package/generated/src/models/GetExecutionPriceDetailed200Response.ts +96 -0
  47. package/generated/src/models/GetExecutionPriceRequest.ts +89 -0
  48. package/generated/src/models/GetExecutionPriceRequestArgsInner.ts +75 -0
  49. package/generated/src/models/index.ts +5 -0
  50. package/package.json +2 -2
  51. package/pmxt/client.ts +62 -0
  52. package/pmxt/models.ts +14 -0
@@ -31,6 +31,9 @@ import type {
31
31
  FetchPositionsRequest,
32
32
  FetchTrades200Response,
33
33
  FetchTradesRequest,
34
+ GetExecutionPrice200Response,
35
+ GetExecutionPriceDetailed200Response,
36
+ GetExecutionPriceRequest,
34
37
  GetMarketsBySlugRequest,
35
38
  HealthCheck200Response,
36
39
  SearchEvents200Response,
@@ -72,6 +75,12 @@ import {
72
75
  FetchTrades200ResponseToJSON,
73
76
  FetchTradesRequestFromJSON,
74
77
  FetchTradesRequestToJSON,
78
+ GetExecutionPrice200ResponseFromJSON,
79
+ GetExecutionPrice200ResponseToJSON,
80
+ GetExecutionPriceDetailed200ResponseFromJSON,
81
+ GetExecutionPriceDetailed200ResponseToJSON,
82
+ GetExecutionPriceRequestFromJSON,
83
+ GetExecutionPriceRequestToJSON,
75
84
  GetMarketsBySlugRequestFromJSON,
76
85
  GetMarketsBySlugRequestToJSON,
77
86
  HealthCheck200ResponseFromJSON,
@@ -138,6 +147,16 @@ export interface FetchTradesOperationRequest {
138
147
  fetchTradesRequest?: FetchTradesRequest;
139
148
  }
140
149
 
150
+ export interface GetExecutionPriceOperationRequest {
151
+ exchange: GetExecutionPriceOperationExchangeEnum;
152
+ getExecutionPriceRequest?: GetExecutionPriceRequest;
153
+ }
154
+
155
+ export interface GetExecutionPriceDetailedRequest {
156
+ exchange: GetExecutionPriceDetailedExchangeEnum;
157
+ getExecutionPriceRequest?: GetExecutionPriceRequest;
158
+ }
159
+
141
160
  export interface GetMarketsBySlugOperationRequest {
142
161
  exchange: GetMarketsBySlugOperationExchangeEnum;
143
162
  getMarketsBySlugRequest?: GetMarketsBySlugRequest;
@@ -568,6 +587,86 @@ export class DefaultApi extends runtime.BaseAPI {
568
587
  return await response.value();
569
588
  }
570
589
 
590
+ /**
591
+ * Get Execution Price
592
+ */
593
+ async getExecutionPriceRaw(requestParameters: GetExecutionPriceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetExecutionPrice200Response>> {
594
+ if (requestParameters['exchange'] == null) {
595
+ throw new runtime.RequiredError(
596
+ 'exchange',
597
+ 'Required parameter "exchange" was null or undefined when calling getExecutionPrice().'
598
+ );
599
+ }
600
+
601
+ const queryParameters: any = {};
602
+
603
+ const headerParameters: runtime.HTTPHeaders = {};
604
+
605
+ headerParameters['Content-Type'] = 'application/json';
606
+
607
+
608
+ let urlPath = `/api/{exchange}/getExecutionPrice`;
609
+ urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
610
+
611
+ const response = await this.request({
612
+ path: urlPath,
613
+ method: 'POST',
614
+ headers: headerParameters,
615
+ query: queryParameters,
616
+ body: GetExecutionPriceRequestToJSON(requestParameters['getExecutionPriceRequest']),
617
+ }, initOverrides);
618
+
619
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetExecutionPrice200ResponseFromJSON(jsonValue));
620
+ }
621
+
622
+ /**
623
+ * Get Execution Price
624
+ */
625
+ async getExecutionPrice(requestParameters: GetExecutionPriceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetExecutionPrice200Response> {
626
+ const response = await this.getExecutionPriceRaw(requestParameters, initOverrides);
627
+ return await response.value();
628
+ }
629
+
630
+ /**
631
+ * Get Detailed Execution Price
632
+ */
633
+ async getExecutionPriceDetailedRaw(requestParameters: GetExecutionPriceDetailedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetExecutionPriceDetailed200Response>> {
634
+ if (requestParameters['exchange'] == null) {
635
+ throw new runtime.RequiredError(
636
+ 'exchange',
637
+ 'Required parameter "exchange" was null or undefined when calling getExecutionPriceDetailed().'
638
+ );
639
+ }
640
+
641
+ const queryParameters: any = {};
642
+
643
+ const headerParameters: runtime.HTTPHeaders = {};
644
+
645
+ headerParameters['Content-Type'] = 'application/json';
646
+
647
+
648
+ let urlPath = `/api/{exchange}/getExecutionPriceDetailed`;
649
+ urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
650
+
651
+ const response = await this.request({
652
+ path: urlPath,
653
+ method: 'POST',
654
+ headers: headerParameters,
655
+ query: queryParameters,
656
+ body: GetExecutionPriceRequestToJSON(requestParameters['getExecutionPriceRequest']),
657
+ }, initOverrides);
658
+
659
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetExecutionPriceDetailed200ResponseFromJSON(jsonValue));
660
+ }
661
+
662
+ /**
663
+ * Get Detailed Execution Price
664
+ */
665
+ async getExecutionPriceDetailed(requestParameters: GetExecutionPriceDetailedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetExecutionPriceDetailed200Response> {
666
+ const response = await this.getExecutionPriceDetailedRaw(requestParameters, initOverrides);
667
+ return await response.value();
668
+ }
669
+
571
670
  /**
572
671
  * Get Market by Slug
573
672
  */
@@ -887,6 +986,22 @@ export const FetchTradesOperationExchangeEnum = {
887
986
  Kalshi: 'kalshi'
888
987
  } as const;
889
988
  export type FetchTradesOperationExchangeEnum = typeof FetchTradesOperationExchangeEnum[keyof typeof FetchTradesOperationExchangeEnum];
989
+ /**
990
+ * @export
991
+ */
992
+ export const GetExecutionPriceOperationExchangeEnum = {
993
+ Polymarket: 'polymarket',
994
+ Kalshi: 'kalshi'
995
+ } as const;
996
+ export type GetExecutionPriceOperationExchangeEnum = typeof GetExecutionPriceOperationExchangeEnum[keyof typeof GetExecutionPriceOperationExchangeEnum];
997
+ /**
998
+ * @export
999
+ */
1000
+ export const GetExecutionPriceDetailedExchangeEnum = {
1001
+ Polymarket: 'polymarket',
1002
+ Kalshi: 'kalshi'
1003
+ } as const;
1004
+ export type GetExecutionPriceDetailedExchangeEnum = typeof GetExecutionPriceDetailedExchangeEnum[keyof typeof GetExecutionPriceDetailedExchangeEnum];
890
1005
  /**
891
1006
  * @export
892
1007
  */
@@ -0,0 +1,81 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
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
+ /**
17
+ *
18
+ * @export
19
+ * @interface ExecutionPriceResult
20
+ */
21
+ export interface ExecutionPriceResult {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ExecutionPriceResult
26
+ */
27
+ price?: number;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ExecutionPriceResult
32
+ */
33
+ filledAmount?: number;
34
+ /**
35
+ *
36
+ * @type {boolean}
37
+ * @memberof ExecutionPriceResult
38
+ */
39
+ fullyFilled?: boolean;
40
+ }
41
+
42
+ /**
43
+ * Check if a given object implements the ExecutionPriceResult interface.
44
+ */
45
+ export function instanceOfExecutionPriceResult(value: object): value is ExecutionPriceResult {
46
+ return true;
47
+ }
48
+
49
+ export function ExecutionPriceResultFromJSON(json: any): ExecutionPriceResult {
50
+ return ExecutionPriceResultFromJSONTyped(json, false);
51
+ }
52
+
53
+ export function ExecutionPriceResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExecutionPriceResult {
54
+ if (json == null) {
55
+ return json;
56
+ }
57
+ return {
58
+
59
+ 'price': json['price'] == null ? undefined : json['price'],
60
+ 'filledAmount': json['filledAmount'] == null ? undefined : json['filledAmount'],
61
+ 'fullyFilled': json['fullyFilled'] == null ? undefined : json['fullyFilled'],
62
+ };
63
+ }
64
+
65
+ export function ExecutionPriceResultToJSON(json: any): ExecutionPriceResult {
66
+ return ExecutionPriceResultToJSONTyped(json, false);
67
+ }
68
+
69
+ export function ExecutionPriceResultToJSONTyped(value?: ExecutionPriceResult | null, ignoreDiscriminator: boolean = false): any {
70
+ if (value == null) {
71
+ return value;
72
+ }
73
+
74
+ return {
75
+
76
+ 'price': value['price'],
77
+ 'filledAmount': value['filledAmount'],
78
+ 'fullyFilled': value['fullyFilled'],
79
+ };
80
+ }
81
+
@@ -0,0 +1,89 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
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 { ErrorDetail } from './ErrorDetail';
17
+ import {
18
+ ErrorDetailFromJSON,
19
+ ErrorDetailFromJSONTyped,
20
+ ErrorDetailToJSON,
21
+ ErrorDetailToJSONTyped,
22
+ } from './ErrorDetail';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface GetExecutionPrice200Response
28
+ */
29
+ export interface GetExecutionPrice200Response {
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof GetExecutionPrice200Response
34
+ */
35
+ success?: boolean;
36
+ /**
37
+ *
38
+ * @type {ErrorDetail}
39
+ * @memberof GetExecutionPrice200Response
40
+ */
41
+ error?: ErrorDetail;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof GetExecutionPrice200Response
46
+ */
47
+ data?: number;
48
+ }
49
+
50
+ /**
51
+ * Check if a given object implements the GetExecutionPrice200Response interface.
52
+ */
53
+ export function instanceOfGetExecutionPrice200Response(value: object): value is GetExecutionPrice200Response {
54
+ return true;
55
+ }
56
+
57
+ export function GetExecutionPrice200ResponseFromJSON(json: any): GetExecutionPrice200Response {
58
+ return GetExecutionPrice200ResponseFromJSONTyped(json, false);
59
+ }
60
+
61
+ export function GetExecutionPrice200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPrice200Response {
62
+ if (json == null) {
63
+ return json;
64
+ }
65
+ return {
66
+
67
+ 'success': json['success'] == null ? undefined : json['success'],
68
+ 'error': json['error'] == null ? undefined : ErrorDetailFromJSON(json['error']),
69
+ 'data': json['data'] == null ? undefined : json['data'],
70
+ };
71
+ }
72
+
73
+ export function GetExecutionPrice200ResponseToJSON(json: any): GetExecutionPrice200Response {
74
+ return GetExecutionPrice200ResponseToJSONTyped(json, false);
75
+ }
76
+
77
+ export function GetExecutionPrice200ResponseToJSONTyped(value?: GetExecutionPrice200Response | null, ignoreDiscriminator: boolean = false): any {
78
+ if (value == null) {
79
+ return value;
80
+ }
81
+
82
+ return {
83
+
84
+ 'success': value['success'],
85
+ 'error': ErrorDetailToJSON(value['error']),
86
+ 'data': value['data'],
87
+ };
88
+ }
89
+
@@ -0,0 +1,96 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
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 { ErrorDetail } from './ErrorDetail';
17
+ import {
18
+ ErrorDetailFromJSON,
19
+ ErrorDetailFromJSONTyped,
20
+ ErrorDetailToJSON,
21
+ ErrorDetailToJSONTyped,
22
+ } from './ErrorDetail';
23
+ import type { ExecutionPriceResult } from './ExecutionPriceResult';
24
+ import {
25
+ ExecutionPriceResultFromJSON,
26
+ ExecutionPriceResultFromJSONTyped,
27
+ ExecutionPriceResultToJSON,
28
+ ExecutionPriceResultToJSONTyped,
29
+ } from './ExecutionPriceResult';
30
+
31
+ /**
32
+ *
33
+ * @export
34
+ * @interface GetExecutionPriceDetailed200Response
35
+ */
36
+ export interface GetExecutionPriceDetailed200Response {
37
+ /**
38
+ *
39
+ * @type {boolean}
40
+ * @memberof GetExecutionPriceDetailed200Response
41
+ */
42
+ success?: boolean;
43
+ /**
44
+ *
45
+ * @type {ErrorDetail}
46
+ * @memberof GetExecutionPriceDetailed200Response
47
+ */
48
+ error?: ErrorDetail;
49
+ /**
50
+ *
51
+ * @type {ExecutionPriceResult}
52
+ * @memberof GetExecutionPriceDetailed200Response
53
+ */
54
+ data?: ExecutionPriceResult;
55
+ }
56
+
57
+ /**
58
+ * Check if a given object implements the GetExecutionPriceDetailed200Response interface.
59
+ */
60
+ export function instanceOfGetExecutionPriceDetailed200Response(value: object): value is GetExecutionPriceDetailed200Response {
61
+ return true;
62
+ }
63
+
64
+ export function GetExecutionPriceDetailed200ResponseFromJSON(json: any): GetExecutionPriceDetailed200Response {
65
+ return GetExecutionPriceDetailed200ResponseFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function GetExecutionPriceDetailed200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceDetailed200Response {
69
+ if (json == null) {
70
+ return json;
71
+ }
72
+ return {
73
+
74
+ 'success': json['success'] == null ? undefined : json['success'],
75
+ 'error': json['error'] == null ? undefined : ErrorDetailFromJSON(json['error']),
76
+ 'data': json['data'] == null ? undefined : ExecutionPriceResultFromJSON(json['data']),
77
+ };
78
+ }
79
+
80
+ export function GetExecutionPriceDetailed200ResponseToJSON(json: any): GetExecutionPriceDetailed200Response {
81
+ return GetExecutionPriceDetailed200ResponseToJSONTyped(json, false);
82
+ }
83
+
84
+ export function GetExecutionPriceDetailed200ResponseToJSONTyped(value?: GetExecutionPriceDetailed200Response | null, ignoreDiscriminator: boolean = false): any {
85
+ if (value == null) {
86
+ return value;
87
+ }
88
+
89
+ return {
90
+
91
+ 'success': value['success'],
92
+ 'error': ErrorDetailToJSON(value['error']),
93
+ 'data': ExecutionPriceResultToJSON(value['data']),
94
+ };
95
+ }
96
+
@@ -0,0 +1,89 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
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 { GetExecutionPriceRequestArgsInner } from './GetExecutionPriceRequestArgsInner';
17
+ import {
18
+ GetExecutionPriceRequestArgsInnerFromJSON,
19
+ GetExecutionPriceRequestArgsInnerFromJSONTyped,
20
+ GetExecutionPriceRequestArgsInnerToJSON,
21
+ GetExecutionPriceRequestArgsInnerToJSONTyped,
22
+ } from './GetExecutionPriceRequestArgsInner';
23
+ import type { ExchangeCredentials } from './ExchangeCredentials';
24
+ import {
25
+ ExchangeCredentialsFromJSON,
26
+ ExchangeCredentialsFromJSONTyped,
27
+ ExchangeCredentialsToJSON,
28
+ ExchangeCredentialsToJSONTyped,
29
+ } from './ExchangeCredentials';
30
+
31
+ /**
32
+ *
33
+ * @export
34
+ * @interface GetExecutionPriceRequest
35
+ */
36
+ export interface GetExecutionPriceRequest {
37
+ /**
38
+ * [orderBook, side, amount]
39
+ * @type {Array<GetExecutionPriceRequestArgsInner>}
40
+ * @memberof GetExecutionPriceRequest
41
+ */
42
+ args: Array<GetExecutionPriceRequestArgsInner>;
43
+ /**
44
+ *
45
+ * @type {ExchangeCredentials}
46
+ * @memberof GetExecutionPriceRequest
47
+ */
48
+ credentials?: ExchangeCredentials;
49
+ }
50
+
51
+ /**
52
+ * Check if a given object implements the GetExecutionPriceRequest interface.
53
+ */
54
+ export function instanceOfGetExecutionPriceRequest(value: object): value is GetExecutionPriceRequest {
55
+ if (!('args' in value) || value['args'] === undefined) return false;
56
+ return true;
57
+ }
58
+
59
+ export function GetExecutionPriceRequestFromJSON(json: any): GetExecutionPriceRequest {
60
+ return GetExecutionPriceRequestFromJSONTyped(json, false);
61
+ }
62
+
63
+ export function GetExecutionPriceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequest {
64
+ if (json == null) {
65
+ return json;
66
+ }
67
+ return {
68
+
69
+ 'args': ((json['args'] as Array<any>).map(GetExecutionPriceRequestArgsInnerFromJSON)),
70
+ 'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
71
+ };
72
+ }
73
+
74
+ export function GetExecutionPriceRequestToJSON(json: any): GetExecutionPriceRequest {
75
+ return GetExecutionPriceRequestToJSONTyped(json, false);
76
+ }
77
+
78
+ export function GetExecutionPriceRequestToJSONTyped(value?: GetExecutionPriceRequest | null, ignoreDiscriminator: boolean = false): any {
79
+ if (value == null) {
80
+ return value;
81
+ }
82
+
83
+ return {
84
+
85
+ 'args': ((value['args'] as Array<any>).map(GetExecutionPriceRequestArgsInnerToJSON)),
86
+ 'credentials': ExchangeCredentialsToJSON(value['credentials']),
87
+ };
88
+ }
89
+
@@ -0,0 +1,75 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
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 type { OrderBook } from './OrderBook';
16
+ import {
17
+ instanceOfOrderBook,
18
+ OrderBookFromJSON,
19
+ OrderBookFromJSONTyped,
20
+ OrderBookToJSON,
21
+ } from './OrderBook';
22
+
23
+ /**
24
+ * @type GetExecutionPriceRequestArgsInner
25
+ *
26
+ * @export
27
+ */
28
+ export type GetExecutionPriceRequestArgsInner = OrderBook | number | string;
29
+
30
+ export function GetExecutionPriceRequestArgsInnerFromJSON(json: any): GetExecutionPriceRequestArgsInner {
31
+ return GetExecutionPriceRequestArgsInnerFromJSONTyped(json, false);
32
+ }
33
+
34
+ export function GetExecutionPriceRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequestArgsInner {
35
+ if (json == null) {
36
+ return json;
37
+ }
38
+ if (typeof json !== 'object') {
39
+ return json;
40
+ }
41
+ if (instanceOfOrderBook(json)) {
42
+ return OrderBookFromJSONTyped(json, true);
43
+ }
44
+ if (typeof json === 'number') {
45
+ return json;
46
+ }
47
+ if (typeof json === 'string' && (json === 'buy' || json === 'sell')) {
48
+ return json;
49
+ }
50
+ return {} as any;
51
+ }
52
+
53
+ export function GetExecutionPriceRequestArgsInnerToJSON(json: any): any {
54
+ return GetExecutionPriceRequestArgsInnerToJSONTyped(json, false);
55
+ }
56
+
57
+ export function GetExecutionPriceRequestArgsInnerToJSONTyped(value?: GetExecutionPriceRequestArgsInner | null, ignoreDiscriminator: boolean = false): any {
58
+ if (value == null) {
59
+ return value;
60
+ }
61
+ if (typeof value !== 'object') {
62
+ return value;
63
+ }
64
+ if (instanceOfOrderBook(value)) {
65
+ return OrderBookToJSON(value as OrderBook);
66
+ }
67
+ if (typeof value === 'number') {
68
+ return value;
69
+ }
70
+ if (typeof value === 'string' && (value === 'buy' || value === 'sell')) {
71
+ return value;
72
+ }
73
+ return {};
74
+ }
75
+
@@ -10,6 +10,7 @@ export * from './CreateOrderRequest';
10
10
  export * from './ErrorDetail';
11
11
  export * from './ErrorResponse';
12
12
  export * from './ExchangeCredentials';
13
+ export * from './ExecutionPriceResult';
13
14
  export * from './FetchBalance200Response';
14
15
  export * from './FetchMarkets200Response';
15
16
  export * from './FetchMarketsRequest';
@@ -24,6 +25,10 @@ export * from './FetchPositions200Response';
24
25
  export * from './FetchPositionsRequest';
25
26
  export * from './FetchTrades200Response';
26
27
  export * from './FetchTradesRequest';
28
+ export * from './GetExecutionPrice200Response';
29
+ export * from './GetExecutionPriceDetailed200Response';
30
+ export * from './GetExecutionPriceRequest';
31
+ export * from './GetExecutionPriceRequestArgsInner';
27
32
  export * from './GetMarketsBySlugRequest';
28
33
  export * from './HealthCheck200Response';
29
34
  export * from './HistoryFilterParams';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "unified"
43
43
  ],
44
44
  "dependencies": {
45
- "pmxt-core": "1.3.4"
45
+ "pmxt-core": "1.4.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/jest": "^30.0.0",
package/pmxt/client.ts CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  CreateOrderParams,
37
37
  SearchIn,
38
38
  UnifiedEvent,
39
+ ExecutionPriceResult,
39
40
  } from "./models.js";
40
41
 
41
42
  import { ServerManager } from "./server-manager.js";
@@ -870,6 +871,67 @@ export abstract class Exchange {
870
871
  throw new Error(`Failed to fetch balance: ${error}`);
871
872
  }
872
873
  }
874
+
875
+ /**
876
+ * Calculate the average execution price for a given amount by walking the order book.
877
+ * Uses the sidecar server for calculation to ensure consistency.
878
+ *
879
+ * @param orderBook - The current order book
880
+ * @param side - 'buy' or 'sell'
881
+ * @param amount - The amount to execute
882
+ * @returns The volume-weighted average price, or 0 if insufficient liquidity
883
+ */
884
+ async getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number> {
885
+ const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
886
+ return result.fullyFilled ? result.price : 0;
887
+ }
888
+
889
+ /**
890
+ * Calculate detailed execution price information.
891
+ * Uses the sidecar server for calculation to ensure consistency.
892
+ *
893
+ * @param orderBook - The current order book
894
+ * @param side - 'buy' or 'sell'
895
+ * @param amount - The amount to execute
896
+ * @returns Detailed execution result
897
+ */
898
+ async getExecutionPriceDetailed(
899
+ orderBook: OrderBook,
900
+ side: 'buy' | 'sell',
901
+ amount: number
902
+ ): Promise<ExecutionPriceResult> {
903
+ await this.initPromise;
904
+ try {
905
+ const body: any = {
906
+ args: [orderBook, side, amount]
907
+ };
908
+ const credentials = this.getCredentials();
909
+ if (credentials) {
910
+ body.credentials = credentials;
911
+ }
912
+
913
+ const url = `${this.config.basePath}/api/${this.exchangeName}/getExecutionPriceDetailed`;
914
+
915
+ const response = await fetch(url, {
916
+ method: 'POST',
917
+ headers: {
918
+ 'Content-Type': 'application/json',
919
+ ...this.config.headers
920
+ },
921
+ body: JSON.stringify(body)
922
+ });
923
+
924
+ if (!response.ok) {
925
+ const error = await response.json().catch(() => ({}));
926
+ throw new Error(error.error?.message || response.statusText);
927
+ }
928
+
929
+ const json = await response.json();
930
+ return this.handleResponse(json);
931
+ } catch (error) {
932
+ throw new Error(`Failed to get execution price: ${error}`);
933
+ }
934
+ }
873
935
  }
874
936
 
875
937
  /**