pmxtjs 2.47.0 → 2.48.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 +38 -1
- package/dist/esm/generated/src/apis/DefaultApi.js +56 -1
- package/dist/esm/generated/src/models/EventFetchParams.d.ts +6 -0
- package/dist/esm/generated/src/models/EventFetchParams.js +2 -0
- package/dist/esm/generated/src/models/FetchSeries200Response.d.ts +46 -0
- package/dist/esm/generated/src/models/FetchSeries200Response.js +47 -0
- package/dist/esm/generated/src/models/UnifiedSeries.d.ts +95 -0
- package/dist/esm/generated/src/models/UnifiedSeries.js +66 -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/index.d.ts +1 -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 +47 -0
- package/dist/generated/src/apis/DefaultApi.d.ts +38 -1
- package/dist/generated/src/apis/DefaultApi.js +56 -1
- package/dist/generated/src/models/EventFetchParams.d.ts +6 -0
- package/dist/generated/src/models/EventFetchParams.js +2 -0
- package/dist/generated/src/models/FetchSeries200Response.d.ts +46 -0
- package/dist/generated/src/models/FetchSeries200Response.js +54 -0
- package/dist/generated/src/models/UnifiedSeries.d.ts +95 -0
- package/dist/generated/src/models/UnifiedSeries.js +73 -0
- package/dist/generated/src/models/index.d.ts +2 -0
- package/dist/generated/src/models/index.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/pmxt/client.d.ts +2 -1
- package/dist/pmxt/client.js +32 -0
- package/dist/pmxt/models.d.ts +47 -0
- package/generated/.openapi-generator/FILES +4 -0
- package/generated/docs/DefaultApi.md +76 -2
- package/generated/docs/EventFetchParams.md +2 -0
- package/generated/docs/FetchSeries200Response.md +38 -0
- package/generated/docs/UnifiedSeries.md +55 -0
- package/generated/package.json +1 -1
- package/generated/src/apis/DefaultApi.ts +78 -0
- package/generated/src/models/EventFetchParams.ts +8 -0
- package/generated/src/models/FetchSeries200Response.ts +96 -0
- package/generated/src/models/UnifiedSeries.ts +155 -0
- package/generated/src/models/index.ts +2 -0
- package/index.ts +1 -0
- package/package.json +2 -2
- package/pmxt/client.ts +32 -0
- package/pmxt/models.ts +59 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PMXT Sidecar API
|
|
5
|
+
* A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.4.4
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { UnifiedEvent } from './UnifiedEvent';
|
|
17
|
+
import {
|
|
18
|
+
UnifiedEventFromJSON,
|
|
19
|
+
UnifiedEventFromJSONTyped,
|
|
20
|
+
UnifiedEventToJSON,
|
|
21
|
+
UnifiedEventToJSONTyped,
|
|
22
|
+
} from './UnifiedEvent';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A recurring grouping of events on a venue — the fourth tier above Event -> Market -> Outcome. Examples: Kalshi `KXATPMATCH` (every ATP tennis match), Polymarket `wta` (every WTA match), Opinion's daily `collection`. Series only exists where the venue exposes a recurring-event concept; venues without one return an empty array from `fetchSeries`.
|
|
26
|
+
* @export
|
|
27
|
+
* @interface UnifiedSeries
|
|
28
|
+
*/
|
|
29
|
+
export interface UnifiedSeries {
|
|
30
|
+
/**
|
|
31
|
+
* Stable venue-native series identifier (e.g. "KXATPMATCH" on Kalshi, "atp" on Polymarket Gamma, numeric Gamma id).
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof UnifiedSeries
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Venue-native ticker, when distinct from `id`.
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof UnifiedSeries
|
|
40
|
+
*/
|
|
41
|
+
ticker?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Venue-native slug.
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof UnifiedSeries
|
|
46
|
+
*/
|
|
47
|
+
slug?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Human-readable series title (e.g. "ATP Match Winner", "WTA").
|
|
50
|
+
* @type {string}
|
|
51
|
+
* @memberof UnifiedSeries
|
|
52
|
+
*/
|
|
53
|
+
title: string;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @memberof UnifiedSeries
|
|
58
|
+
*/
|
|
59
|
+
description?: string | null;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof UnifiedSeries
|
|
64
|
+
*/
|
|
65
|
+
recurrence?: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Child events. Populated when fetched by id; the list form usually omits this to keep payloads small.
|
|
68
|
+
* @type {Array<UnifiedEvent>}
|
|
69
|
+
* @memberof UnifiedSeries
|
|
70
|
+
*/
|
|
71
|
+
events?: Array<UnifiedEvent>;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @type {string}
|
|
75
|
+
* @memberof UnifiedSeries
|
|
76
|
+
*/
|
|
77
|
+
url?: string | null;
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @type {string}
|
|
81
|
+
* @memberof UnifiedSeries
|
|
82
|
+
*/
|
|
83
|
+
image?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* The exchange this series originates from. Populated by the Router.
|
|
86
|
+
* @type {string}
|
|
87
|
+
* @memberof UnifiedSeries
|
|
88
|
+
*/
|
|
89
|
+
sourceExchange?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Raw venue-specific fields not promoted to first-class columns.
|
|
92
|
+
* @type {{ [key: string]: any; }}
|
|
93
|
+
* @memberof UnifiedSeries
|
|
94
|
+
*/
|
|
95
|
+
sourceMetadata?: { [key: string]: any; };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Check if a given object implements the UnifiedSeries interface.
|
|
100
|
+
*/
|
|
101
|
+
export function instanceOfUnifiedSeries(value: object): value is UnifiedSeries {
|
|
102
|
+
if (!('id' in value) || value['id'] === undefined) return false;
|
|
103
|
+
if (!('title' in value) || value['title'] === undefined) return false;
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function UnifiedSeriesFromJSON(json: any): UnifiedSeries {
|
|
108
|
+
return UnifiedSeriesFromJSONTyped(json, false);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function UnifiedSeriesFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnifiedSeries {
|
|
112
|
+
if (json == null) {
|
|
113
|
+
return json;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
|
|
117
|
+
'id': json['id'],
|
|
118
|
+
'ticker': json['ticker'] == null ? undefined : json['ticker'],
|
|
119
|
+
'slug': json['slug'] == null ? undefined : json['slug'],
|
|
120
|
+
'title': json['title'],
|
|
121
|
+
'description': json['description'] == null ? undefined : json['description'],
|
|
122
|
+
'recurrence': json['recurrence'] == null ? undefined : json['recurrence'],
|
|
123
|
+
'events': json['events'] == null ? undefined : ((json['events'] as Array<any>).map(UnifiedEventFromJSON)),
|
|
124
|
+
'url': json['url'] == null ? undefined : json['url'],
|
|
125
|
+
'image': json['image'] == null ? undefined : json['image'],
|
|
126
|
+
'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
|
|
127
|
+
'sourceMetadata': json['sourceMetadata'] == null ? undefined : json['sourceMetadata'],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function UnifiedSeriesToJSON(json: any): UnifiedSeries {
|
|
132
|
+
return UnifiedSeriesToJSONTyped(json, false);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function UnifiedSeriesToJSONTyped(value?: UnifiedSeries | null, ignoreDiscriminator: boolean = false): any {
|
|
136
|
+
if (value == null) {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
|
|
142
|
+
'id': value['id'],
|
|
143
|
+
'ticker': value['ticker'],
|
|
144
|
+
'slug': value['slug'],
|
|
145
|
+
'title': value['title'],
|
|
146
|
+
'description': value['description'],
|
|
147
|
+
'recurrence': value['recurrence'],
|
|
148
|
+
'events': value['events'] == null ? undefined : ((value['events'] as Array<any>).map(UnifiedEventToJSON)),
|
|
149
|
+
'url': value['url'],
|
|
150
|
+
'image': value['image'],
|
|
151
|
+
'sourceExchange': value['sourceExchange'],
|
|
152
|
+
'sourceMetadata': value['sourceMetadata'],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
@@ -60,6 +60,7 @@ export * from './FetchOrderBookParams';
|
|
|
60
60
|
export * from './FetchOrderBooks200Response';
|
|
61
61
|
export * from './FetchOrderBooksRequest';
|
|
62
62
|
export * from './FetchPositions200Response';
|
|
63
|
+
export * from './FetchSeries200Response';
|
|
63
64
|
export * from './FetchTrades200Response';
|
|
64
65
|
export * from './FilterEventsRequest';
|
|
65
66
|
export * from './FilterEventsRequestArgsInner';
|
|
@@ -101,4 +102,5 @@ export * from './Trade';
|
|
|
101
102
|
export * from './TradesParams';
|
|
102
103
|
export * from './UnifiedEvent';
|
|
103
104
|
export * from './UnifiedMarket';
|
|
105
|
+
export * from './UnifiedSeries';
|
|
104
106
|
export * from './UserTrade';
|
package/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { Router } from "./pmxt/router.js";
|
|
|
30
30
|
export { ServerManager } from "./pmxt/server-manager.js";
|
|
31
31
|
export { HOSTED_URL, LOCAL_URL, ENV, resolvePmxtBaseUrl } from "./pmxt/constants.js";
|
|
32
32
|
export { MarketList } from "./pmxt/models.js";
|
|
33
|
+
export type { UnifiedSeries } from "./pmxt/models.js";
|
|
33
34
|
export type * from "./pmxt/models.js";
|
|
34
35
|
export * from "./pmxt/errors.js";
|
|
35
36
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.1",
|
|
4
4
|
"description": "Unified prediction market data API - The ccxt for prediction markets",
|
|
5
5
|
"author": "PMXT Contributors",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unified"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pmxt-core": "2.
|
|
46
|
+
"pmxt-core": "2.48.1",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -36,12 +36,14 @@ import {
|
|
|
36
36
|
PaginatedMarketsResult,
|
|
37
37
|
PaginatedEventsResult,
|
|
38
38
|
Position,
|
|
39
|
+
SeriesFetchParams,
|
|
39
40
|
PriceCandle,
|
|
40
41
|
SubscribedAddressSnapshot,
|
|
41
42
|
SubscriptionOption,
|
|
42
43
|
Trade,
|
|
43
44
|
UnifiedEvent,
|
|
44
45
|
UnifiedMarket,
|
|
46
|
+
UnifiedSeries,
|
|
45
47
|
UserTrade,
|
|
46
48
|
FirehoseEvent,
|
|
47
49
|
} from "./models.js";
|
|
@@ -172,6 +174,10 @@ function convertEvent(raw: any): UnifiedEvent {
|
|
|
172
174
|
return { ...raw, markets };
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
function convertSeries(raw: any): UnifiedSeries {
|
|
178
|
+
const events = Array.isArray(raw.events) ? raw.events.map(convertEvent) : undefined;
|
|
179
|
+
return { ...raw, ...(events !== undefined ? { events } : {}) };
|
|
180
|
+
}
|
|
175
181
|
|
|
176
182
|
function convertSubscriptionSnapshot(raw: any): SubscribedAddressSnapshot {
|
|
177
183
|
return {
|
|
@@ -863,6 +869,32 @@ export abstract class Exchange {
|
|
|
863
869
|
}
|
|
864
870
|
}
|
|
865
871
|
|
|
872
|
+
async fetchSeries(params?: SeriesFetchParams): Promise<UnifiedSeries[]> {
|
|
873
|
+
await this.initPromise;
|
|
874
|
+
try {
|
|
875
|
+
const args: any[] = [];
|
|
876
|
+
if (params !== undefined) args.push(params);
|
|
877
|
+
const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchSeries`, {
|
|
878
|
+
method: 'POST',
|
|
879
|
+
headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
|
|
880
|
+
body: JSON.stringify({ args, credentials: this.getCredentials() }),
|
|
881
|
+
});
|
|
882
|
+
if (!response.ok) {
|
|
883
|
+
const body = await response.json().catch(() => ({}));
|
|
884
|
+
if (body.error && typeof body.error === "object") {
|
|
885
|
+
throw fromServerError(body.error);
|
|
886
|
+
}
|
|
887
|
+
throw new PmxtError(body.error?.message || response.statusText);
|
|
888
|
+
}
|
|
889
|
+
const json = await response.json();
|
|
890
|
+
const data = this.handleResponse(json);
|
|
891
|
+
return data.map(convertSeries);
|
|
892
|
+
} catch (error) {
|
|
893
|
+
if (error instanceof PmxtError) throw error;
|
|
894
|
+
throw new PmxtError(`Failed to fetchSeries: ${error}`);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
866
898
|
async fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket> {
|
|
867
899
|
await this.initPromise;
|
|
868
900
|
try {
|
package/pmxt/models.ts
CHANGED
|
@@ -505,6 +505,25 @@ export interface CreateOrderParams {
|
|
|
505
505
|
/** Alias matching the core MarketFetchParams name. */
|
|
506
506
|
export type MarketFetchParams = MarketFilterParams;
|
|
507
507
|
|
|
508
|
+
/**
|
|
509
|
+
* Parameters for fetching series.
|
|
510
|
+
* Venues without a recurring-event concept return an empty array regardless of the filters.
|
|
511
|
+
*/
|
|
512
|
+
export interface SeriesFetchParams {
|
|
513
|
+
/** Direct lookup by venue-native series id (e.g. "KXATPMATCH" on Kalshi, "atp" on Polymarket Gamma). When set, the result includes events where the venue supports it. */
|
|
514
|
+
id?: string;
|
|
515
|
+
/** Lookup by series slug (e.g. "wta", "nfl"). */
|
|
516
|
+
slug?: string;
|
|
517
|
+
/** Keyword search across series title / description. */
|
|
518
|
+
query?: string;
|
|
519
|
+
/** Filter by recurrence cadence ('daily', 'weekly', 'annual', ...). */
|
|
520
|
+
recurrence?: string;
|
|
521
|
+
/** Maximum number of results to return. */
|
|
522
|
+
limit?: number;
|
|
523
|
+
/** Pagination offset. */
|
|
524
|
+
offset?: number;
|
|
525
|
+
}
|
|
526
|
+
|
|
508
527
|
/**
|
|
509
528
|
* Parameters for fetching OHLCV candle data.
|
|
510
529
|
*/
|
|
@@ -660,6 +679,46 @@ export class MarketList extends Array<UnifiedMarket> {
|
|
|
660
679
|
}
|
|
661
680
|
}
|
|
662
681
|
|
|
682
|
+
/**
|
|
683
|
+
* A recurring grouping of events on a venue — the tier above Event.
|
|
684
|
+
* Examples: Kalshi "KXATPMATCH" (every ATP match), Polymarket "wta" (every WTA match).
|
|
685
|
+
* Venues without a recurring-event concept return an empty array from fetchSeries.
|
|
686
|
+
*/
|
|
687
|
+
export interface UnifiedSeries {
|
|
688
|
+
/** Stable venue-native series identifier. */
|
|
689
|
+
id: string;
|
|
690
|
+
|
|
691
|
+
/** Venue-native ticker, when distinct from id. */
|
|
692
|
+
ticker?: string;
|
|
693
|
+
|
|
694
|
+
/** Venue-native slug. */
|
|
695
|
+
slug?: string;
|
|
696
|
+
|
|
697
|
+
/** Human-readable series title. */
|
|
698
|
+
title: string;
|
|
699
|
+
|
|
700
|
+
/** Long-form series description. */
|
|
701
|
+
description?: string | null;
|
|
702
|
+
|
|
703
|
+
/** Recurrence cadence the venue reports ('daily', 'weekly', 'annual', ...). */
|
|
704
|
+
recurrence?: string | null;
|
|
705
|
+
|
|
706
|
+
/** Child events. Populated when fetched by id; the list form usually omits this. */
|
|
707
|
+
events?: UnifiedEvent[];
|
|
708
|
+
|
|
709
|
+
/** Canonical venue URL for the series. */
|
|
710
|
+
url?: string | null;
|
|
711
|
+
|
|
712
|
+
/** Venue-hosted image. */
|
|
713
|
+
image?: string | null;
|
|
714
|
+
|
|
715
|
+
/** The exchange this series originates from. Populated by the Router. */
|
|
716
|
+
sourceExchange?: string;
|
|
717
|
+
|
|
718
|
+
/** Raw venue-specific fields not promoted to first-class columns. */
|
|
719
|
+
sourceMetadata?: Record<string, unknown>;
|
|
720
|
+
}
|
|
721
|
+
|
|
663
722
|
/**
|
|
664
723
|
* A grouped collection of related markets (e.g., "Who will be Fed Chair?" contains multiple candidate markets)
|
|
665
724
|
*/
|