Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 48 additions & 48 deletions core/api-doc-config.generated.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion core/src/BaseExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
MatchResult,
EventMatchResult,
PriceComparison,
CompareMarketPricesParams,
ArbitrageOpportunity,
MatchedMarketPair,
MatchedPricePair,
Expand Down Expand Up @@ -1624,7 +1625,7 @@ export abstract class PredictionMarketExchange {
* @param params - Match filter parameters (uses relation: 'identity' internally)
* @returns Array of price comparisons across venues
*/
async compareMarketPrices(params: FetchMatchesParams): Promise<PriceComparison[]> {
async compareMarketPrices(params: CompareMarketPricesParams): Promise<PriceComparison[]> {
throw new Error("Method compareMarketPrices not implemented.");
}

Expand Down
17 changes: 17 additions & 0 deletions core/src/router/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ export interface ArbitrageOpportunity {
// Param types
// ---------------------------------------------------------------------------


/**
* Parameters for comparing market prices across venues.
*/
export interface CompareMarketPricesParams {
/** The source market ID to compare against. */
marketId: string;
/** Optional list of target market IDs to compare with. If not provided, the router finds matches automatically. */
targetMarketIds?: string[];
/** Minimum price difference to return. */
minDifference?: number;
/** Maximum number of results to return. */
limit?: number;
}



export interface FetchMarketMatchesParams {
/** Keyword search across matched market titles. */
query?: string;
Expand Down
2 changes: 1 addition & 1 deletion core/src/server/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ paths:
type: array
maxItems: 1
items:
$ref: '#/components/schemas/FetchMarketMatchesParams'
type: object
minItems: 1
credentials:
$ref: '#/components/schemas/ExchangeCredentials'
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7043,7 +7043,7 @@
"type": "array",
"maxItems": 1,
"items": {
"$ref": "#/components/schemas/FetchMarketMatchesParams"
"type": "object"
},
"minItems": 1
},
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1172,12 +1172,12 @@ Compare live prices for the same market across venues. Finds identity matches an
**Signature:**

```python
def compare_market_prices(params: FetchMatchesParams) -> List[PriceComparison]:
def compare_market_prices(params: CompareMarketPricesParams) -> List[PriceComparison]:
```

**Parameters:**

- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally)
- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally)

**Returns:** List[[PriceComparison](#pricecomparison)] - Array of price comparisons across venues

Expand Down
30 changes: 4 additions & 26 deletions sdks/python/pmxt/_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ def __init__(
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
# NOTE: Generated wrapper; update the generator template in
# core/scripts/generate-python-exchanges.js in a follow-up.
wallet_address: Optional[str] = None,
signer: Optional[object] = None,
) -> None:
"""
Initialize Polymarket client.
Expand All @@ -39,8 +35,6 @@ def __init__(
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: Ethereum address for hosted reads/writes (optional)
signer: Optional callable for signing typed_data (optional)
"""
super().__init__(
exchange_name="polymarket",
Expand All @@ -51,8 +45,6 @@ def __init__(
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
wallet_address=wallet_address,
signer=signer,
)

self.api_secret = api_secret
Expand Down Expand Up @@ -84,8 +76,6 @@ def __init__(
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
wallet_address: Optional[str] = None,
signer: Optional[object] = None,
) -> None:
"""
Initialize Limitless client.
Expand All @@ -98,8 +88,6 @@ def __init__(
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: Ethereum address for hosted reads/writes (optional)
signer: Optional callable for signing typed_data (optional)
"""
super().__init__(
exchange_name="limitless",
Expand All @@ -108,8 +96,6 @@ def __init__(
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
wallet_address=wallet_address,
signer=signer,
)

self.api_secret = api_secret
Expand Down Expand Up @@ -284,7 +270,7 @@ def __init__(
super().__init__(
exchange_name="myriad",
api_key=api_key,
wallet_address=wallet_address,
private_key=wallet_address,
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
Expand All @@ -302,10 +288,6 @@ def __init__(
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
# NOTE: Generated wrapper; update the generator template in
# core/scripts/generate-python-exchanges.js in a follow-up.
wallet_address: Optional[str] = None,
signer: Optional[object] = None,
) -> None:
"""
Initialize Opinion client.
Expand All @@ -317,8 +299,6 @@ def __init__(
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: Ethereum address for hosted reads/writes (optional)
signer: Optional callable for signing typed_data (optional)
"""
super().__init__(
exchange_name="opinion",
Expand All @@ -328,8 +308,6 @@ def __init__(
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
wallet_address=wallet_address,
signer=signer,
)


Expand Down Expand Up @@ -522,6 +500,7 @@ class Rain(Exchange):

def __init__(
self,
private_key: Optional[str] = None,
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
Expand All @@ -530,12 +509,14 @@ def __init__(
Initialize Rain client.

Args:
private_key: Private key for authentication (optional)
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
"""
super().__init__(
exchange_name="rain",
private_key=private_key,
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
Expand All @@ -551,7 +532,6 @@ def __init__(
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
wallet_address: Optional[str] = None,
) -> None:
"""
Initialize Hunch client.
Expand All @@ -561,15 +541,13 @@ def __init__(
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: EVM wallet address used for hosted reads/writes
"""
super().__init__(
exchange_name="hunch",
private_key=private_key,
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
wallet_address=wallet_address,
)


Expand Down
4 changes: 2 additions & 2 deletions sdks/typescript/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1174,12 +1174,12 @@ Compare live prices for the same market across venues. Finds identity matches an
**Signature:**

```typescript
async compareMarketPrices(params: FetchMatchesParams): Promise<PriceComparison[]>
async compareMarketPrices(params: CompareMarketPricesParams): Promise<PriceComparison[]>
```

**Parameters:**

- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally)
- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally)

**Returns:** Promise<[PriceComparison](#pricecomparison)[]> - Array of price comparisons across venues

Expand Down
16 changes: 8 additions & 8 deletions sdks/typescript/pmxt/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ export abstract class Exchange {
}
}

async fetchMarketMatches(params?: any): Promise<any[]> {
async fetchMarketMatches(params?: FetchMarketMatchesParams): Promise<MatchResult[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1647,7 +1647,7 @@ export abstract class Exchange {
}
}

async fetchMatches(params: any): Promise<any[]> {
async fetchMatches(params: any): Promise<MatchResult[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1672,7 +1672,7 @@ export abstract class Exchange {
}
}

async fetchEventMatches(params?: any): Promise<any[]> {
async fetchEventMatches(params?: FetchEventMatchesParams): Promise<EventMatchResult[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1697,7 +1697,7 @@ export abstract class Exchange {
}
}

async compareMarketPrices(params: any): Promise<any[]> {
async compareMarketPrices(params: CompareMarketPricesParams): Promise<PriceComparison[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1722,7 +1722,7 @@ export abstract class Exchange {
}
}

async fetchRelatedMarkets(params: any): Promise<any[]> {
async fetchRelatedMarkets(params: any): Promise<PriceComparison[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand Down Expand Up @@ -1772,7 +1772,7 @@ export abstract class Exchange {
}
}

async fetchMatchedPrices(params?: any): Promise<any[]> {
async fetchMatchedPrices(params?: FetchMatchedPricesParams): Promise<any[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1797,7 +1797,7 @@ export abstract class Exchange {
}
}

async fetchHedges(params: any): Promise<any[]> {
async fetchHedges(params: any): Promise<PriceComparison[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand All @@ -1822,7 +1822,7 @@ export abstract class Exchange {
}
}

async fetchArbitrage(params?: any): Promise<any[]> {
async fetchArbitrage(params?: FetchArbitrageParams): Promise<ArbitrageOpportunity[]> {
await this.initPromise;
try {
const args: any[] = [];
Expand Down
15 changes: 15 additions & 0 deletions sdks/typescript/scripts/generate-client-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ const TYPE_MAP = {
PriceCandle: { converter: 'convertCandle' },
// Pagination wrapper — gets its own response handler
PaginatedMarketsResult: { converter: null, pattern: 'paginatedMarkets' },

MatchResult: { converter: null, pattern: 'raw' },
EventMatchResult: { converter: null, pattern: 'raw' },
PriceComparison: { converter: null, pattern: 'raw' },
ArbitrageOpportunity: { converter: null, pattern: 'raw' },
PaginatedEventsResult: { converter: null, pattern: 'paginatedEvents' },
};

Expand All @@ -101,6 +106,16 @@ const SDK_PARAM_TYPES = new Set([
'MyTradesParams', 'OrderHistoryParams', 'CreateOrderParams',
'MarketFilterCriteria', 'EventFilterCriteria',
'SubscriptionOption',

'FetchMarketMatchesParams',
'FetchEventMatchesParams',
'CompareMarketPricesParams',
'FetchMatchedPricesParams',
'FetchArbitrageParams',
'MatchResult',
'EventMatchResult',
'PriceComparison',
'ArbitrageOpportunity',
]);

// Parameter names that represent outcome IDs and should accept MarketOutcome.
Expand Down
Loading