Skip to content

Commit 7bfbba9

Browse files
committed
fix: sync OpenAPI schema with core types and regenerate SDKs
- Added missing fields to MarketOutcome, UnifiedMarket, OrderBook, and Order schemas - Added metadata support to MarketOutcome to fix TypeError in JS SDK - Synchronized enums (Order status, Trade side) - Regenerated Python and TypeScript SDKs - Rebuilt TypeScript SDK bundle
1 parent 4ded8bf commit 7bfbba9

13 files changed

Lines changed: 226 additions & 4 deletions

File tree

core/src/server/openapi.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,33 @@ components:
532532
type: string
533533
title:
534534
type: string
535+
description:
536+
type: string
535537
outcomes:
536538
type: array
537539
items:
538540
$ref: '#/components/schemas/MarketOutcome'
541+
resolutionDate:
542+
type: string
543+
format: date-time
539544
volume24h:
540545
type: number
546+
volume:
547+
type: number
541548
liquidity:
542549
type: number
550+
openInterest:
551+
type: number
543552
url:
544553
type: string
554+
image:
555+
type: string
556+
category:
557+
type: string
558+
tags:
559+
type: array
560+
items:
561+
type: string
545562

546563
MarketOutcome:
547564
type: object
@@ -552,6 +569,12 @@ components:
552569
type: string
553570
price:
554571
type: number
572+
priceChange24h:
573+
type: number
574+
metadata:
575+
type: object
576+
additionalProperties: true
577+
description: Exchange-specific metadata (e.g., clobTokenId for Polymarket)
555578

556579
PriceCandle:
557580
type: object
@@ -580,6 +603,8 @@ components:
580603
type: array
581604
items:
582605
$ref: '#/components/schemas/OrderLevel'
606+
timestamp:
607+
type: integer
583608

584609
OrderLevel:
585610
type: object
@@ -629,12 +654,15 @@ components:
629654
type: number
630655
status:
631656
type: string
657+
enum: [pending, open, filled, cancelled, rejected]
632658
filled:
633659
type: number
634660
remaining:
635661
type: number
636662
timestamp:
637663
type: integer
664+
fee:
665+
type: number
638666

639667
Position:
640668
type: object

sdks/python/API_REFERENCE.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,17 @@ for pos in positions:
467467
class UnifiedMarket:
468468
id: str #
469469
title: str #
470+
description: str #
470471
outcomes: List[MarketOutcome] #
472+
resolution_date: str #
471473
volume24h: float #
474+
volume: float #
472475
liquidity: float #
476+
open_interest: float #
473477
url: str #
478+
image: str #
479+
category: str #
480+
tags: List[string] #
474481
```
475482

476483
---
@@ -484,6 +491,8 @@ class MarketOutcome:
484491
id: str #
485492
label: str #
486493
price: float #
494+
price_change24h: float #
495+
metadata: object # Exchange-specific metadata (e.g., clobTokenId for Polymarket)
487496
```
488497

489498
---
@@ -512,6 +521,7 @@ volume: float #
512521
class OrderBook:
513522
bids: List[OrderLevel] #
514523
asks: List[OrderLevel] #
524+
timestamp: int #
515525
```
516526

517527
---
@@ -560,6 +570,7 @@ status: str #
560570
filled: float #
561571
remaining: float #
562572
timestamp: int #
573+
fee: float #
563574
```
564575

565576
---
@@ -594,10 +605,35 @@ available: float #
594605
locked: float #
595606
```
596607

608+
---
609+
### `ExchangeCredentials`
610+
611+
Optional authentication credentials for exchange operations
612+
613+
```python
614+
@dataclass
615+
class ExchangeCredentials:
616+
api_key: str # API key for the exchange
617+
private_key: str # Private key for signing transactions
618+
api_secret: str # API secret (if required by exchange)
619+
passphrase: str # Passphrase (if required by exchange)
620+
```
621+
597622
---
598623

599624
## Filter Parameters
600625

626+
### `BaseRequest`
627+
628+
Base request structure with optional credentials
629+
630+
```python
631+
@dataclass
632+
class BaseRequest:
633+
credentials: ExchangeCredentials #
634+
```
635+
636+
---
601637
### `MarketFilterParams`
602638

603639

sdks/typescript/API_REFERENCE.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,17 @@ positions.forEach(pos => {
467467
interface UnifiedMarket {
468468
id: string; //
469469
title: string; //
470+
description: string; //
470471
outcomes: MarketOutcome[]; //
472+
resolutionDate: string; //
471473
volume24h: number; //
474+
volume: number; //
472475
liquidity: number; //
476+
openInterest: number; //
473477
url: string; //
478+
image: string; //
479+
category: string; //
480+
tags: string[]; //
474481
}
475482
```
476483

@@ -484,6 +491,8 @@ interface MarketOutcome {
484491
id: string; //
485492
label: string; //
486493
price: number; //
494+
priceChange24h: number; //
495+
metadata: object; // Exchange-specific metadata (e.g., clobTokenId for Polymarket)
487496
}
488497
```
489498

@@ -512,6 +521,7 @@ interface PriceCandle {
512521
interface OrderBook {
513522
bids: OrderLevel[]; //
514523
asks: OrderLevel[]; //
524+
timestamp: number; //
515525
}
516526
```
517527

@@ -560,6 +570,7 @@ interface Order {
560570
filled: number; //
561571
remaining: number; //
562572
timestamp: number; //
573+
fee: number; //
563574
}
564575
```
565576

@@ -595,10 +606,35 @@ interface Balance {
595606
}
596607
```
597608

