pmxt 1.5.1__tar.gz → 1.5.4__tar.gz
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.
- {pmxt-1.5.1 → pmxt-1.5.4}/PKG-INFO +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/__init__.py +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/api_client.py +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/configuration.py +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/__init__.py +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/_server/server/bundled.js +295 -204
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt.egg-info/PKG-INFO +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/pyproject.toml +1 -1
- {pmxt-1.5.1 → pmxt-1.5.4}/README.md +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/api/__init__.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/api/default_api.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/api_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/exceptions.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/__init__.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/balance.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/base_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/base_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/cancel_order_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/create_order200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/create_order_params.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/create_order_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/error_detail.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/error_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/exchange_credentials.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/execution_price_result.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_balance200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_markets200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_markets_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_ohlcv200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_ohlcv_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_ohlcv_request_args_inner.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_open_orders200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_open_orders_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_order_book200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_order_book_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_positions200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_positions_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_trades200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/fetch_trades_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price_detailed200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price_request_args_inner.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_markets_by_slug_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/health_check200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/history_filter_params.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/market_filter_params.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/market_outcome.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/order.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/order_book.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/order_level.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/position.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/price_candle.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/search_events200_response.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/search_events_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/search_markets_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/search_markets_request_args_inner.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/trade.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/unified_event.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/unified_market.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/watch_order_book_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/watch_order_book_request_args_inner.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/watch_trades_request.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/py.typed +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/rest.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/_server/__init__.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/_server/bin/pmxt-ensure-server +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/_server/bin/pmxt-ensure-server.js +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/client.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/models.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt/server_manager.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt.egg-info/SOURCES.txt +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt.egg-info/dependency_links.txt +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt.egg-info/requires.txt +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/pmxt.egg-info/top_level.txt +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/setup.cfg +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/tests/test_integration.py +0 -0
- {pmxt-1.5.1 → pmxt-1.5.4}/tests/test_server_manager.py +0 -0
|
@@ -91,7 +91,7 @@ class ApiClient:
|
|
|
91
91
|
self.default_headers[header_name] = header_value
|
|
92
92
|
self.cookie = cookie
|
|
93
93
|
# Set default User-Agent.
|
|
94
|
-
self.user_agent = 'OpenAPI-Generator/1.5.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/1.5.4/python'
|
|
95
95
|
self.client_side_validation = configuration.client_side_validation
|
|
96
96
|
|
|
97
97
|
def __enter__(self):
|
|
@@ -506,7 +506,7 @@ class Configuration:
|
|
|
506
506
|
"OS: {env}\n"\
|
|
507
507
|
"Python Version: {pyversion}\n"\
|
|
508
508
|
"Version of the API: 0.4.4\n"\
|
|
509
|
-
"SDK Package Version: 1.5.
|
|
509
|
+
"SDK Package Version: 1.5.4".\
|
|
510
510
|
format(env=sys.platform, pyversion=sys.version)
|
|
511
511
|
|
|
512
512
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -38127,12 +38127,13 @@ var require_utils4 = __commonJS({
|
|
|
38127
38127
|
"dist/exchanges/polymarket/utils.js"(exports2) {
|
|
38128
38128
|
"use strict";
|
|
38129
38129
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38130
|
-
exports2.CLOB_API_URL = exports2.GAMMA_API_URL = void 0;
|
|
38130
|
+
exports2.DATA_API_URL = exports2.CLOB_API_URL = exports2.GAMMA_API_URL = void 0;
|
|
38131
38131
|
exports2.mapMarketToUnified = mapMarketToUnified;
|
|
38132
38132
|
exports2.mapIntervalToFidelity = mapIntervalToFidelity;
|
|
38133
38133
|
var market_utils_1 = require_market_utils();
|
|
38134
38134
|
exports2.GAMMA_API_URL = "https://gamma-api.polymarket.com/events";
|
|
38135
38135
|
exports2.CLOB_API_URL = "https://clob.polymarket.com";
|
|
38136
|
+
exports2.DATA_API_URL = "https://data-api.polymarket.com";
|
|
38136
38137
|
function mapMarketToUnified(event, market, options = {}) {
|
|
38137
38138
|
if (!market)
|
|
38138
38139
|
return null;
|
|
@@ -38284,7 +38285,7 @@ var require_searchMarkets = __commonJS({
|
|
|
38284
38285
|
exports2.searchMarkets = searchMarkets;
|
|
38285
38286
|
var fetchMarkets_1 = require_fetchMarkets();
|
|
38286
38287
|
async function searchMarkets(query, params) {
|
|
38287
|
-
const searchLimit =
|
|
38288
|
+
const searchLimit = 5e3;
|
|
38288
38289
|
try {
|
|
38289
38290
|
const markets = await (0, fetchMarkets_1.fetchMarkets)({
|
|
38290
38291
|
...params,
|
|
@@ -38562,7 +38563,8 @@ var require_fetchTrades = __commonJS({
|
|
|
38562
38563
|
}
|
|
38563
38564
|
try {
|
|
38564
38565
|
const queryParams = {
|
|
38565
|
-
|
|
38566
|
+
asset_id: id
|
|
38567
|
+
// Uses asset_id for Token ID on Data API
|
|
38566
38568
|
};
|
|
38567
38569
|
if (params.start) {
|
|
38568
38570
|
queryParams.after = Math.floor(params.start.getTime() / 1e3);
|
|
@@ -38570,7 +38572,7 @@ var require_fetchTrades = __commonJS({
|
|
|
38570
38572
|
if (params.end) {
|
|
38571
38573
|
queryParams.before = Math.floor(params.end.getTime() / 1e3);
|
|
38572
38574
|
}
|
|
38573
|
-
const response = await axios_1.default.get(`${utils_1.
|
|
38575
|
+
const response = await axios_1.default.get(`${utils_1.DATA_API_URL}/trades`, {
|
|
38574
38576
|
params: queryParams
|
|
38575
38577
|
});
|
|
38576
38578
|
const trades = response.data || [];
|
|
@@ -38583,13 +38585,14 @@ var require_fetchTrades = __commonJS({
|
|
|
38583
38585
|
side: trade.side === "BUY" ? "buy" : trade.side === "SELL" ? "sell" : "unknown"
|
|
38584
38586
|
}));
|
|
38585
38587
|
if (params.limit && mappedTrades.length > params.limit) {
|
|
38586
|
-
return mappedTrades.slice(
|
|
38588
|
+
return mappedTrades.slice(0, params.limit);
|
|
38587
38589
|
}
|
|
38588
38590
|
return mappedTrades;
|
|
38589
38591
|
} catch (error) {
|
|
38590
|
-
if (axios_1.default.isAxiosError(error)
|
|
38591
|
-
const apiError = error.response
|
|
38592
|
-
|
|
38592
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
38593
|
+
const apiError = error.response?.data?.error || error.response?.data?.message || error.message;
|
|
38594
|
+
console.error(`[Polymarket] fetchTrades failed for ID ${id}: ${apiError}`);
|
|
38595
|
+
throw new Error(`Polymarket Trades API Error: ${apiError}`);
|
|
38593
38596
|
}
|
|
38594
38597
|
console.error(`Unexpected error fetching Polymarket trades for ${id}:`, error);
|
|
38595
38598
|
throw error;
|
|
@@ -38608,25 +38611,31 @@ var require_fetchPositions = __commonJS({
|
|
|
38608
38611
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38609
38612
|
exports2.fetchPositions = fetchPositions;
|
|
38610
38613
|
var axios_1 = __importDefault(require_axios());
|
|
38611
|
-
var
|
|
38614
|
+
var utils_1 = require_utils4();
|
|
38612
38615
|
async function fetchPositions(userAddress) {
|
|
38613
|
-
|
|
38614
|
-
|
|
38615
|
-
|
|
38616
|
-
|
|
38617
|
-
|
|
38618
|
-
|
|
38619
|
-
|
|
38620
|
-
|
|
38621
|
-
|
|
38622
|
-
|
|
38623
|
-
|
|
38624
|
-
|
|
38625
|
-
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38616
|
+
try {
|
|
38617
|
+
const response = await axios_1.default.get(`${utils_1.DATA_API_URL}/positions`, {
|
|
38618
|
+
params: {
|
|
38619
|
+
user: userAddress,
|
|
38620
|
+
limit: 100
|
|
38621
|
+
}
|
|
38622
|
+
});
|
|
38623
|
+
const data = Array.isArray(response.data) ? response.data : [];
|
|
38624
|
+
return data.map((p) => ({
|
|
38625
|
+
marketId: p.conditionId,
|
|
38626
|
+
outcomeId: p.asset,
|
|
38627
|
+
outcomeLabel: p.outcome || "Unknown",
|
|
38628
|
+
size: parseFloat(p.size),
|
|
38629
|
+
entryPrice: parseFloat(p.avgPrice),
|
|
38630
|
+
currentPrice: parseFloat(p.curPrice || "0"),
|
|
38631
|
+
unrealizedPnL: parseFloat(p.cashPnl || "0"),
|
|
38632
|
+
realizedPnL: parseFloat(p.realizedPnl || "0")
|
|
38633
|
+
}));
|
|
38634
|
+
} catch (error) {
|
|
38635
|
+
const apiError = error.response?.data?.error || error.response?.data?.message || error.message;
|
|
38636
|
+
console.error(`[Polymarket] fetchPositions failed for ${userAddress}: ${apiError}`);
|
|
38637
|
+
throw new Error(`Polymarket Positions API Error: ${apiError}`);
|
|
38638
|
+
}
|
|
38630
38639
|
}
|
|
38631
38640
|
}
|
|
38632
38641
|
});
|
|
@@ -104861,7 +104870,7 @@ var require_polymarket = __commonJS({
|
|
|
104861
104870
|
tickSize
|
|
104862
104871
|
});
|
|
104863
104872
|
if (!response || !response.success) {
|
|
104864
|
-
throw new Error(response?.errorMsg || "Order placement failed");
|
|
104873
|
+
throw new Error(`${response?.errorMsg || "Order placement failed"} (Response: ${JSON.stringify(response)})`);
|
|
104865
104874
|
}
|
|
104866
104875
|
return {
|
|
104867
104876
|
id: response.orderID,
|
|
@@ -104946,8 +104955,7 @@ var require_polymarket = __commonJS({
|
|
|
104946
104955
|
type: order.order_type === "GTC" ? "limit" : "market",
|
|
104947
104956
|
price: parseFloat(order.price),
|
|
104948
104957
|
amount: parseFloat(order.original_size),
|
|
104949
|
-
status: order.status,
|
|
104950
|
-
// Needs precise mapping
|
|
104958
|
+
status: typeof order.status === "string" ? order.status.toLowerCase() : order.status,
|
|
104951
104959
|
filled: parseFloat(order.size_matched),
|
|
104952
104960
|
remaining: parseFloat(order.original_size) - parseFloat(order.size_matched),
|
|
104953
104961
|
timestamp: order.created_at * 1e3
|
|
@@ -105130,7 +105138,7 @@ var require_fetchMarkets2 = __commonJS({
|
|
|
105130
105138
|
const unifiedMarkets = [];
|
|
105131
105139
|
for (const market of markets) {
|
|
105132
105140
|
const unifiedMarket = (0, utils_1.mapMarketToUnified)(market);
|
|
105133
|
-
if (unifiedMarket) {
|
|
105141
|
+
if (unifiedMarket && unifiedMarket.outcomes.length > 0) {
|
|
105134
105142
|
unifiedMarkets.push(unifiedMarket);
|
|
105135
105143
|
}
|
|
105136
105144
|
}
|
|
@@ -105167,8 +105175,22 @@ var require_searchMarkets2 = __commonJS({
|
|
|
105167
105175
|
limit: params?.limit || 20
|
|
105168
105176
|
}
|
|
105169
105177
|
});
|
|
105170
|
-
const
|
|
105171
|
-
|
|
105178
|
+
const rawResults = response.data?.markets || [];
|
|
105179
|
+
const allMarkets = [];
|
|
105180
|
+
for (const res of rawResults) {
|
|
105181
|
+
if (res.markets && Array.isArray(res.markets)) {
|
|
105182
|
+
for (const child of res.markets) {
|
|
105183
|
+
const mapped = (0, utils_1.mapMarketToUnified)(child);
|
|
105184
|
+
if (mapped)
|
|
105185
|
+
allMarkets.push(mapped);
|
|
105186
|
+
}
|
|
105187
|
+
} else {
|
|
105188
|
+
const mapped = (0, utils_1.mapMarketToUnified)(res);
|
|
105189
|
+
if (mapped)
|
|
105190
|
+
allMarkets.push(mapped);
|
|
105191
|
+
}
|
|
105192
|
+
}
|
|
105193
|
+
return allMarkets.filter((m) => m !== null && m.outcomes.length > 0).slice(0, params?.limit || 20);
|
|
105172
105194
|
} catch (error) {
|
|
105173
105195
|
console.error("Error searching Limitless data:", error.message);
|
|
105174
105196
|
return [];
|
|
@@ -105198,8 +105220,14 @@ var require_searchEvents2 = __commonJS({
|
|
|
105198
105220
|
});
|
|
105199
105221
|
const markets = response.data?.markets || [];
|
|
105200
105222
|
return markets.map((market) => {
|
|
105201
|
-
|
|
105202
|
-
|
|
105223
|
+
let marketsList = [];
|
|
105224
|
+
if (market.markets && Array.isArray(market.markets)) {
|
|
105225
|
+
marketsList = market.markets.map((child) => (0, utils_1.mapMarketToUnified)(child)).filter((m) => m !== null);
|
|
105226
|
+
} else {
|
|
105227
|
+
const unifiedMarket = (0, utils_1.mapMarketToUnified)(market);
|
|
105228
|
+
if (unifiedMarket)
|
|
105229
|
+
marketsList = [unifiedMarket];
|
|
105230
|
+
}
|
|
105203
105231
|
return {
|
|
105204
105232
|
id: market.slug,
|
|
105205
105233
|
title: market.title || market.question,
|
|
@@ -105212,7 +105240,7 @@ var require_searchEvents2 = __commonJS({
|
|
|
105212
105240
|
tags: market.tags || [],
|
|
105213
105241
|
searchMarkets: function(marketQuery) {
|
|
105214
105242
|
const lowerMarketQuery = marketQuery.toLowerCase();
|
|
105215
|
-
return this.markets.filter((m) => m.title.toLowerCase().includes(lowerMarketQuery) || m.description.toLowerCase().includes(lowerMarketQuery));
|
|
105243
|
+
return this.markets.filter((m) => m.title.toLowerCase().includes(lowerMarketQuery) || m.description && m.description.toLowerCase().includes(lowerMarketQuery));
|
|
105216
105244
|
}
|
|
105217
105245
|
};
|
|
105218
105246
|
});
|
|
@@ -105344,55 +105372,10 @@ var require_fetchOrderBook2 = __commonJS({
|
|
|
105344
105372
|
var require_fetchTrades2 = __commonJS({
|
|
105345
105373
|
"dist/exchanges/limitless/fetchTrades.js"(exports2) {
|
|
105346
105374
|
"use strict";
|
|
105347
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
105348
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
105349
|
-
};
|
|
105350
105375
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105351
105376
|
exports2.fetchTrades = fetchTrades;
|
|
105352
|
-
var axios_1 = __importDefault(require_axios());
|
|
105353
|
-
var utils_1 = require_utils10();
|
|
105354
105377
|
async function fetchTrades(id, params) {
|
|
105355
|
-
|
|
105356
|
-
const url2 = `${utils_1.LIMITLESS_API_URL}/portfolio/trades`;
|
|
105357
|
-
const requestParams = {
|
|
105358
|
-
limit: params.limit || 100
|
|
105359
|
-
};
|
|
105360
|
-
if (params.start) {
|
|
105361
|
-
requestParams.after = Math.floor(params.start.getTime() / 1e3);
|
|
105362
|
-
}
|
|
105363
|
-
if (params.end) {
|
|
105364
|
-
requestParams.before = Math.floor(params.end.getTime() / 1e3);
|
|
105365
|
-
}
|
|
105366
|
-
const response = await axios_1.default.get(url2, {
|
|
105367
|
-
params: requestParams
|
|
105368
|
-
});
|
|
105369
|
-
const tradesData = response.data?.data || response.data || [];
|
|
105370
|
-
let trades = tradesData.map((trade) => {
|
|
105371
|
-
const price = parseFloat(trade.price);
|
|
105372
|
-
const timestamp = Number(trade.timestamp);
|
|
105373
|
-
let side = "unknown";
|
|
105374
|
-
const rawSide = trade.side?.toLowerCase();
|
|
105375
|
-
if (rawSide === "buy")
|
|
105376
|
-
side = "buy";
|
|
105377
|
-
else if (rawSide === "sell")
|
|
105378
|
-
side = "sell";
|
|
105379
|
-
return {
|
|
105380
|
-
id: trade.id || `${timestamp}-${price}`,
|
|
105381
|
-
timestamp: timestamp * 1e3,
|
|
105382
|
-
price,
|
|
105383
|
-
amount: parseFloat(trade.size || trade.amount || 0),
|
|
105384
|
-
side
|
|
105385
|
-
};
|
|
105386
|
-
});
|
|
105387
|
-
trades.sort((a, b) => b.timestamp - a.timestamp);
|
|
105388
|
-
if (params.limit) {
|
|
105389
|
-
trades = trades.slice(0, params.limit);
|
|
105390
|
-
}
|
|
105391
|
-
return trades;
|
|
105392
|
-
} catch (error) {
|
|
105393
|
-
console.error(`Error fetching Limitless trades for ${id}:`, error.message);
|
|
105394
|
-
return [];
|
|
105395
|
-
}
|
|
105378
|
+
throw new Error("Limitless fetchTrades not implemented: No public market trades API available.");
|
|
105396
105379
|
}
|
|
105397
105380
|
}
|
|
105398
105381
|
});
|
|
@@ -105518,6 +105501,176 @@ var require_auth2 = __commonJS({
|
|
|
105518
105501
|
}
|
|
105519
105502
|
});
|
|
105520
105503
|
|
|
105504
|
+
// dist/exchanges/limitless/client.js
|
|
105505
|
+
var require_client = __commonJS({
|
|
105506
|
+
"dist/exchanges/limitless/client.js"(exports2) {
|
|
105507
|
+
"use strict";
|
|
105508
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
105509
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
105510
|
+
};
|
|
105511
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105512
|
+
exports2.LimitlessClient = void 0;
|
|
105513
|
+
var axios_1 = __importDefault(require_axios());
|
|
105514
|
+
var ethers_1 = require_lib36();
|
|
105515
|
+
var LIMITLESS_API_URL = "https://api.limitless.exchange";
|
|
105516
|
+
var BASE_CHAIN_ID = 8453;
|
|
105517
|
+
var ORDER_TYPES = {
|
|
105518
|
+
Order: [
|
|
105519
|
+
{ name: "salt", type: "uint256" },
|
|
105520
|
+
{ name: "maker", type: "address" },
|
|
105521
|
+
{ name: "signer", type: "address" },
|
|
105522
|
+
{ name: "taker", type: "address" },
|
|
105523
|
+
{ name: "tokenId", type: "uint256" },
|
|
105524
|
+
{ name: "makerAmount", type: "uint256" },
|
|
105525
|
+
{ name: "takerAmount", type: "uint256" },
|
|
105526
|
+
{ name: "expiration", type: "uint256" },
|
|
105527
|
+
{ name: "nonce", type: "uint256" },
|
|
105528
|
+
{ name: "feeRateBps", type: "uint256" },
|
|
105529
|
+
{ name: "side", type: "uint8" },
|
|
105530
|
+
{ name: "signatureType", type: "uint8" }
|
|
105531
|
+
]
|
|
105532
|
+
};
|
|
105533
|
+
var LimitlessClient = class {
|
|
105534
|
+
constructor(privateKey) {
|
|
105535
|
+
this.marketCache = {};
|
|
105536
|
+
this.signer = new ethers_1.Wallet(privateKey);
|
|
105537
|
+
this.api = axios_1.default.create({
|
|
105538
|
+
baseURL: LIMITLESS_API_URL,
|
|
105539
|
+
headers: {
|
|
105540
|
+
"Content-Type": "application/json",
|
|
105541
|
+
"Accept": "application/json"
|
|
105542
|
+
}
|
|
105543
|
+
});
|
|
105544
|
+
}
|
|
105545
|
+
async ensureAuth() {
|
|
105546
|
+
if (this.sessionCookie && this.userId)
|
|
105547
|
+
return;
|
|
105548
|
+
const msgRes = await this.api.get("/auth/signing-message");
|
|
105549
|
+
const message = msgRes.data;
|
|
105550
|
+
const hexMessage = ethers_1.utils.hexlify(ethers_1.utils.toUtf8Bytes(message));
|
|
105551
|
+
const signature = await this.signer.signMessage(message);
|
|
105552
|
+
const loginRes = await this.api.post("/auth/login", {
|
|
105553
|
+
client: "eoa"
|
|
105554
|
+
}, {
|
|
105555
|
+
headers: {
|
|
105556
|
+
"x-account": this.signer.address,
|
|
105557
|
+
"x-signing-message": hexMessage,
|
|
105558
|
+
"x-signature": signature
|
|
105559
|
+
}
|
|
105560
|
+
});
|
|
105561
|
+
const setCookie = loginRes.headers["set-cookie"];
|
|
105562
|
+
if (setCookie) {
|
|
105563
|
+
const sessionMatch = setCookie.find((c) => c.startsWith("limitless_session="));
|
|
105564
|
+
if (sessionMatch) {
|
|
105565
|
+
this.sessionCookie = sessionMatch.split(";")[0];
|
|
105566
|
+
}
|
|
105567
|
+
}
|
|
105568
|
+
if (!this.sessionCookie) {
|
|
105569
|
+
throw new Error("Failed to retrieve session cookie from login response");
|
|
105570
|
+
}
|
|
105571
|
+
this.userId = loginRes.data.id;
|
|
105572
|
+
this.userData = loginRes.data;
|
|
105573
|
+
this.api.defaults.headers.common["Cookie"] = this.sessionCookie;
|
|
105574
|
+
}
|
|
105575
|
+
async getMarket(slug) {
|
|
105576
|
+
if (this.marketCache[slug])
|
|
105577
|
+
return this.marketCache[slug];
|
|
105578
|
+
const res = await this.api.get(`/markets/${slug}`);
|
|
105579
|
+
const market = res.data;
|
|
105580
|
+
if (!market)
|
|
105581
|
+
throw new Error(`Market not found: ${slug}`);
|
|
105582
|
+
this.marketCache[slug] = market;
|
|
105583
|
+
return market;
|
|
105584
|
+
}
|
|
105585
|
+
async createOrder(params) {
|
|
105586
|
+
await this.ensureAuth();
|
|
105587
|
+
const market = await this.getMarket(params.marketSlug);
|
|
105588
|
+
const venue = market.venue;
|
|
105589
|
+
if (!venue || !venue.exchange) {
|
|
105590
|
+
throw new Error(`Market ${params.marketSlug} has no venue exchange address`);
|
|
105591
|
+
}
|
|
105592
|
+
const SCALING_FACTOR = 1e6;
|
|
105593
|
+
let makerAmount;
|
|
105594
|
+
let takerAmount;
|
|
105595
|
+
const price = params.price;
|
|
105596
|
+
const amount = params.amount;
|
|
105597
|
+
if (params.side === "BUY") {
|
|
105598
|
+
const totalCost = price * amount;
|
|
105599
|
+
makerAmount = Math.round(totalCost * SCALING_FACTOR);
|
|
105600
|
+
takerAmount = Math.round(amount * SCALING_FACTOR);
|
|
105601
|
+
} else {
|
|
105602
|
+
const totalProceeds = price * amount;
|
|
105603
|
+
makerAmount = Math.round(amount * SCALING_FACTOR);
|
|
105604
|
+
takerAmount = Math.round(totalProceeds * SCALING_FACTOR);
|
|
105605
|
+
}
|
|
105606
|
+
const domain = {
|
|
105607
|
+
name: "Limitless CTF Exchange",
|
|
105608
|
+
version: "1",
|
|
105609
|
+
chainId: BASE_CHAIN_ID,
|
|
105610
|
+
// 8453
|
|
105611
|
+
verifyingContract: venue.exchange
|
|
105612
|
+
};
|
|
105613
|
+
const sideInt = params.side === "BUY" ? 0 : 1;
|
|
105614
|
+
const feeRateBps = this.userData?.rank?.feeRateBps ?? 0;
|
|
105615
|
+
const orderData = {
|
|
105616
|
+
salt: Date.now() + 864e5,
|
|
105617
|
+
// 24h expiry
|
|
105618
|
+
maker: this.signer.address,
|
|
105619
|
+
signer: this.signer.address,
|
|
105620
|
+
taker: "0x0000000000000000000000000000000000000000",
|
|
105621
|
+
tokenId: params.outcomeId,
|
|
105622
|
+
// Keep as string for now if big
|
|
105623
|
+
makerAmount,
|
|
105624
|
+
takerAmount,
|
|
105625
|
+
expiration: "0",
|
|
105626
|
+
nonce: 0,
|
|
105627
|
+
feeRateBps,
|
|
105628
|
+
side: sideInt,
|
|
105629
|
+
signatureType: 0
|
|
105630
|
+
// EOA
|
|
105631
|
+
};
|
|
105632
|
+
const signature = await this.signer._signTypedData(domain, ORDER_TYPES, orderData);
|
|
105633
|
+
const payload = {
|
|
105634
|
+
order: {
|
|
105635
|
+
...orderData,
|
|
105636
|
+
price: params.price,
|
|
105637
|
+
// Send float as per API
|
|
105638
|
+
signature
|
|
105639
|
+
},
|
|
105640
|
+
ownerId: this.userId,
|
|
105641
|
+
orderType: "GTC",
|
|
105642
|
+
// Force Limit Orders for now
|
|
105643
|
+
marketSlug: params.marketSlug
|
|
105644
|
+
};
|
|
105645
|
+
const res = await this.api.post("/orders", payload);
|
|
105646
|
+
return res.data;
|
|
105647
|
+
}
|
|
105648
|
+
async cancelOrder(orderId) {
|
|
105649
|
+
await this.ensureAuth();
|
|
105650
|
+
const res = await this.api.delete(`/orders/${orderId}`, {
|
|
105651
|
+
data: {}
|
|
105652
|
+
});
|
|
105653
|
+
return res.data;
|
|
105654
|
+
}
|
|
105655
|
+
async cancelAllOrders(marketSlug) {
|
|
105656
|
+
await this.ensureAuth();
|
|
105657
|
+
const res = await this.api.delete(`/orders/all/${marketSlug}`);
|
|
105658
|
+
return res.data;
|
|
105659
|
+
}
|
|
105660
|
+
async getOrders(marketSlug, statuses) {
|
|
105661
|
+
await this.ensureAuth();
|
|
105662
|
+
const params = {};
|
|
105663
|
+
if (statuses && statuses.length > 0) {
|
|
105664
|
+
params.statuses = statuses;
|
|
105665
|
+
}
|
|
105666
|
+
const res = await this.api.get(`/markets/${marketSlug}/user-orders`, { params });
|
|
105667
|
+
return res.data.orders || [];
|
|
105668
|
+
}
|
|
105669
|
+
};
|
|
105670
|
+
exports2.LimitlessClient = LimitlessClient;
|
|
105671
|
+
}
|
|
105672
|
+
});
|
|
105673
|
+
|
|
105521
105674
|
// dist/exchanges/limitless/websocket.js
|
|
105522
105675
|
var require_websocket4 = __commonJS({
|
|
105523
105676
|
"dist/exchanges/limitless/websocket.js"(exports2) {
|
|
@@ -105556,7 +105709,7 @@ var require_limitless = __commonJS({
|
|
|
105556
105709
|
var fetchTrades_1 = require_fetchTrades2();
|
|
105557
105710
|
var fetchPositions_1 = require_fetchPositions2();
|
|
105558
105711
|
var auth_1 = require_auth2();
|
|
105559
|
-
var
|
|
105712
|
+
var client_1 = require_client();
|
|
105560
105713
|
var websocket_1 = require_websocket4();
|
|
105561
105714
|
var LimitlessExchange = class extends BaseExchange_1.PredictionMarketExchange {
|
|
105562
105715
|
constructor(options) {
|
|
@@ -105574,6 +105727,7 @@ var require_limitless = __commonJS({
|
|
|
105574
105727
|
this.wsConfig = wsConfig;
|
|
105575
105728
|
if (credentials?.privateKey) {
|
|
105576
105729
|
this.auth = new auth_1.LimitlessAuth(credentials);
|
|
105730
|
+
this.client = new client_1.LimitlessClient(credentials.privateKey);
|
|
105577
105731
|
}
|
|
105578
105732
|
}
|
|
105579
105733
|
get name() {
|
|
@@ -105603,6 +105757,12 @@ var require_limitless = __commonJS({
|
|
|
105603
105757
|
// ----------------------------------------------------------------------------
|
|
105604
105758
|
// Trading Methods
|
|
105605
105759
|
// ----------------------------------------------------------------------------
|
|
105760
|
+
ensureClient() {
|
|
105761
|
+
if (!this.client) {
|
|
105762
|
+
throw new Error('Trading operations require authentication. Initialize LimitlessExchange with credentials: new LimitlessExchange({ privateKey: "0x..." })');
|
|
105763
|
+
}
|
|
105764
|
+
return this.client;
|
|
105765
|
+
}
|
|
105606
105766
|
/**
|
|
105607
105767
|
* Ensure authentication is initialized before trading operations.
|
|
105608
105768
|
*/
|
|
@@ -105613,44 +105773,29 @@ var require_limitless = __commonJS({
|
|
|
105613
105773
|
return this.auth;
|
|
105614
105774
|
}
|
|
105615
105775
|
async createOrder(params) {
|
|
105616
|
-
const
|
|
105617
|
-
const client = await auth.getClobClient();
|
|
105618
|
-
const side = params.side.toUpperCase() === "BUY" ? clob_client_1.Side.BUY : clob_client_1.Side.SELL;
|
|
105619
|
-
if (params.type === "limit" && !params.price) {
|
|
105620
|
-
throw new Error("Price is required for limit orders");
|
|
105621
|
-
}
|
|
105622
|
-
const price = params.price || (side === clob_client_1.Side.BUY ? 0.99 : 0.01);
|
|
105623
|
-
let tickSize;
|
|
105624
|
-
if (params.tickSize) {
|
|
105625
|
-
tickSize = params.tickSize.toString();
|
|
105626
|
-
} else {
|
|
105627
|
-
try {
|
|
105628
|
-
const orderBook = await this.fetchOrderBook(params.outcomeId);
|
|
105629
|
-
tickSize = this.inferTickSize(orderBook);
|
|
105630
|
-
} catch (error) {
|
|
105631
|
-
tickSize = "0.001";
|
|
105632
|
-
}
|
|
105633
|
-
}
|
|
105776
|
+
const client = this.ensureClient();
|
|
105634
105777
|
try {
|
|
105635
|
-
const
|
|
105636
|
-
|
|
105637
|
-
|
|
105778
|
+
const side = params.side.toUpperCase();
|
|
105779
|
+
const marketSlug = params.marketId;
|
|
105780
|
+
if (!params.price) {
|
|
105781
|
+
throw new Error("Limit orders require a price");
|
|
105782
|
+
}
|
|
105783
|
+
const response = await client.createOrder({
|
|
105784
|
+
marketSlug,
|
|
105785
|
+
outcomeId: params.outcomeId,
|
|
105638
105786
|
side,
|
|
105639
|
-
|
|
105640
|
-
|
|
105641
|
-
|
|
105642
|
-
tickSize
|
|
105787
|
+
price: params.price,
|
|
105788
|
+
amount: params.amount,
|
|
105789
|
+
type: params.type
|
|
105643
105790
|
});
|
|
105644
|
-
if (!response || !response.success) {
|
|
105645
|
-
throw new Error(response?.errorMsg || "Order placement failed");
|
|
105646
|
-
}
|
|
105647
105791
|
return {
|
|
105648
|
-
id: response.
|
|
105792
|
+
id: response.id || "unknown",
|
|
105793
|
+
// Adjust based on actual response
|
|
105649
105794
|
marketId: params.marketId,
|
|
105650
105795
|
outcomeId: params.outcomeId,
|
|
105651
105796
|
side: params.side,
|
|
105652
105797
|
type: params.type,
|
|
105653
|
-
price,
|
|
105798
|
+
price: params.price,
|
|
105654
105799
|
amount: params.amount,
|
|
105655
105800
|
status: "open",
|
|
105656
105801
|
filled: 0,
|
|
@@ -105658,46 +105803,14 @@ var require_limitless = __commonJS({
|
|
|
105658
105803
|
timestamp: Date.now()
|
|
105659
105804
|
};
|
|
105660
105805
|
} catch (error) {
|
|
105806
|
+
console.error("Limitless createOrder failed:", error.response?.data || error.message);
|
|
105661
105807
|
throw error;
|
|
105662
105808
|
}
|
|
105663
105809
|
}
|
|
105664
|
-
/**
|
|
105665
|
-
* Infer the tick size from order book price levels.
|
|
105666
|
-
* Analyzes the decimal precision of existing orders to determine the market's tick size.
|
|
105667
|
-
*/
|
|
105668
|
-
inferTickSize(orderBook) {
|
|
105669
|
-
const allPrices = [
|
|
105670
|
-
...orderBook.bids.map((b) => b.price),
|
|
105671
|
-
...orderBook.asks.map((a) => a.price)
|
|
105672
|
-
];
|
|
105673
|
-
if (allPrices.length === 0) {
|
|
105674
|
-
return "0.001";
|
|
105675
|
-
}
|
|
105676
|
-
let minIncrement = 1;
|
|
105677
|
-
for (const price of allPrices) {
|
|
105678
|
-
const priceStr = price.toString();
|
|
105679
|
-
const decimalPart = priceStr.split(".")[1];
|
|
105680
|
-
if (decimalPart) {
|
|
105681
|
-
const decimals = decimalPart.length;
|
|
105682
|
-
const increment = Math.pow(10, -decimals);
|
|
105683
|
-
if (increment < minIncrement) {
|
|
105684
|
-
minIncrement = increment;
|
|
105685
|
-
}
|
|
105686
|
-
}
|
|
105687
|
-
}
|
|
105688
|
-
if (minIncrement >= 0.1)
|
|
105689
|
-
return "0.1";
|
|
105690
|
-
if (minIncrement >= 0.01)
|
|
105691
|
-
return "0.01";
|
|
105692
|
-
if (minIncrement >= 1e-3)
|
|
105693
|
-
return "0.001";
|
|
105694
|
-
return "0.0001";
|
|
105695
|
-
}
|
|
105696
105810
|
async cancelOrder(orderId) {
|
|
105697
|
-
const
|
|
105698
|
-
const client = await auth.getClobClient();
|
|
105811
|
+
const client = this.ensureClient();
|
|
105699
105812
|
try {
|
|
105700
|
-
await client.cancelOrder(
|
|
105813
|
+
await client.cancelOrder(orderId);
|
|
105701
105814
|
return {
|
|
105702
105815
|
id: orderId,
|
|
105703
105816
|
marketId: "unknown",
|
|
@@ -105711,51 +105824,36 @@ var require_limitless = __commonJS({
|
|
|
105711
105824
|
timestamp: Date.now()
|
|
105712
105825
|
};
|
|
105713
105826
|
} catch (error) {
|
|
105827
|
+
console.error("Limitless cancelOrder failed:", error.response?.data || error.message);
|
|
105714
105828
|
throw error;
|
|
105715
105829
|
}
|
|
105716
105830
|
}
|
|
105717
105831
|
async fetchOrder(orderId) {
|
|
105718
|
-
|
|
105719
|
-
const client = await auth.getClobClient();
|
|
105720
|
-
try {
|
|
105721
|
-
const order = await client.getOrder(orderId);
|
|
105722
|
-
return {
|
|
105723
|
-
id: order.id,
|
|
105724
|
-
marketId: order.market || "unknown",
|
|
105725
|
-
outcomeId: order.asset_id,
|
|
105726
|
-
side: order.side.toLowerCase(),
|
|
105727
|
-
type: order.order_type === "GTC" ? "limit" : "market",
|
|
105728
|
-
price: parseFloat(order.price),
|
|
105729
|
-
amount: parseFloat(order.original_size),
|
|
105730
|
-
status: order.status,
|
|
105731
|
-
// Needs precise mapping
|
|
105732
|
-
filled: parseFloat(order.size_matched),
|
|
105733
|
-
remaining: parseFloat(order.original_size) - parseFloat(order.size_matched),
|
|
105734
|
-
timestamp: order.created_at * 1e3
|
|
105735
|
-
};
|
|
105736
|
-
} catch (error) {
|
|
105737
|
-
throw error;
|
|
105738
|
-
}
|
|
105832
|
+
throw new Error("Limitless: fetchOrder(id) is not supported directly. Use fetchOpenOrders(marketSlug).");
|
|
105739
105833
|
}
|
|
105740
105834
|
async fetchOpenOrders(marketId) {
|
|
105741
|
-
const
|
|
105742
|
-
const client = await auth.getClobClient();
|
|
105835
|
+
const client = this.ensureClient();
|
|
105743
105836
|
try {
|
|
105744
|
-
|
|
105745
|
-
|
|
105746
|
-
|
|
105837
|
+
if (!marketId) {
|
|
105838
|
+
console.warn("Limitless: fetchOpenOrders requires marketId (slug) to be efficient. Returning [].");
|
|
105839
|
+
return [];
|
|
105840
|
+
}
|
|
105841
|
+
const orders = await client.getOrders(marketId, ["LIVE"]);
|
|
105747
105842
|
return orders.map((o) => ({
|
|
105748
105843
|
id: o.id,
|
|
105749
|
-
marketId
|
|
105750
|
-
outcomeId:
|
|
105844
|
+
marketId,
|
|
105845
|
+
outcomeId: "unknown",
|
|
105846
|
+
// API might not return this in the simplified list, need to check response
|
|
105751
105847
|
side: o.side.toLowerCase(),
|
|
105752
105848
|
type: "limit",
|
|
105753
105849
|
price: parseFloat(o.price),
|
|
105754
|
-
amount: parseFloat(o.
|
|
105850
|
+
amount: parseFloat(o.quantity),
|
|
105755
105851
|
status: "open",
|
|
105756
|
-
filled:
|
|
105757
|
-
|
|
105758
|
-
|
|
105852
|
+
filled: 0,
|
|
105853
|
+
// Need to check if API returns filled amount in this view
|
|
105854
|
+
remaining: parseFloat(o.quantity),
|
|
105855
|
+
timestamp: Date.now()
|
|
105856
|
+
// API doesn't always return TS in summary
|
|
105759
105857
|
}));
|
|
105760
105858
|
} catch (error) {
|
|
105761
105859
|
console.error("Error fetching Limitless open orders:", error.message);
|
|
@@ -105773,30 +105871,20 @@ var require_limitless = __commonJS({
|
|
|
105773
105871
|
try {
|
|
105774
105872
|
const USDC_DECIMALS = 6;
|
|
105775
105873
|
const balRes = await client.getBalanceAllowance({
|
|
105776
|
-
asset_type:
|
|
105874
|
+
asset_type: "COLLATERAL"
|
|
105777
105875
|
});
|
|
105778
105876
|
const rawBalance = parseFloat(balRes.balance);
|
|
105779
105877
|
const total = rawBalance / Math.pow(10, USDC_DECIMALS);
|
|
105780
|
-
const openOrders = await client.getOpenOrders({});
|
|
105781
|
-
let locked = 0;
|
|
105782
|
-
if (openOrders && Array.isArray(openOrders)) {
|
|
105783
|
-
for (const order of openOrders) {
|
|
105784
|
-
if (order.side === clob_client_1.Side.BUY) {
|
|
105785
|
-
const remainingSize = parseFloat(order.original_size) - parseFloat(order.size_matched);
|
|
105786
|
-
const price = parseFloat(order.price);
|
|
105787
|
-
locked += remainingSize * price;
|
|
105788
|
-
}
|
|
105789
|
-
}
|
|
105790
|
-
}
|
|
105791
105878
|
return [{
|
|
105792
105879
|
currency: "USDC",
|
|
105793
105880
|
total,
|
|
105794
|
-
available: total
|
|
105795
|
-
//
|
|
105796
|
-
locked
|
|
105881
|
+
available: total,
|
|
105882
|
+
// Approximate
|
|
105883
|
+
locked: 0
|
|
105797
105884
|
}];
|
|
105798
105885
|
} catch (error) {
|
|
105799
|
-
|
|
105886
|
+
console.warn("fetchBalance failed via CLOB client", error.message);
|
|
105887
|
+
return [{ currency: "USDC", total: 0, available: 0, locked: 0 }];
|
|
105800
105888
|
}
|
|
105801
105889
|
}
|
|
105802
105890
|
async watchOrderBook(id, limit) {
|
|
@@ -106055,9 +106143,9 @@ var require_searchMarkets3 = __commonJS({
|
|
|
106055
106143
|
exports2.searchMarkets = searchMarkets;
|
|
106056
106144
|
var fetchMarkets_1 = require_fetchMarkets3();
|
|
106057
106145
|
async function searchMarkets(query, params) {
|
|
106058
|
-
const
|
|
106146
|
+
const searchLimit = 5e3;
|
|
106059
106147
|
try {
|
|
106060
|
-
const markets = await (0, fetchMarkets_1.fetchMarkets)({ ...params, limit:
|
|
106148
|
+
const markets = await (0, fetchMarkets_1.fetchMarkets)({ ...params, limit: searchLimit });
|
|
106061
106149
|
const lowerQuery = query.toLowerCase();
|
|
106062
106150
|
const searchIn = params?.searchIn || "title";
|
|
106063
106151
|
const filtered = markets.filter((market) => {
|
|
@@ -106796,6 +106884,9 @@ var require_kalshi = __commonJS({
|
|
|
106796
106884
|
get name() {
|
|
106797
106885
|
return "Kalshi";
|
|
106798
106886
|
}
|
|
106887
|
+
getBaseUrl() {
|
|
106888
|
+
return "https://api.elections.kalshi.com";
|
|
106889
|
+
}
|
|
106799
106890
|
// ----------------------------------------------------------------------------
|
|
106800
106891
|
// Helpers
|
|
106801
106892
|
// ----------------------------------------------------------------------------
|
|
@@ -106835,7 +106926,7 @@ var require_kalshi = __commonJS({
|
|
|
106835
106926
|
async fetchBalance() {
|
|
106836
106927
|
const auth = this.ensureAuth();
|
|
106837
106928
|
const path = "/trade-api/v2/portfolio/balance";
|
|
106838
|
-
const baseUrl =
|
|
106929
|
+
const baseUrl = this.getBaseUrl();
|
|
106839
106930
|
const headers = auth.getHeaders("GET", path);
|
|
106840
106931
|
try {
|
|
106841
106932
|
const response = await axios_1.default.get(`${baseUrl}${path}`, { headers });
|
|
@@ -106863,7 +106954,7 @@ var require_kalshi = __commonJS({
|
|
|
106863
106954
|
async createOrder(params) {
|
|
106864
106955
|
const auth = this.ensureAuth();
|
|
106865
106956
|
const path = "/trade-api/v2/portfolio/orders";
|
|
106866
|
-
const baseUrl =
|
|
106957
|
+
const baseUrl = this.getBaseUrl();
|
|
106867
106958
|
const headers = auth.getHeaders("POST", path);
|
|
106868
106959
|
const isYesSide = params.side === "buy";
|
|
106869
106960
|
const kalshiOrder = {
|
|
@@ -106901,13 +106992,13 @@ var require_kalshi = __commonJS({
|
|
|
106901
106992
|
timestamp: new Date(order.created_time).getTime()
|
|
106902
106993
|
};
|
|
106903
106994
|
} catch (error) {
|
|
106904
|
-
throw error;
|
|
106995
|
+
throw new Error(`${error.response?.data?.error?.message || error.message} (Status: ${error.response?.status} - ${JSON.stringify(error.response?.data || {})})`);
|
|
106905
106996
|
}
|
|
106906
106997
|
}
|
|
106907
106998
|
async cancelOrder(orderId) {
|
|
106908
106999
|
const auth = this.ensureAuth();
|
|
106909
107000
|
const path = `/trade-api/v2/portfolio/orders/${orderId}`;
|
|
106910
|
-
const baseUrl =
|
|
107001
|
+
const baseUrl = this.getBaseUrl();
|
|
106911
107002
|
const headers = auth.getHeaders("DELETE", path);
|
|
106912
107003
|
try {
|
|
106913
107004
|
const response = await axios_1.default.delete(`${baseUrl}${path}`, { headers });
|
|
@@ -106931,7 +107022,7 @@ var require_kalshi = __commonJS({
|
|
|
106931
107022
|
async fetchOrder(orderId) {
|
|
106932
107023
|
const auth = this.ensureAuth();
|
|
106933
107024
|
const path = `/trade-api/v2/portfolio/orders/${orderId}`;
|
|
106934
|
-
const baseUrl =
|
|
107025
|
+
const baseUrl = this.getBaseUrl();
|
|
106935
107026
|
const headers = auth.getHeaders("GET", path);
|
|
106936
107027
|
try {
|
|
106937
107028
|
const response = await axios_1.default.get(`${baseUrl}${path}`, { headers });
|
|
@@ -106960,7 +107051,7 @@ var require_kalshi = __commonJS({
|
|
|
106960
107051
|
if (marketId) {
|
|
106961
107052
|
queryParams += `&ticker=${marketId}`;
|
|
106962
107053
|
}
|
|
106963
|
-
const baseUrl =
|
|
107054
|
+
const baseUrl = this.getBaseUrl();
|
|
106964
107055
|
const headers = auth.getHeaders("GET", basePath);
|
|
106965
107056
|
try {
|
|
106966
107057
|
const response = await axios_1.default.get(`${baseUrl}${basePath}${queryParams}`, { headers });
|
|
@@ -106985,7 +107076,7 @@ var require_kalshi = __commonJS({
|
|
|
106985
107076
|
async fetchPositions() {
|
|
106986
107077
|
const auth = this.ensureAuth();
|
|
106987
107078
|
const path = "/trade-api/v2/portfolio/positions";
|
|
106988
|
-
const baseUrl =
|
|
107079
|
+
const baseUrl = this.getBaseUrl();
|
|
106989
107080
|
const headers = auth.getHeaders("GET", path);
|
|
106990
107081
|
try {
|
|
106991
107082
|
const response = await axios_1.default.get(`${baseUrl}${path}`, { headers });
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price_detailed200_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/get_execution_price_request_args_inner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/search_markets_request_args_inner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pmxt-1.5.1 → pmxt-1.5.4}/generated/pmxt_internal/models/watch_order_book_request_args_inner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|