pmxtjs 2.34.3 → 2.35.2
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 +35 -1
- package/dist/esm/generated/src/apis/DefaultApi.js +55 -1
- package/dist/esm/generated/src/models/FetchEventsPaginated200Response.d.ts +46 -0
- package/dist/esm/generated/src/models/FetchEventsPaginated200Response.js +47 -0
- package/dist/esm/generated/src/models/PaginatedEventsResult.d.ts +45 -0
- package/dist/esm/generated/src/models/PaginatedEventsResult.js +50 -0
- package/dist/esm/generated/src/models/index.d.ts +2 -0
- package/dist/esm/generated/src/models/index.js +2 -0
- package/dist/esm/pmxt/client.d.ts +2 -1
- package/dist/esm/pmxt/client.js +32 -0
- package/dist/esm/pmxt/models.d.ts +11 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +35 -1
- package/dist/generated/src/apis/DefaultApi.js +56 -2
- package/dist/generated/src/models/FetchEventsPaginated200Response.d.ts +46 -0
- package/dist/generated/src/models/FetchEventsPaginated200Response.js +54 -0
- package/dist/generated/src/models/PaginatedEventsResult.d.ts +45 -0
- package/dist/generated/src/models/PaginatedEventsResult.js +57 -0
- package/dist/generated/src/models/index.d.ts +2 -0
- package/dist/generated/src/models/index.js +2 -0
- package/dist/pmxt/client.d.ts +2 -1
- package/dist/pmxt/client.js +32 -0
- package/dist/pmxt/models.d.ts +11 -0
- package/generated/.openapi-generator/FILES +4 -0
- package/generated/docs/DefaultApi.md +77 -0
- package/generated/docs/FetchEventsPaginated200Response.md +38 -0
- package/generated/docs/PaginatedEventsResult.md +39 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +79 -0
- package/generated/src/models/FetchEventsPaginated200Response.ts +96 -0
- package/generated/src/models/PaginatedEventsResult.ts +91 -0
- package/generated/src/models/index.ts +2 -0
- package/package.json +2 -2
- package/pmxt/client.ts +31 -0
- package/pmxt/models.ts +14 -0
|
@@ -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, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.4.4
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.instanceOfFetchEventsPaginated200Response = instanceOfFetchEventsPaginated200Response;
|
|
17
|
+
exports.FetchEventsPaginated200ResponseFromJSON = FetchEventsPaginated200ResponseFromJSON;
|
|
18
|
+
exports.FetchEventsPaginated200ResponseFromJSONTyped = FetchEventsPaginated200ResponseFromJSONTyped;
|
|
19
|
+
exports.FetchEventsPaginated200ResponseToJSON = FetchEventsPaginated200ResponseToJSON;
|
|
20
|
+
exports.FetchEventsPaginated200ResponseToJSONTyped = FetchEventsPaginated200ResponseToJSONTyped;
|
|
21
|
+
const ErrorDetail_1 = require("./ErrorDetail");
|
|
22
|
+
const PaginatedEventsResult_1 = require("./PaginatedEventsResult");
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the FetchEventsPaginated200Response interface.
|
|
25
|
+
*/
|
|
26
|
+
function instanceOfFetchEventsPaginated200Response(value) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function FetchEventsPaginated200ResponseFromJSON(json) {
|
|
30
|
+
return FetchEventsPaginated200ResponseFromJSONTyped(json, false);
|
|
31
|
+
}
|
|
32
|
+
function FetchEventsPaginated200ResponseFromJSONTyped(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, PaginatedEventsResult_1.PaginatedEventsResultFromJSON)(json['data']),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function FetchEventsPaginated200ResponseToJSON(json) {
|
|
43
|
+
return FetchEventsPaginated200ResponseToJSONTyped(json, false);
|
|
44
|
+
}
|
|
45
|
+
function FetchEventsPaginated200ResponseToJSONTyped(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, PaginatedEventsResult_1.PaginatedEventsResultToJSON)(value['data']),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMXT Sidecar API
|
|
3
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.4.4
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { UnifiedEvent } from './UnifiedEvent';
|
|
13
|
+
/**
|
|
14
|
+
* Shape returned by fetchEventsPaginated
|
|
15
|
+
* @export
|
|
16
|
+
* @interface PaginatedEventsResult
|
|
17
|
+
*/
|
|
18
|
+
export interface PaginatedEventsResult {
|
|
19
|
+
/**
|
|
20
|
+
* The page of unified events
|
|
21
|
+
* @type {Array<UnifiedEvent>}
|
|
22
|
+
* @memberof PaginatedEventsResult
|
|
23
|
+
*/
|
|
24
|
+
data: Array<UnifiedEvent>;
|
|
25
|
+
/**
|
|
26
|
+
* Total number of events in the snapshot
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof PaginatedEventsResult
|
|
29
|
+
*/
|
|
30
|
+
total: number;
|
|
31
|
+
/**
|
|
32
|
+
* Cursor to pass to the next call, or undefined if this is the last page
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof PaginatedEventsResult
|
|
35
|
+
*/
|
|
36
|
+
nextCursor?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if a given object implements the PaginatedEventsResult interface.
|
|
40
|
+
*/
|
|
41
|
+
export declare function instanceOfPaginatedEventsResult(value: object): value is PaginatedEventsResult;
|
|
42
|
+
export declare function PaginatedEventsResultFromJSON(json: any): PaginatedEventsResult;
|
|
43
|
+
export declare function PaginatedEventsResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedEventsResult;
|
|
44
|
+
export declare function PaginatedEventsResultToJSON(json: any): PaginatedEventsResult;
|
|
45
|
+
export declare function PaginatedEventsResultToJSONTyped(value?: PaginatedEventsResult | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* PMXT Sidecar API
|
|
6
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.4.4
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.instanceOfPaginatedEventsResult = instanceOfPaginatedEventsResult;
|
|
17
|
+
exports.PaginatedEventsResultFromJSON = PaginatedEventsResultFromJSON;
|
|
18
|
+
exports.PaginatedEventsResultFromJSONTyped = PaginatedEventsResultFromJSONTyped;
|
|
19
|
+
exports.PaginatedEventsResultToJSON = PaginatedEventsResultToJSON;
|
|
20
|
+
exports.PaginatedEventsResultToJSONTyped = PaginatedEventsResultToJSONTyped;
|
|
21
|
+
const UnifiedEvent_1 = require("./UnifiedEvent");
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given object implements the PaginatedEventsResult interface.
|
|
24
|
+
*/
|
|
25
|
+
function instanceOfPaginatedEventsResult(value) {
|
|
26
|
+
if (!('data' in value) || value['data'] === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
if (!('total' in value) || value['total'] === undefined)
|
|
29
|
+
return false;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
function PaginatedEventsResultFromJSON(json) {
|
|
33
|
+
return PaginatedEventsResultFromJSONTyped(json, false);
|
|
34
|
+
}
|
|
35
|
+
function PaginatedEventsResultFromJSONTyped(json, ignoreDiscriminator) {
|
|
36
|
+
if (json == null) {
|
|
37
|
+
return json;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
'data': (json['data'].map(UnifiedEvent_1.UnifiedEventFromJSON)),
|
|
41
|
+
'total': json['total'],
|
|
42
|
+
'nextCursor': json['nextCursor'] == null ? undefined : json['nextCursor'],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function PaginatedEventsResultToJSON(json) {
|
|
46
|
+
return PaginatedEventsResultToJSONTyped(json, false);
|
|
47
|
+
}
|
|
48
|
+
function PaginatedEventsResultToJSONTyped(value, ignoreDiscriminator = false) {
|
|
49
|
+
if (value == null) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
'data': (value['data'].map(UnifiedEvent_1.UnifiedEventToJSON)),
|
|
54
|
+
'total': value['total'],
|
|
55
|
+
'nextCursor': value['nextCursor'],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -29,6 +29,7 @@ export * from './FetchEvent200Response';
|
|
|
29
29
|
export * from './FetchEventMatches200Response';
|
|
30
30
|
export * from './FetchEventMatchesParams';
|
|
31
31
|
export * from './FetchEvents200Response';
|
|
32
|
+
export * from './FetchEventsPaginated200Response';
|
|
32
33
|
export * from './FetchMarket200Response';
|
|
33
34
|
export * from './FetchMarketMatches200Response';
|
|
34
35
|
export * from './FetchMarketMatchesParams';
|
|
@@ -69,6 +70,7 @@ export * from './Order';
|
|
|
69
70
|
export * from './OrderBook';
|
|
70
71
|
export * from './OrderHistoryParams';
|
|
71
72
|
export * from './OrderLevel';
|
|
73
|
+
export * from './PaginatedEventsResult';
|
|
72
74
|
export * from './PaginatedMarketsResult';
|
|
73
75
|
export * from './Position';
|
|
74
76
|
export * from './PriceCandle';
|
|
@@ -47,6 +47,7 @@ __exportStar(require("./FetchEvent200Response"), exports);
|
|
|
47
47
|
__exportStar(require("./FetchEventMatches200Response"), exports);
|
|
48
48
|
__exportStar(require("./FetchEventMatchesParams"), exports);
|
|
49
49
|
__exportStar(require("./FetchEvents200Response"), exports);
|
|
50
|
+
__exportStar(require("./FetchEventsPaginated200Response"), exports);
|
|
50
51
|
__exportStar(require("./FetchMarket200Response"), exports);
|
|
51
52
|
__exportStar(require("./FetchMarketMatches200Response"), exports);
|
|
52
53
|
__exportStar(require("./FetchMarketMatchesParams"), exports);
|
|
@@ -87,6 +88,7 @@ __exportStar(require("./Order"), exports);
|
|
|
87
88
|
__exportStar(require("./OrderBook"), exports);
|
|
88
89
|
__exportStar(require("./OrderHistoryParams"), exports);
|
|
89
90
|
__exportStar(require("./OrderLevel"), exports);
|
|
91
|
+
__exportStar(require("./PaginatedEventsResult"), exports);
|
|
90
92
|
__exportStar(require("./PaginatedMarketsResult"), exports);
|
|
91
93
|
__exportStar(require("./Position"), exports);
|
|
92
94
|
__exportStar(require("./PriceCandle"), 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 { Configuration, DefaultApi, ExchangeCredentials } from "../generated/src/index.js";
|
|
8
|
-
import { Balance, BuiltOrder, CreateOrderParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, Order, OrderBook, PaginatedMarketsResult, Position, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UserTrade } from "./models.js";
|
|
8
|
+
import { Balance, BuiltOrder, CreateOrderParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, Order, OrderBook, PaginatedMarketsResult, PaginatedEventsResult, Position, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UserTrade } from "./models.js";
|
|
9
9
|
import { ServerManager } from "./server-manager.js";
|
|
10
10
|
/**
|
|
11
11
|
* Base exchange client options.
|
|
@@ -136,6 +136,7 @@ export declare abstract class Exchange {
|
|
|
136
136
|
fetchMarkets(params?: any): Promise<UnifiedMarket[]>;
|
|
137
137
|
fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
|
|
138
138
|
fetchEvents(params?: any): Promise<UnifiedEvent[]>;
|
|
139
|
+
fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult>;
|
|
139
140
|
fetchMarket(params?: any): Promise<UnifiedMarket>;
|
|
140
141
|
fetchEvent(params?: any): Promise<UnifiedEvent>;
|
|
141
142
|
fetchOrderBook(id: string): Promise<OrderBook>;
|
package/dist/pmxt/client.js
CHANGED
|
@@ -614,6 +614,38 @@ class Exchange {
|
|
|
614
614
|
throw new errors_js_1.PmxtError(`Failed to fetchEvents: ${error}`);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
+
async fetchEventsPaginated(params) {
|
|
618
|
+
await this.initPromise;
|
|
619
|
+
try {
|
|
620
|
+
const args = [];
|
|
621
|
+
if (params !== undefined)
|
|
622
|
+
args.push(params);
|
|
623
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
|
|
624
|
+
method: 'POST',
|
|
625
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
626
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
627
|
+
});
|
|
628
|
+
if (!response.ok) {
|
|
629
|
+
const body = await response.json().catch(() => ({}));
|
|
630
|
+
if (body.error && typeof body.error === "object") {
|
|
631
|
+
throw (0, errors_js_1.fromServerError)(body.error);
|
|
632
|
+
}
|
|
633
|
+
throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
|
|
634
|
+
}
|
|
635
|
+
const json = await response.json();
|
|
636
|
+
const data = this.handleResponse(json);
|
|
637
|
+
return {
|
|
638
|
+
data: (data.data || []).map(convertEvent),
|
|
639
|
+
total: data.total,
|
|
640
|
+
nextCursor: data.nextCursor,
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
if (error instanceof errors_js_1.PmxtError)
|
|
645
|
+
throw error;
|
|
646
|
+
throw new errors_js_1.PmxtError(`Failed to fetchEventsPaginated: ${error}`);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
617
649
|
async fetchMarket(params) {
|
|
618
650
|
await this.initPromise;
|
|
619
651
|
try {
|
package/dist/pmxt/models.d.ts
CHANGED
|
@@ -155,6 +155,17 @@ export interface PaginatedMarketsResult {
|
|
|
155
155
|
/** Cursor for the next page (pass to fetchMarketsPaginated) */
|
|
156
156
|
nextCursor?: string;
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Result of a paginated event fetch.
|
|
160
|
+
*/
|
|
161
|
+
export interface PaginatedEventsResult {
|
|
162
|
+
/** The events for this page */
|
|
163
|
+
data: UnifiedEvent[];
|
|
164
|
+
/** Total number of events (if available) */
|
|
165
|
+
total?: number;
|
|
166
|
+
/** Cursor for the next page (pass to fetchEventsPaginated) */
|
|
167
|
+
nextCursor?: string;
|
|
168
|
+
}
|
|
158
169
|
/**
|
|
159
170
|
* A historical trade.
|
|
160
171
|
*/
|
|
@@ -34,6 +34,7 @@ docs/FetchEvent200Response.md
|
|
|
34
34
|
docs/FetchEventMatches200Response.md
|
|
35
35
|
docs/FetchEventMatchesParams.md
|
|
36
36
|
docs/FetchEvents200Response.md
|
|
37
|
+
docs/FetchEventsPaginated200Response.md
|
|
37
38
|
docs/FetchMarket200Response.md
|
|
38
39
|
docs/FetchMarketMatches200Response.md
|
|
39
40
|
docs/FetchMarketMatchesParams.md
|
|
@@ -74,6 +75,7 @@ docs/Order.md
|
|
|
74
75
|
docs/OrderBook.md
|
|
75
76
|
docs/OrderHistoryParams.md
|
|
76
77
|
docs/OrderLevel.md
|
|
78
|
+
docs/PaginatedEventsResult.md
|
|
77
79
|
docs/PaginatedMarketsResult.md
|
|
78
80
|
docs/Position.md
|
|
79
81
|
docs/PriceCandle.md
|
|
@@ -127,6 +129,7 @@ src/models/FetchEvent200Response.ts
|
|
|
127
129
|
src/models/FetchEventMatches200Response.ts
|
|
128
130
|
src/models/FetchEventMatchesParams.ts
|
|
129
131
|
src/models/FetchEvents200Response.ts
|
|
132
|
+
src/models/FetchEventsPaginated200Response.ts
|
|
130
133
|
src/models/FetchMarket200Response.ts
|
|
131
134
|
src/models/FetchMarketMatches200Response.ts
|
|
132
135
|
src/models/FetchMarketMatchesParams.ts
|
|
@@ -167,6 +170,7 @@ src/models/Order.ts
|
|
|
167
170
|
src/models/OrderBook.ts
|
|
168
171
|
src/models/OrderHistoryParams.ts
|
|
169
172
|
src/models/OrderLevel.ts
|
|
173
|
+
src/models/PaginatedEventsResult.ts
|
|
170
174
|
src/models/PaginatedMarketsResult.ts
|
|
171
175
|
src/models/Position.ts
|
|
172
176
|
src/models/PriceCandle.ts
|
|
@@ -16,6 +16,7 @@ All URIs are relative to *http://localhost:3847*
|
|
|
16
16
|
| [**fetchEvent**](DefaultApi.md#fetchevent) | **GET** /api/{exchange}/fetchEvent | Fetch Event |
|
|
17
17
|
| [**fetchEventMatches**](DefaultApi.md#fetcheventmatches) | **GET** /api/{exchange}/fetchEventMatches | Find Similar Events |
|
|
18
18
|
| [**fetchEvents**](DefaultApi.md#fetchevents) | **GET** /api/{exchange}/fetchEvents | Fetch Events |
|
|
19
|
+
| [**fetchEventsPaginated**](DefaultApi.md#fetcheventspaginated) | **GET** /api/{exchange}/fetchEventsPaginated | Fetch Events Paginated |
|
|
19
20
|
| [**fetchHedges**](DefaultApi.md#fetchhedges) | **GET** /api/{exchange}/fetchHedges | Find Hedging Opportunities |
|
|
20
21
|
| [**fetchMarket**](DefaultApi.md#fetchmarket) | **GET** /api/{exchange}/fetchMarket | Fetch Market |
|
|
21
22
|
| [**fetchMarketMatches**](DefaultApi.md#fetchmarketmatches) | **GET** /api/{exchange}/fetchMarketMatches | Find Similar Markets |
|
|
@@ -991,6 +992,82 @@ No authorization required
|
|
|
991
992
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
992
993
|
|
|
993
994
|
|
|
995
|
+
## fetchEventsPaginated
|
|
996
|
+
|
|
997
|
+
> FetchEventsPaginated200Response fetchEventsPaginated(exchange, limit, cursor, filter)
|
|
998
|
+
|
|
999
|
+
Fetch Events Paginated
|
|
1000
|
+
|
|
1001
|
+
Paginated variant of {@link fetchEvents}. On the first call (no `cursor`), all events are fetched from the exchange and cached in an in-memory snapshot. A cursor is returned along with the first page. Subsequent calls with that cursor serve additional pages directly from the cached snapshot -- no additional API calls are made. The snapshot is invalidated after `snapshotTTL` ms (configured via `ExchangeOptions` in the constructor). A request using a cursor from an expired snapshot throws `\'Cursor has expired\'`.
|
|
1002
|
+
|
|
1003
|
+
### Example
|
|
1004
|
+
|
|
1005
|
+
```ts
|
|
1006
|
+
import {
|
|
1007
|
+
Configuration,
|
|
1008
|
+
DefaultApi,
|
|
1009
|
+
} from 'pmxtjs';
|
|
1010
|
+
import type { FetchEventsPaginatedRequest } from 'pmxtjs';
|
|
1011
|
+
|
|
1012
|
+
async function example() {
|
|
1013
|
+
console.log("🚀 Testing pmxtjs SDK...");
|
|
1014
|
+
const api = new DefaultApi();
|
|
1015
|
+
|
|
1016
|
+
const body = {
|
|
1017
|
+
// 'polymarket' | 'kalshi' | 'kalshi-demo' | 'limitless' | 'probable' | 'baozi' | 'myriad' | 'opinion' | 'metaculus' | 'smarkets' | 'polymarket_us' | 'router' | The prediction market exchange to target.
|
|
1018
|
+
exchange: exchange_example,
|
|
1019
|
+
// number (optional)
|
|
1020
|
+
limit: 8.14,
|
|
1021
|
+
// string (optional)
|
|
1022
|
+
cursor: cursor_example,
|
|
1023
|
+
// EventFilterCriteria (optional)
|
|
1024
|
+
filter: ...,
|
|
1025
|
+
} satisfies FetchEventsPaginatedRequest;
|
|
1026
|
+
|
|
1027
|
+
try {
|
|
1028
|
+
const data = await api.fetchEventsPaginated(body);
|
|
1029
|
+
console.log(data);
|
|
1030
|
+
} catch (error) {
|
|
1031
|
+
console.error(error);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// Run the test
|
|
1036
|
+
example().catch(console.error);
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### Parameters
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
| Name | Type | Description | Notes |
|
|
1043
|
+
|------------- | ------------- | ------------- | -------------|
|
|
1044
|
+
| **exchange** | `polymarket`, `kalshi`, `kalshi-demo`, `limitless`, `probable`, `baozi`, `myriad`, `opinion`, `metaculus`, `smarkets`, `polymarket_us`, `router` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us, router] |
|
|
1045
|
+
| **limit** | `number` | | [Optional] [Defaults to `undefined`] |
|
|
1046
|
+
| **cursor** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
1047
|
+
| **filter** | [](.md) | | [Optional] [Defaults to `undefined`] |
|
|
1048
|
+
|
|
1049
|
+
### Return type
|
|
1050
|
+
|
|
1051
|
+
[**FetchEventsPaginated200Response**](FetchEventsPaginated200Response.md)
|
|
1052
|
+
|
|
1053
|
+
### Authorization
|
|
1054
|
+
|
|
1055
|
+
No authorization required
|
|
1056
|
+
|
|
1057
|
+
### HTTP request headers
|
|
1058
|
+
|
|
1059
|
+
- **Content-Type**: Not defined
|
|
1060
|
+
- **Accept**: `application/json`
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
### HTTP response details
|
|
1064
|
+
| Status code | Description | Response headers |
|
|
1065
|
+
|-------------|-------------|------------------|
|
|
1066
|
+
| **200** | Fetch Events Paginated response | - |
|
|
1067
|
+
|
|
1068
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
1069
|
+
|
|
1070
|
+
|
|
994
1071
|
## fetchHedges
|
|
995
1072
|
|
|
996
1073
|
> CompareMarketPrices200Response fetchHedges(exchange, market, marketId, slug, url, relation, minConfidence, limit, includePrices)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# FetchEventsPaginated200Response
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`success` | boolean
|
|
10
|
+
`error` | [ErrorDetail](ErrorDetail.md)
|
|
11
|
+
`data` | [PaginatedEventsResult](PaginatedEventsResult.md)
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { FetchEventsPaginated200Response } 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 FetchEventsPaginated200Response
|
|
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 FetchEventsPaginated200Response
|
|
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,39 @@
|
|
|
1
|
+
|
|
2
|
+
# PaginatedEventsResult
|
|
3
|
+
|
|
4
|
+
Shape returned by fetchEventsPaginated
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`data` | [Array<UnifiedEvent>](UnifiedEvent.md)
|
|
11
|
+
`total` | number
|
|
12
|
+
`nextCursor` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { PaginatedEventsResult } from 'pmxtjs'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"data": null,
|
|
22
|
+
"total": null,
|
|
23
|
+
"nextCursor": null,
|
|
24
|
+
} satisfies PaginatedEventsResult
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as PaginatedEventsResult
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
package/generated/package.json
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
FetchEvent200Response,
|
|
31
31
|
FetchEventMatches200Response,
|
|
32
32
|
FetchEvents200Response,
|
|
33
|
+
FetchEventsPaginated200Response,
|
|
33
34
|
FetchMarket200Response,
|
|
34
35
|
FetchMarketMatches200Response,
|
|
35
36
|
FetchMarkets200Response,
|
|
@@ -91,6 +92,8 @@ import {
|
|
|
91
92
|
FetchEventMatches200ResponseToJSON,
|
|
92
93
|
FetchEvents200ResponseFromJSON,
|
|
93
94
|
FetchEvents200ResponseToJSON,
|
|
95
|
+
FetchEventsPaginated200ResponseFromJSON,
|
|
96
|
+
FetchEventsPaginated200ResponseToJSON,
|
|
94
97
|
FetchMarket200ResponseFromJSON,
|
|
95
98
|
FetchMarket200ResponseToJSON,
|
|
96
99
|
FetchMarketMatches200ResponseFromJSON,
|
|
@@ -248,6 +251,13 @@ export interface FetchEventsRequest {
|
|
|
248
251
|
tags?: Array<string>;
|
|
249
252
|
}
|
|
250
253
|
|
|
254
|
+
export interface FetchEventsPaginatedRequest {
|
|
255
|
+
exchange: FetchEventsPaginatedExchangeEnum;
|
|
256
|
+
limit?: number;
|
|
257
|
+
cursor?: string;
|
|
258
|
+
filter?: EventFilterCriteria;
|
|
259
|
+
}
|
|
260
|
+
|
|
251
261
|
export interface FetchHedgesRequest {
|
|
252
262
|
exchange: FetchHedgesExchangeEnum;
|
|
253
263
|
market?: UnifiedMarket;
|
|
@@ -1085,6 +1095,57 @@ export class DefaultApi extends runtime.BaseAPI {
|
|
|
1085
1095
|
return await response.value();
|
|
1086
1096
|
}
|
|
1087
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* Paginated variant of {@link fetchEvents}. On the first call (no `cursor`), all events are fetched from the exchange and cached in an in-memory snapshot. A cursor is returned along with the first page. Subsequent calls with that cursor serve additional pages directly from the cached snapshot -- no additional API calls are made. The snapshot is invalidated after `snapshotTTL` ms (configured via `ExchangeOptions` in the constructor). A request using a cursor from an expired snapshot throws `\'Cursor has expired\'`.
|
|
1100
|
+
* Fetch Events Paginated
|
|
1101
|
+
*/
|
|
1102
|
+
async fetchEventsPaginatedRaw(requestParameters: FetchEventsPaginatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FetchEventsPaginated200Response>> {
|
|
1103
|
+
if (requestParameters['exchange'] == null) {
|
|
1104
|
+
throw new runtime.RequiredError(
|
|
1105
|
+
'exchange',
|
|
1106
|
+
'Required parameter "exchange" was null or undefined when calling fetchEventsPaginated().'
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
const queryParameters: any = {};
|
|
1111
|
+
|
|
1112
|
+
if (requestParameters['limit'] != null) {
|
|
1113
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
if (requestParameters['cursor'] != null) {
|
|
1117
|
+
queryParameters['cursor'] = requestParameters['cursor'];
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
if (requestParameters['filter'] != null) {
|
|
1121
|
+
queryParameters['filter'] = requestParameters['filter'];
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
let urlPath = `/api/{exchange}/fetchEventsPaginated`;
|
|
1128
|
+
urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
|
|
1129
|
+
|
|
1130
|
+
const response = await this.request({
|
|
1131
|
+
path: urlPath,
|
|
1132
|
+
method: 'GET',
|
|
1133
|
+
headers: headerParameters,
|
|
1134
|
+
query: queryParameters,
|
|
1135
|
+
}, initOverrides);
|
|
1136
|
+
|
|
1137
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => FetchEventsPaginated200ResponseFromJSON(jsonValue));
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Paginated variant of {@link fetchEvents}. On the first call (no `cursor`), all events are fetched from the exchange and cached in an in-memory snapshot. A cursor is returned along with the first page. Subsequent calls with that cursor serve additional pages directly from the cached snapshot -- no additional API calls are made. The snapshot is invalidated after `snapshotTTL` ms (configured via `ExchangeOptions` in the constructor). A request using a cursor from an expired snapshot throws `\'Cursor has expired\'`.
|
|
1142
|
+
* Fetch Events Paginated
|
|
1143
|
+
*/
|
|
1144
|
+
async fetchEventsPaginated(requestParameters: FetchEventsPaginatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FetchEventsPaginated200Response> {
|
|
1145
|
+
const response = await this.fetchEventsPaginatedRaw(requestParameters, initOverrides);
|
|
1146
|
+
return await response.value();
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1088
1149
|
/**
|
|
1089
1150
|
* Find hedging opportunities across venues. Discovers subset/superset market relationships where one market\'s outcome implies another, enabling cross-venue hedging strategies with live prices.
|
|
1090
1151
|
* Find Hedging Opportunities
|
|
@@ -2685,6 +2746,24 @@ export const FetchEventsSearchInEnum = {
|
|
|
2685
2746
|
Both: 'both'
|
|
2686
2747
|
} as const;
|
|
2687
2748
|
export type FetchEventsSearchInEnum = typeof FetchEventsSearchInEnum[keyof typeof FetchEventsSearchInEnum];
|
|
2749
|
+
/**
|
|
2750
|
+
* @export
|
|
2751
|
+
*/
|
|
2752
|
+
export const FetchEventsPaginatedExchangeEnum = {
|
|
2753
|
+
Polymarket: 'polymarket',
|
|
2754
|
+
Kalshi: 'kalshi',
|
|
2755
|
+
KalshiDemo: 'kalshi-demo',
|
|
2756
|
+
Limitless: 'limitless',
|
|
2757
|
+
Probable: 'probable',
|
|
2758
|
+
Baozi: 'baozi',
|
|
2759
|
+
Myriad: 'myriad',
|
|
2760
|
+
Opinion: 'opinion',
|
|
2761
|
+
Metaculus: 'metaculus',
|
|
2762
|
+
Smarkets: 'smarkets',
|
|
2763
|
+
PolymarketUs: 'polymarket_us',
|
|
2764
|
+
Router: 'router'
|
|
2765
|
+
} as const;
|
|
2766
|
+
export type FetchEventsPaginatedExchangeEnum = typeof FetchEventsPaginatedExchangeEnum[keyof typeof FetchEventsPaginatedExchangeEnum];
|
|
2688
2767
|
/**
|
|
2689
2768
|
* @export
|
|
2690
2769
|
*/
|