609+
---
610+
### `ExchangeCredentials`
611+
612+
Optional authentication credentials for exchange operations
613+
614+
```typescript
615+
interface ExchangeCredentials {
616+
apiKey: string; // API key for the exchange
617+
privateKey: string; // Private key for signing transactions
618+
apiSecret: string; // API secret (if required by exchange)
619+
passphrase: string; // Passphrase (if required by exchange)
620+
}
621+
```
622+
598623
---
599624

600625
## Filter Parameters
601626

627+
### `BaseRequest`
628+
629+
Base request structure with optional credentials
630+
631+
```typescript
632+
interface BaseRequest {
633+
credentials?: ExchangeCredentials; //
634+
}
635+
```
636+
637+
---
602638
### `MarketFilterParams`
603639

604640

sdks/typescript/generated/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pmxtjs@0.5.0
1+
# pmxtjs@1.0.0-b4
22

33
A TypeScript SDK client for the localhost API.
44

@@ -120,7 +120,7 @@ and is automatically generated by the
120120
[OpenAPI Generator](https://openapi-generator.tech) project:
121121

122122
- API version: `0.4.4`
123-
- Package version: `0.5.0`
123+
- Package version: `1.0.0-b4`
124124
- Generator version: `7.18.0`
125125
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
126126

sdks/typescript/generated/docs/MarketOutcome.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Name | Type
99
`id` | string
1010
`label` | string
1111
`price` | number
12+
`priceChange24h` | number
13+
`metadata` | { [key: string]: any; }
1214

1315
## Example
1416

@@ -20,6 +22,8 @@ const example = {
2022
"id": null,
2123
"label": null,
2224
"price": null,
25+
"priceChange24h": null,
26+
"metadata": null,
2327
} satisfies MarketOutcome
2428

2529
console.log(example)

sdks/typescript/generated/docs/Order.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Name | Type
1717
`filled` | number
1818
`remaining` | number
1919
`timestamp` | number
20+
`fee` | number
2021

2122
## Example
2223

@@ -36,6 +37,7 @@ const example = {
3637
"filled": null,
3738
"remaining": null,
3839
"timestamp": null,
40+
"fee": null,
3941
} satisfies Order
4042

4143
console.log(example)

sdks/typescript/generated/docs/OrderBook.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Name | Type
88
------------ | -------------
99
`bids` | [Array<OrderLevel>](OrderLevel.md)
1010
`asks` | [Array<OrderLevel>](OrderLevel.md)
11+
`timestamp` | number
1112

1213
## Example
1314

@@ -18,6 +19,7 @@ import type { OrderBook } from 'pmxtjs'
1819
const example = {
1920
"bids": null,
2021
"asks": null,
22+
"timestamp": null,
2123
} satisfies OrderBook
2224

2325
console.log(example)

sdks/typescript/generated/docs/UnifiedMarket.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ Name | Type
88
------------ | -------------
99
`id` | string
1010
`title` | string
11+
`description` | string
1112
`outcomes` | [Array<MarketOutcome>](MarketOutcome.md)
13+
`resolutionDate` | Date
1214
`volume24h` | number
15+
`volume` | number
1316
`liquidity` | number
17+
`openInterest` | number
1418
`url` | string
19+
`image` | string
20+
`category` | string
21+
`tags` | Array<string>
1522

1623
## Example
1724

@@ -22,10 +29,17 @@ import type { UnifiedMarket } from 'pmxtjs'
2229
const example = {
2330
"id": null,
2431
"title": null,
32+
"description": null,
2533
"outcomes": null,
34+
"resolutionDate": null,
2635
"volume24h": null,
36+
"volume": null,
2737
"liquidity": null,
38+
"openInterest": null,
2839
"url": null,
40+
"image": null,
41+
"category": null,
42+
"tags": null,
2943
} satisfies UnifiedMarket
3044

3145
console.log(example)

sdks/typescript/generated/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pmxtjs",
3-
"version": "0.5.0",
3+
"version": "1.0.0-b4",
44
"description": "OpenAPI client for pmxtjs",
55
"author": "OpenAPI-Generator",
66
"repository": {

sdks/typescript/generated/src/models/MarketOutcome.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export interface MarketOutcome {
3737
* @memberof MarketOutcome
3838
*/
3939
price?: number;
40+
/**
41+
*
42+
* @type {number}
43+
* @memberof MarketOutcome
44+
*/
45+
priceChange24h?: number;
46+
/**
47+
* Exchange-specific metadata (e.g., clobTokenId for Polymarket)
48+
* @type {{ [key: string]: any; }}
49+
* @memberof MarketOutcome
50+
*/
51+
metadata?: { [key: string]: any; };
4052
}
4153

4254
/**
@@ -59,6 +71,8 @@ export function MarketOutcomeFromJSONTyped(json: any, ignoreDiscriminator: boole
5971
'id': json['id'] == null ? undefined : json['id'],
6072
'label': json['label'] == null ? undefined : json['label'],
6173
'price': json['price'] == null ? undefined : json['price'],
74+
'priceChange24h': json['priceChange24h'] == null ? undefined : json['priceChange24h'],
75+
'metadata': json['metadata'] == null ? undefined : json['metadata'],
6276
};
6377
}
6478

@@ -76,6 +90,8 @@ export function MarketOutcomeToJSONTyped(value?: MarketOutcome | null, ignoreDis
7690
'id': value['id'],
7791
'label': value['label'],
7892
'price': value['price'],
93+
'priceChange24h': value['priceChange24h'],
94+
'metadata': value['metadata'],
7995
};
8096
}
8197

0 commit comments

Comments
 (0)