pmxt-core 2.19.6 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseExchange.d.ts +69 -30
- package/dist/BaseExchange.js +124 -82
- package/dist/exchanges/baozi/index.d.ts +2 -0
- package/dist/exchanges/baozi/index.js +2 -0
- package/dist/exchanges/baozi/price.d.ts +3 -0
- package/dist/exchanges/baozi/price.js +16 -0
- package/dist/exchanges/baozi/price.test.d.ts +1 -0
- package/dist/exchanges/baozi/price.test.js +33 -0
- package/dist/exchanges/baozi/utils.js +5 -9
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/kalshi/fetchOHLCV.js +5 -4
- package/dist/exchanges/kalshi/fetchOrderBook.js +21 -21
- package/dist/exchanges/kalshi/fetchTrades.js +2 -1
- package/dist/exchanges/kalshi/index.d.ts +3 -1
- package/dist/exchanges/kalshi/index.js +19 -16
- package/dist/exchanges/kalshi/price.d.ts +3 -0
- package/dist/exchanges/kalshi/price.js +14 -0
- package/dist/exchanges/kalshi/price.test.d.ts +1 -0
- package/dist/exchanges/kalshi/price.test.js +24 -0
- package/dist/exchanges/kalshi/utils.js +5 -4
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/index.d.ts +58 -19
- package/dist/exchanges/limitless/index.js +169 -101
- package/dist/exchanges/limitless/websocket.d.ts +10 -3
- package/dist/exchanges/limitless/websocket.js +71 -52
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/myriad/index.d.ts +3 -1
- package/dist/exchanges/myriad/index.js +7 -4
- package/dist/exchanges/myriad/price.d.ts +1 -0
- package/dist/exchanges/myriad/price.js +7 -0
- package/dist/exchanges/myriad/price.test.d.ts +1 -0
- package/dist/exchanges/myriad/price.test.js +17 -0
- package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
- package/dist/exchanges/polymarket/api-clob.js +1 -1
- package/dist/exchanges/polymarket/api-data.d.ts +1 -1
- package/dist/exchanges/polymarket/api-data.js +1 -1
- package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
- package/dist/exchanges/polymarket/api-gamma.js +1 -1
- package/dist/exchanges/polymarket/index.d.ts +28 -15
- package/dist/exchanges/polymarket/index.js +217 -137
- package/dist/exchanges/polymarket/websocket.d.ts +11 -4
- package/dist/exchanges/polymarket/websocket.js +58 -36
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/index.d.ts +2 -0
- package/dist/exchanges/probable/index.js +2 -0
- package/dist/subscriber/base.d.ts +82 -0
- package/dist/subscriber/base.js +2 -0
- package/dist/subscriber/external/goldsky.d.ts +96 -0
- package/dist/subscriber/external/goldsky.js +412 -0
- package/dist/subscriber/watcher.d.ts +85 -0
- package/dist/subscriber/watcher.js +178 -0
- package/dist/types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -20,6 +20,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
20
20
|
const bs58_1 = __importDefault(require("bs58"));
|
|
21
21
|
const crypto_1 = require("crypto");
|
|
22
22
|
const market_utils_1 = require("../../utils/market-utils");
|
|
23
|
+
const price_1 = require("./price");
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
24
25
|
// Constants
|
|
25
26
|
// ---------------------------------------------------------------------------
|
|
@@ -304,13 +305,13 @@ function mapBooleanToUnified(market, pubkey) {
|
|
|
304
305
|
outcomeId: `${pubkey}-YES`,
|
|
305
306
|
marketId: pubkey,
|
|
306
307
|
label: 'Yes',
|
|
307
|
-
price: yesPrice,
|
|
308
|
+
price: (0, price_1.clampBaoziPrice)(yesPrice),
|
|
308
309
|
},
|
|
309
310
|
{
|
|
310
311
|
outcomeId: `${pubkey}-NO`,
|
|
311
312
|
marketId: pubkey,
|
|
312
313
|
label: 'No',
|
|
313
|
-
price: noPrice,
|
|
314
|
+
price: (0, price_1.clampBaoziPrice)(noPrice),
|
|
314
315
|
},
|
|
315
316
|
];
|
|
316
317
|
const um = {
|
|
@@ -343,16 +344,11 @@ function mapRaceToUnified(market, pubkey) {
|
|
|
343
344
|
outcomeId: `${pubkey}-${i}`,
|
|
344
345
|
marketId: pubkey,
|
|
345
346
|
label: market.outcomeLabels[i] || `Outcome ${i + 1}`,
|
|
346
|
-
price:
|
|
347
|
+
price: (0, price_1.clampBaoziPrice)(price),
|
|
347
348
|
});
|
|
348
349
|
}
|
|
349
350
|
// Normalize prices to sum to 1
|
|
350
|
-
|
|
351
|
-
if (priceSum > 0) {
|
|
352
|
-
for (const o of outcomes) {
|
|
353
|
-
o.price = o.price / priceSum;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
351
|
+
(0, price_1.normalizeBaoziOutcomes)(outcomes);
|
|
356
352
|
const um = {
|
|
357
353
|
marketId: pubkey,
|
|
358
354
|
title: market.question,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
|
|
3
|
-
* Generated at: 2026-03-
|
|
3
|
+
* Generated at: 2026-03-14T16:22:11.385Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const kalshiApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.kalshiApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
|
|
6
|
-
* Generated at: 2026-03-
|
|
6
|
+
* Generated at: 2026-03-14T16:22:11.385Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -4,6 +4,7 @@ exports.fetchOHLCV = fetchOHLCV;
|
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
const validation_1 = require("../../utils/validation");
|
|
6
6
|
const errors_1 = require("./errors");
|
|
7
|
+
const price_1 = require("./price");
|
|
7
8
|
async function fetchOHLCV(id, params, callApi) {
|
|
8
9
|
(0, validation_1.validateIdFormat)(id, "OHLCV");
|
|
9
10
|
// Validate resolution is provided
|
|
@@ -78,10 +79,10 @@ async function fetchOHLCV(id, params, callApi) {
|
|
|
78
79
|
};
|
|
79
80
|
return {
|
|
80
81
|
timestamp: c.end_period_ts * 1000,
|
|
81
|
-
open: getVal("open")
|
|
82
|
-
high: getVal("high")
|
|
83
|
-
low: getVal("low")
|
|
84
|
-
close: getVal("close")
|
|
82
|
+
open: (0, price_1.fromKalshiCents)(getVal("open")),
|
|
83
|
+
high: (0, price_1.fromKalshiCents)(getVal("high")),
|
|
84
|
+
low: (0, price_1.fromKalshiCents)(getVal("low")),
|
|
85
|
+
close: (0, price_1.fromKalshiCents)(getVal("close")),
|
|
85
86
|
volume: c.volume || 0,
|
|
86
87
|
};
|
|
87
88
|
});
|
|
@@ -16,37 +16,37 @@ async function fetchOrderBook(baseUrl, id) {
|
|
|
16
16
|
const ticker = id.replace(/-NO$/, "");
|
|
17
17
|
const url = (0, config_1.getMarketsUrl)(baseUrl, ticker, ["orderbook"]);
|
|
18
18
|
const response = await axios_1.default.get(url);
|
|
19
|
-
const data = response.data.
|
|
20
|
-
// Structure: {
|
|
21
|
-
//
|
|
22
|
-
// -
|
|
23
|
-
// -
|
|
19
|
+
const data = response.data.orderbook_fp;
|
|
20
|
+
// Structure: { yes_dollars: [["price", "qty"], ...], no_dollars: [["price", "qty"], ...] }
|
|
21
|
+
// Prices are dollar strings (e.g. "0.15"), quantities are fixed-point strings (e.g. "100.00")
|
|
22
|
+
// - yes_dollars: bids for buying YES at price X
|
|
23
|
+
// - no_dollars: bids for buying NO at price X
|
|
24
24
|
let bids;
|
|
25
25
|
let asks;
|
|
26
26
|
if (isNoOutcome) {
|
|
27
27
|
// NO outcome order book:
|
|
28
|
-
// - Bids: people buying NO (use data.
|
|
29
|
-
// - Asks: people selling NO = people buying YES (invert data.
|
|
30
|
-
bids = (data.
|
|
31
|
-
price: level[0]
|
|
32
|
-
size: level[1],
|
|
28
|
+
// - Bids: people buying NO (use data.no_dollars directly)
|
|
29
|
+
// - Asks: people selling NO = people buying YES (invert data.yes_dollars)
|
|
30
|
+
bids = (data.no_dollars || []).map((level) => ({
|
|
31
|
+
price: parseFloat(level[0]),
|
|
32
|
+
size: parseFloat(level[1]),
|
|
33
33
|
}));
|
|
34
|
-
asks = (data.
|
|
35
|
-
price: 1 - level[0] /
|
|
36
|
-
size: level[1],
|
|
34
|
+
asks = (data.yes_dollars || []).map((level) => ({
|
|
35
|
+
price: Math.round((1 - parseFloat(level[0])) * 10000) / 10000,
|
|
36
|
+
size: parseFloat(level[1]),
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
// YES outcome order book:
|
|
41
|
-
// - Bids: people buying YES (use data.
|
|
42
|
-
// - Asks: people selling YES = people buying NO (invert data.
|
|
43
|
-
bids = (data.
|
|
44
|
-
price: level[0]
|
|
45
|
-
size: level[1],
|
|
41
|
+
// - Bids: people buying YES (use data.yes_dollars directly)
|
|
42
|
+
// - Asks: people selling YES = people buying NO (invert data.no_dollars)
|
|
43
|
+
bids = (data.yes_dollars || []).map((level) => ({
|
|
44
|
+
price: parseFloat(level[0]),
|
|
45
|
+
size: parseFloat(level[1]),
|
|
46
46
|
}));
|
|
47
|
-
asks = (data.
|
|
48
|
-
price: 1 - level[0] /
|
|
49
|
-
size: level[1],
|
|
47
|
+
asks = (data.no_dollars || []).map((level) => ({
|
|
48
|
+
price: Math.round((1 - parseFloat(level[0])) * 10000) / 10000,
|
|
49
|
+
size: parseFloat(level[1]),
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
52
|
// Sort bids desc, asks asc
|
|
@@ -7,6 +7,7 @@ exports.fetchTrades = fetchTrades;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const errors_1 = require("./errors");
|
|
9
9
|
const config_1 = require("./config");
|
|
10
|
+
const price_1 = require("./price");
|
|
10
11
|
async function fetchTrades(baseUrl, id, params) {
|
|
11
12
|
try {
|
|
12
13
|
const ticker = id.replace(/-NO$/, "");
|
|
@@ -21,7 +22,7 @@ async function fetchTrades(baseUrl, id, params) {
|
|
|
21
22
|
return trades.map((t) => ({
|
|
22
23
|
id: t.trade_id,
|
|
23
24
|
timestamp: new Date(t.created_time).getTime(),
|
|
24
|
-
price: t.yes_price
|
|
25
|
+
price: (0, price_1.fromKalshiCents)(t.yes_price),
|
|
25
26
|
amount: t.count,
|
|
26
27
|
side: t.taker_side === "yes" ? "buy" : "sell",
|
|
27
28
|
}));
|
|
@@ -23,6 +23,8 @@ export declare class KalshiExchange extends PredictionMarketExchange {
|
|
|
23
23
|
fetchOpenOrders: true;
|
|
24
24
|
fetchPositions: true;
|
|
25
25
|
fetchBalance: true;
|
|
26
|
+
watchAddress: false;
|
|
27
|
+
unwatchAddress: false;
|
|
26
28
|
watchOrderBook: true;
|
|
27
29
|
watchTrades: true;
|
|
28
30
|
fetchMyTrades: true;
|
|
@@ -59,6 +61,6 @@ export declare class KalshiExchange extends PredictionMarketExchange {
|
|
|
59
61
|
private mapKalshiOrderStatus;
|
|
60
62
|
private ws?;
|
|
61
63
|
watchOrderBook(id: string, limit?: number): Promise<OrderBook>;
|
|
62
|
-
watchTrades(id: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
64
|
+
watchTrades(id: string, address?: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
63
65
|
close(): Promise<void>;
|
|
64
66
|
}
|
|
@@ -13,6 +13,7 @@ const errors_2 = require("../../errors");
|
|
|
13
13
|
const openapi_1 = require("../../utils/openapi");
|
|
14
14
|
const api_1 = require("./api");
|
|
15
15
|
const config_1 = require("./config");
|
|
16
|
+
const price_1 = require("./price");
|
|
16
17
|
class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
17
18
|
has = {
|
|
18
19
|
fetchMarkets: true,
|
|
@@ -26,6 +27,8 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
26
27
|
fetchOpenOrders: true,
|
|
27
28
|
fetchPositions: true,
|
|
28
29
|
fetchBalance: true,
|
|
30
|
+
watchAddress: false,
|
|
31
|
+
unwatchAddress: false,
|
|
29
32
|
watchOrderBook: true,
|
|
30
33
|
watchTrades: true,
|
|
31
34
|
fetchMyTrades: true,
|
|
@@ -104,27 +107,27 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
104
107
|
const isNoOutcome = id.endsWith("-NO");
|
|
105
108
|
const ticker = id.replace(/-NO$/, "");
|
|
106
109
|
const data = (await this.callApi("GetMarketOrderbook", { ticker }))
|
|
107
|
-
.
|
|
110
|
+
.orderbook_fp;
|
|
108
111
|
let bids;
|
|
109
112
|
let asks;
|
|
110
113
|
if (isNoOutcome) {
|
|
111
|
-
bids = (data.
|
|
112
|
-
price: level[0]
|
|
113
|
-
size: level[1],
|
|
114
|
+
bids = (data.no_dollars || []).map((level) => ({
|
|
115
|
+
price: parseFloat(level[0]),
|
|
116
|
+
size: parseFloat(level[1]),
|
|
114
117
|
}));
|
|
115
|
-
asks = (data.
|
|
116
|
-
price: 1 - level[0] /
|
|
117
|
-
size: level[1],
|
|
118
|
+
asks = (data.yes_dollars || []).map((level) => ({
|
|
119
|
+
price: Math.round((1 - parseFloat(level[0])) * 10000) / 10000,
|
|
120
|
+
size: parseFloat(level[1]),
|
|
118
121
|
}));
|
|
119
122
|
}
|
|
120
123
|
else {
|
|
121
|
-
bids = (data.
|
|
122
|
-
price: level[0]
|
|
123
|
-
size: level[1],
|
|
124
|
+
bids = (data.yes_dollars || []).map((level) => ({
|
|
125
|
+
price: parseFloat(level[0]),
|
|
126
|
+
size: parseFloat(level[1]),
|
|
124
127
|
}));
|
|
125
|
-
asks = (data.
|
|
126
|
-
price: 1 - level[0] /
|
|
127
|
-
size: level[1],
|
|
128
|
+
asks = (data.no_dollars || []).map((level) => ({
|
|
129
|
+
price: Math.round((1 - parseFloat(level[0])) * 10000) / 10000,
|
|
130
|
+
size: parseFloat(level[1]),
|
|
128
131
|
}));
|
|
129
132
|
}
|
|
130
133
|
bids.sort((a, b) => b.price - a.price);
|
|
@@ -145,7 +148,7 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
145
148
|
return trades.map((t) => ({
|
|
146
149
|
id: t.trade_id,
|
|
147
150
|
timestamp: new Date(t.created_time).getTime(),
|
|
148
|
-
price: t.yes_price
|
|
151
|
+
price: (0, price_1.fromKalshiCents)(t.yes_price),
|
|
149
152
|
amount: t.count,
|
|
150
153
|
side: t.taker_side === "yes" ? "buy" : "sell",
|
|
151
154
|
}));
|
|
@@ -248,7 +251,7 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
248
251
|
return (data.fills || []).map((f) => ({
|
|
249
252
|
id: f.fill_id,
|
|
250
253
|
timestamp: new Date(f.created_time).getTime(),
|
|
251
|
-
price: f.yes_price
|
|
254
|
+
price: (0, price_1.fromKalshiCents)(f.yes_price),
|
|
252
255
|
amount: f.count,
|
|
253
256
|
side: f.side === "yes" ? "buy" : "sell",
|
|
254
257
|
orderId: f.order_id,
|
|
@@ -363,7 +366,7 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
363
366
|
const marketTicker = id.replace(/-NO$/, "");
|
|
364
367
|
return this.ws.watchOrderBook(marketTicker);
|
|
365
368
|
}
|
|
366
|
-
async watchTrades(id, since, limit) {
|
|
369
|
+
async watchTrades(id, address, since, limit) {
|
|
367
370
|
const auth = this.ensureAuth();
|
|
368
371
|
if (!this.ws) {
|
|
369
372
|
// Merge wsConfig with wsUrl from config
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fromKalshiCents = fromKalshiCents;
|
|
4
|
+
exports.invertKalshiCents = invertKalshiCents;
|
|
5
|
+
exports.invertKalshiUnified = invertKalshiUnified;
|
|
6
|
+
function fromKalshiCents(priceInCents) {
|
|
7
|
+
return priceInCents / 100;
|
|
8
|
+
}
|
|
9
|
+
function invertKalshiCents(priceInCents) {
|
|
10
|
+
return 1 - priceInCents / 100;
|
|
11
|
+
}
|
|
12
|
+
function invertKalshiUnified(price) {
|
|
13
|
+
return 1 - price;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const price_1 = require("./price");
|
|
4
|
+
describe("fromKalshiCents", () => {
|
|
5
|
+
test("converts cents to a decimal probability", () => {
|
|
6
|
+
expect((0, price_1.fromKalshiCents)(55)).toBe(0.55);
|
|
7
|
+
expect((0, price_1.fromKalshiCents)(0)).toBe(0);
|
|
8
|
+
expect((0, price_1.fromKalshiCents)(100)).toBe(1);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe("invertKalshiCents", () => {
|
|
12
|
+
test("returns the complement of a cent value", () => {
|
|
13
|
+
expect((0, price_1.invertKalshiCents)(45)).toBeCloseTo(0.55);
|
|
14
|
+
expect((0, price_1.invertKalshiCents)(0)).toBe(1);
|
|
15
|
+
expect((0, price_1.invertKalshiCents)(100)).toBe(0);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe("invertKalshiUnified", () => {
|
|
19
|
+
test("returns the complement of a normalized price", () => {
|
|
20
|
+
expect((0, price_1.invertKalshiUnified)(0.45)).toBeCloseTo(0.55);
|
|
21
|
+
expect((0, price_1.invertKalshiUnified)(0)).toBe(1);
|
|
22
|
+
expect((0, price_1.invertKalshiUnified)(1)).toBe(0);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mapMarketToUnified = mapMarketToUnified;
|
|
4
4
|
exports.mapIntervalToKalshi = mapIntervalToKalshi;
|
|
5
5
|
const market_utils_1 = require("../../utils/market-utils");
|
|
6
|
+
const price_1 = require("./price");
|
|
6
7
|
function mapMarketToUnified(event, market) {
|
|
7
8
|
if (!market)
|
|
8
9
|
return null;
|
|
9
10
|
// Calculate price
|
|
10
11
|
let price = 0.5;
|
|
11
12
|
if (market.last_price) {
|
|
12
|
-
price = market.last_price
|
|
13
|
+
price = (0, price_1.fromKalshiCents)(market.last_price);
|
|
13
14
|
}
|
|
14
15
|
else if (market.yes_ask && market.yes_bid) {
|
|
15
|
-
price = (market.yes_ask + market.yes_bid) /
|
|
16
|
+
price = ((0, price_1.fromKalshiCents)(market.yes_ask) + (0, price_1.fromKalshiCents)(market.yes_bid)) / 2;
|
|
16
17
|
}
|
|
17
18
|
else if (market.yes_ask) {
|
|
18
|
-
price = market.yes_ask
|
|
19
|
+
price = (0, price_1.fromKalshiCents)(market.yes_ask);
|
|
19
20
|
}
|
|
20
21
|
// Extract candidate name
|
|
21
22
|
let candidateName = null;
|
|
@@ -40,7 +41,7 @@ function mapMarketToUnified(event, market) {
|
|
|
40
41
|
outcomeId: `${market.ticker}-NO`,
|
|
41
42
|
marketId: market.ticker,
|
|
42
43
|
label: candidateName ? `Not ${candidateName}` : "No",
|
|
43
|
-
price:
|
|
44
|
+
price: (0, price_1.invertKalshiUnified)(price),
|
|
44
45
|
priceChange24h: -priceChange, // Inverse change for No? simplified assumption
|
|
45
46
|
},
|
|
46
47
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
|
|
3
|
-
* Generated at: 2026-03-
|
|
3
|
+
* Generated at: 2026-03-14T16:22:11.425Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const limitlessApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.limitlessApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
|
|
6
|
-
* Generated at: 2026-03-
|
|
6
|
+
* Generated at: 2026-03-14T16:22:11.425Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.limitlessApiSpec = {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EventFetchParams, ExchangeCredentials, HistoryFilterParams, MarketFetchParams, MyTradesParams, OHLCVParams, OrderHistoryParams, PredictionMarketExchange, TradesParams } from '../../BaseExchange';
|
|
2
|
+
import { SubscribedAddressSnapshot, SubscriptionOption } from '../../subscriber/base';
|
|
3
|
+
import { buildLimitlessBalanceActivity, LIMITLESS_DEFAULT_SUBSCRIPTION } from '../../subscriber/external/goldsky';
|
|
4
|
+
import { WatcherConfig } from '../../subscriber/watcher';
|
|
5
|
+
import { Balance, CreateOrderParams, Order, OrderBook, Position, PriceCandle, Trade, UnifiedEvent, UnifiedMarket, UserTrade } from '../../types';
|
|
3
6
|
import { LimitlessWebSocketConfig } from './websocket';
|
|
4
|
-
export type { LimitlessWebSocketConfig };
|
|
7
|
+
export type { LimitlessWebSocketConfig, WatcherConfig };
|
|
8
|
+
export { LIMITLESS_DEFAULT_SUBSCRIPTION, buildLimitlessBalanceActivity };
|
|
5
9
|
export interface LimitlessExchangeOptions {
|
|
6
10
|
credentials?: ExchangeCredentials;
|
|
7
11
|
websocket?: LimitlessWebSocketConfig;
|
|
@@ -19,6 +23,8 @@ export declare class LimitlessExchange extends PredictionMarketExchange {
|
|
|
19
23
|
fetchOpenOrders: true;
|
|
20
24
|
fetchPositions: true;
|
|
21
25
|
fetchBalance: true;
|
|
26
|
+
watchAddress: true;
|
|
27
|
+
unwatchAddress: true;
|
|
22
28
|
watchOrderBook: true;
|
|
23
29
|
watchTrades: true;
|
|
24
30
|
fetchMyTrades: true;
|
|
@@ -30,19 +36,12 @@ export declare class LimitlessExchange extends PredictionMarketExchange {
|
|
|
30
36
|
private auth?;
|
|
31
37
|
private client?;
|
|
32
38
|
private wsConfig?;
|
|
39
|
+
private ws?;
|
|
33
40
|
constructor(options?: ExchangeCredentials | LimitlessExchangeOptions);
|
|
34
41
|
get name(): string;
|
|
35
|
-
protected mapImplicitApiError(error: any): any;
|
|
36
|
-
protected fetchMarketsImpl(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
37
|
-
protected fetchEventsImpl(params: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
38
42
|
fetchOHLCV(id: string, params: OHLCVParams): Promise<PriceCandle[]>;
|
|
39
43
|
fetchOrderBook(id: string): Promise<OrderBook>;
|
|
40
44
|
fetchTrades(id: string, params: TradesParams | HistoryFilterParams): Promise<Trade[]>;
|
|
41
|
-
private ensureClient;
|
|
42
|
-
/**
|
|
43
|
-
* Ensure authentication is initialized before trading operations.
|
|
44
|
-
*/
|
|
45
|
-
private ensureAuth;
|
|
46
45
|
createOrder(params: CreateOrderParams): Promise<Order>;
|
|
47
46
|
cancelOrder(orderId: string): Promise<Order>;
|
|
48
47
|
fetchOrder(orderId: string): Promise<Order>;
|
|
@@ -50,15 +49,10 @@ export declare class LimitlessExchange extends PredictionMarketExchange {
|
|
|
50
49
|
fetchMyTrades(params?: MyTradesParams): Promise<UserTrade[]>;
|
|
51
50
|
fetchClosedOrders(params?: OrderHistoryParams): Promise<Order[]>;
|
|
52
51
|
fetchAllOrders(params?: OrderHistoryParams): Promise<Order[]>;
|
|
53
|
-
fetchPositions(): Promise<Position[]>;
|
|
54
|
-
fetchBalance(): Promise<Balance[]>;
|
|
55
|
-
private ws?;
|
|
56
|
-
/**
|
|
57
|
-
* Initialize WebSocket with API key if available.
|
|
58
|
-
*/
|
|
59
|
-
private initWebSocket;
|
|
52
|
+
fetchPositions(address?: string): Promise<Position[]>;
|
|
53
|
+
fetchBalance(address?: string): Promise<Balance[]>;
|
|
60
54
|
watchOrderBook(id: string, limit?: number): Promise<OrderBook>;
|
|
61
|
-
watchTrades(id: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
55
|
+
watchTrades(id: string, address?: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
62
56
|
/**
|
|
63
57
|
* Watch AMM price updates for a market address (Limitless only).
|
|
64
58
|
* Requires WebSocket connection.
|
|
@@ -105,5 +99,50 @@ export declare class LimitlessExchange extends PredictionMarketExchange {
|
|
|
105
99
|
* exchange.watch_user_transactions(callback=lambda data: print('Transaction:', data))
|
|
106
100
|
*/
|
|
107
101
|
watchUserTransactions(callback: (data: any) => void): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Stream activity (positions, balances) for any public Base-chain wallet address.
|
|
104
|
+
*
|
|
105
|
+
* Uses polling of the Limitless public portfolio API (positions) and on-chain Base
|
|
106
|
+
* RPC calls (USDC balance). No credentials are required.
|
|
107
|
+
*
|
|
108
|
+
* Note: Limitless does not expose a public per-address trades endpoint, so the
|
|
109
|
+
* `'trades'` type returns an empty array when watching a public address.
|
|
110
|
+
*
|
|
111
|
+
* Follows the CCXT Pro streaming pattern: the first call returns the initial snapshot
|
|
112
|
+
* immediately; subsequent calls block until a change is detected.
|
|
113
|
+
*
|
|
114
|
+
* @param address - Any public Base-chain wallet address
|
|
115
|
+
* @param types - Activity types to watch (default: all)
|
|
116
|
+
*
|
|
117
|
+
* @example-ts
|
|
118
|
+
* while (true) {
|
|
119
|
+
* const activity = await exchange.watchAddress('0xabc...', ['positions', 'balances']);
|
|
120
|
+
* console.log(activity.positions, activity.balances);
|
|
121
|
+
* }
|
|
122
|
+
*/
|
|
123
|
+
watchAddress(address: string, types?: SubscriptionOption[]): Promise<SubscribedAddressSnapshot>;
|
|
124
|
+
/**
|
|
125
|
+
* Stop watching an address and release polling resources.
|
|
126
|
+
* Any pending `watchAddress` promises for that address will be rejected.
|
|
127
|
+
*/
|
|
128
|
+
unwatchAddress(address: string): Promise<void>;
|
|
108
129
|
close(): Promise<void>;
|
|
130
|
+
protected mapImplicitApiError(error: any): any;
|
|
131
|
+
protected fetchMarketsImpl(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
132
|
+
protected fetchEventsImpl(params: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
133
|
+
private getAddressOnChainBalance;
|
|
134
|
+
private ensureClient;
|
|
135
|
+
/**
|
|
136
|
+
* Ensure authentication is initialized before trading operations.
|
|
137
|
+
*/
|
|
138
|
+
private ensureAuth;
|
|
139
|
+
/**
|
|
140
|
+
* Initialize WebSocket with API key if available.
|
|
141
|
+
*/
|
|
142
|
+
private ensureWs;
|
|
143
|
+
/**
|
|
144
|
+
* Fetch a composite activity snapshot for a Base-chain address from the Limitless
|
|
145
|
+
* public portfolio API and Base RPC. Used internally by the BaseSubscriber polling loop.
|
|
146
|
+
*/
|
|
147
|
+
private fetchWatchedAddressActivity;
|
|
109
148
|
}
|