pmxtjs 1.3.4 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/generated/src/apis/DefaultApi.d.ts +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 +21 -1
- package/dist/esm/pmxt/client.js +52 -0
- package/dist/esm/pmxt/models.d.ts +11 -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 +21 -1
- package/dist/pmxt/client.js +52 -0
- package/dist/pmxt/models.d.ts +11 -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 +62 -0
- package/pmxt/models.ts +14 -0
|
@@ -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
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* OpenAPI client, matching the Python API exactly.
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultApi, Configuration, ExchangeCredentials } from "../generated/src/index.js";
|
|
8
|
-
import { UnifiedMarket, PriceCandle, OrderBook, Trade, Order, Position, Balance, MarketFilterParams, HistoryFilterParams, CreateOrderParams, UnifiedEvent } from "./models.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.
|
|
@@ -234,6 +234,26 @@ export declare abstract class Exchange {
|
|
|
234
234
|
* @returns List of balances (by currency)
|
|
235
235
|
*/
|
|
236
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>;
|
|
237
257
|
}
|
|
238
258
|
/**
|
|
239
259
|
* Polymarket exchange client.
|
package/dist/pmxt/client.js
CHANGED
|
@@ -735,6 +735,58 @@ class Exchange {
|
|
|
735
735
|
throw new Error(`Failed to fetch balance: ${error}`);
|
|
736
736
|
}
|
|
737
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
|
+
}
|
|
738
790
|
}
|
|
739
791
|
exports.Exchange = Exchange;
|
|
740
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
|
*/
|
|
@@ -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
|
|
@@ -14,6 +14,8 @@ All URIs are relative to *http://localhost:3847*
|
|
|
14
14
|
| [**fetchOrderBook**](DefaultApi.md#fetchorderbookoperation) | **POST** /api/{exchange}/fetchOrderBook | Fetch Order Book |
|
|
15
15
|
| [**fetchPositions**](DefaultApi.md#fetchpositionsoperation) | **POST** /api/{exchange}/fetchPositions | Fetch Positions |
|
|
16
16
|
| [**fetchTrades**](DefaultApi.md#fetchtradesoperation) | **POST** /api/{exchange}/fetchTrades | Fetch Trades |
|
|
17
|
+
| [**getExecutionPrice**](DefaultApi.md#getexecutionpriceoperation) | **POST** /api/{exchange}/getExecutionPrice | Get Execution Price |
|
|
18
|
+
| [**getExecutionPriceDetailed**](DefaultApi.md#getexecutionpricedetailed) | **POST** /api/{exchange}/getExecutionPriceDetailed | Get Detailed Execution Price |
|
|
17
19
|
| [**getMarketsBySlug**](DefaultApi.md#getmarketsbyslugoperation) | **POST** /api/{exchange}/getMarketsBySlug | Get Market by Slug |
|
|
18
20
|
| [**healthCheck**](DefaultApi.md#healthcheck) | **GET** /health | Server Health Check |
|
|
19
21
|
| [**searchEvents**](DefaultApi.md#searcheventsoperation) | **POST** /api/{exchange}/searchEvents | Search Events |
|
|
@@ -703,6 +705,142 @@ No authorization required
|
|
|
703
705
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
704
706
|
|
|
705
707
|
|
|
708
|
+
## getExecutionPrice
|
|
709
|
+
|
|
710
|
+
> GetExecutionPrice200Response getExecutionPrice(exchange, getExecutionPriceRequest)
|
|
711
|
+
|
|
712
|
+
Get Execution Price
|
|
713
|
+
|
|
714
|
+
### Example
|
|
715
|
+
|
|
716
|
+
```ts
|
|
717
|
+
import {
|
|
718
|
+
Configuration,
|
|
719
|
+
DefaultApi,
|
|
720
|
+
} from 'pmxtjs';
|
|
721
|
+
import type { GetExecutionPriceOperationRequest } from 'pmxtjs';
|
|
722
|
+
|
|
723
|
+
async function example() {
|
|
724
|
+
console.log("🚀 Testing pmxtjs SDK...");
|
|
725
|
+
const api = new DefaultApi();
|
|
726
|
+
|
|
727
|
+
const body = {
|
|
728
|
+
// 'polymarket' | 'kalshi' | The prediction market exchange to target.
|
|
729
|
+
exchange: exchange_example,
|
|
730
|
+
// GetExecutionPriceRequest (optional)
|
|
731
|
+
getExecutionPriceRequest: ...,
|
|
732
|
+
} satisfies GetExecutionPriceOperationRequest;
|
|
733
|
+
|
|
734
|
+
try {
|
|
735
|
+
const data = await api.getExecutionPrice(body);
|
|
736
|
+
console.log(data);
|
|
737
|
+
} catch (error) {
|
|
738
|
+
console.error(error);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// Run the test
|
|
743
|
+
example().catch(console.error);
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Parameters
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
| Name | Type | Description | Notes |
|
|
750
|
+
|------------- | ------------- | ------------- | -------------|
|
|
751
|
+
| **exchange** | `polymarket`, `kalshi` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi] |
|
|
752
|
+
| **getExecutionPriceRequest** | [GetExecutionPriceRequest](GetExecutionPriceRequest.md) | | [Optional] |
|
|
753
|
+
|
|
754
|
+
### Return type
|
|
755
|
+
|
|
756
|
+
[**GetExecutionPrice200Response**](GetExecutionPrice200Response.md)
|
|
757
|
+
|
|
758
|
+
### Authorization
|
|
759
|
+
|
|
760
|
+
No authorization required
|
|
761
|
+
|
|
762
|
+
### HTTP request headers
|
|
763
|
+
|
|
764
|
+
- **Content-Type**: `application/json`
|
|
765
|
+
- **Accept**: `application/json`
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
### HTTP response details
|
|
769
|
+
| Status code | Description | Response headers |
|
|
770
|
+
|-------------|-------------|------------------|
|
|
771
|
+
| **200** | Average execution price | - |
|
|
772
|
+
|
|
773
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
## getExecutionPriceDetailed
|
|
777
|
+
|
|
778
|
+
> GetExecutionPriceDetailed200Response getExecutionPriceDetailed(exchange, getExecutionPriceRequest)
|
|
779
|
+
|
|
780
|
+
Get Detailed Execution Price
|
|
781
|
+
|
|
782
|
+
### Example
|
|
783
|
+
|
|
784
|
+
```ts
|
|
785
|
+
import {
|
|
786
|
+
Configuration,
|
|
787
|
+
DefaultApi,
|
|
788
|
+
} from 'pmxtjs';
|
|
789
|
+
import type { GetExecutionPriceDetailedRequest } from 'pmxtjs';
|
|
790
|
+
|
|
791
|
+
async function example() {
|
|
792
|
+
console.log("🚀 Testing pmxtjs SDK...");
|
|
793
|
+
const api = new DefaultApi();
|
|
794
|
+
|
|
795
|
+
const body = {
|
|
796
|
+
// 'polymarket' | 'kalshi' | The prediction market exchange to target.
|
|
797
|
+
exchange: exchange_example,
|
|
798
|
+
// GetExecutionPriceRequest (optional)
|
|
799
|
+
getExecutionPriceRequest: ...,
|
|
800
|
+
} satisfies GetExecutionPriceDetailedRequest;
|
|
801
|
+
|
|
802
|
+
try {
|
|
803
|
+
const data = await api.getExecutionPriceDetailed(body);
|
|
804
|
+
console.log(data);
|
|
805
|
+
} catch (error) {
|
|
806
|
+
console.error(error);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Run the test
|
|
811
|
+
example().catch(console.error);
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
### Parameters
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
| Name | Type | Description | Notes |
|
|
818
|
+
|------------- | ------------- | ------------- | -------------|
|
|
819
|
+
| **exchange** | `polymarket`, `kalshi` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi] |
|
|
820
|
+
| **getExecutionPriceRequest** | [GetExecutionPriceRequest](GetExecutionPriceRequest.md) | | [Optional] |
|
|
821
|
+
|
|
822
|
+
### Return type
|
|
823
|
+
|
|
824
|
+
[**GetExecutionPriceDetailed200Response**](GetExecutionPriceDetailed200Response.md)
|
|
825
|
+
|
|
826
|
+
### Authorization
|
|
827
|
+
|
|
828
|
+
No authorization required
|
|
829
|
+
|
|
830
|
+
### HTTP request headers
|
|
831
|
+
|
|
832
|
+
- **Content-Type**: `application/json`
|
|
833
|
+
- **Accept**: `application/json`
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
### HTTP response details
|
|
837
|
+
| Status code | Description | Response headers |
|
|
838
|
+
|-------------|-------------|------------------|
|
|
839
|
+
| **200** | Detailed execution result | - |
|
|
840
|
+
|
|
841
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
842
|
+
|
|
843
|
+
|
|
706
844
|
## getMarketsBySlug
|
|
707
845
|
|
|
708
846
|
> FetchMarkets200Response getMarketsBySlug(exchange, getMarketsBySlugRequest)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# ExecutionPriceResult
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`price` | number
|
|
10
|
+
`filledAmount` | number
|
|
11
|
+
`fullyFilled` | boolean
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { ExecutionPriceResult } from 'pmxtjs'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"price": null,
|
|
21
|
+
"filledAmount": null,
|
|
22
|
+
"fullyFilled": null,
|
|
23
|
+
} satisfies ExecutionPriceResult
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as ExecutionPriceResult
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# GetExecutionPrice200Response
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`success` | boolean
|
|
10
|
+
`error` | [ErrorDetail](ErrorDetail.md)
|
|
11
|
+
`data` | number
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { GetExecutionPrice200Response } from 'pmxtjs'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"success": true,
|
|
21
|
+
"error": null,
|
|
22
|
+
"data": null,
|
|
23
|
+
} satisfies GetExecutionPrice200Response
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as GetExecutionPrice200Response
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# GetExecutionPriceDetailed200Response
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`success` | boolean
|
|
10
|
+
`error` | [ErrorDetail](ErrorDetail.md)
|
|
11
|
+
`data` | [ExecutionPriceResult](ExecutionPriceResult.md)
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { GetExecutionPriceDetailed200Response } from 'pmxtjs'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"success": true,
|
|
21
|
+
"error": null,
|
|
22
|
+
"data": null,
|
|
23
|
+
} satisfies GetExecutionPriceDetailed200Response
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as GetExecutionPriceDetailed200Response
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# GetExecutionPriceRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`args` | [Array<GetExecutionPriceRequestArgsInner>](GetExecutionPriceRequestArgsInner.md)
|
|
10
|
+
`credentials` | [ExchangeCredentials](ExchangeCredentials.md)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { GetExecutionPriceRequest } from 'pmxtjs'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"args": null,
|
|
20
|
+
"credentials": null,
|
|
21
|
+
} satisfies GetExecutionPriceRequest
|
|
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 GetExecutionPriceRequest
|
|
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
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# GetExecutionPriceRequestArgsInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`bids` | [Array<OrderLevel>](OrderLevel.md)
|
|
10
|
+
`asks` | [Array<OrderLevel>](OrderLevel.md)
|
|
11
|
+
`timestamp` | number
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { GetExecutionPriceRequestArgsInner } from 'pmxtjs'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"bids": null,
|
|
21
|
+
"asks": null,
|
|
22
|
+
"timestamp": null,
|
|
23
|
+
} satisfies GetExecutionPriceRequestArgsInner
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as GetExecutionPriceRequestArgsInner
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|