You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: unified market discovery with browse, search, and pagination
Refactor market reference discovery to support both search and browse
modes with server-side pagination across all market adapters.
Markets:
- Polymarket: add browse support with sort options (volume, liquidity,
newest, ending soon), paginated search, and structured reference
results with price/volume/liquidity/endDate metadata
- Hyperliquid: add browse support sorted by volume, paginated results,
and unified reference result format
- Extend MarketAdapter interface with browseReferences(), browseOptions,
and pagination (limit/offset) for both search and browse
API:
- Add GET /markets/:id/browse endpoint with sort/limit/offset params
- Update search endpoint to support limit/offset pagination
- Rename 'symbol' to 'reference' throughout order placement pipeline
Core:
- Update schemas to use 'reference' instead of 'symbol' in order inputs
- Add BrowseOption and pagination types to market adapter interface
Web UI:
- Redesign MarketSearchPanel with tabbed browse/search, sort controls,
stat grid cards with price/volume/liquidity/endDate, hover glow
effects, and load-more pagination
- Add market card animations (card-glow-pulse, radial hover gradient)
- Update TradeTicketCard and PortfolioPanels styling
- Add items-start to grid layout to prevent column stretching
Docs:
- Update README, admin guide, API reference, architecture, testing,
trading agent, and trading model docs to reflect new discovery model
-**Decision transparency** — every action requires reasoning; journal + timeline for full audit trail
@@ -56,19 +56,19 @@ You can start from [.env.example](.env.example).
56
56
57
57
### Trading Constraints
58
58
59
-
Order payload `quantity` is decimal-capable at schema layer, then validated per market/symbol.
59
+
Order payload `quantity` is decimal-capable at schema layer, then validated per market/reference.
60
60
61
61
Discover constraints before placing orders:
62
62
63
63
```bash
64
-
GET /api/markets/:market/trading-constraints?symbol=<symbol>
64
+
GET /api/markets/:market/trading-constraints?reference=<reference>
65
65
```
66
66
67
67
Example response:
68
68
69
69
```json
70
70
{
71
-
"symbol": "BTC",
71
+
"reference": "BTC",
72
72
"constraints": {
73
73
"minQuantity": 0.00001,
74
74
"quantityStep": 0.00001,
@@ -80,7 +80,28 @@ Example response:
80
80
81
81
Notes:
82
82
- Some markets require integer quantities (`supportsFractional: false`, usually `quantityStep: 1`).
83
-
- Hyperliquid derives `quantityStep` and fractional support from `szDecimals`, and enforces symbol `maxLeverage`.
83
+
- Search and browse surfaces now return lightweight market references. Execution endpoints (`quote`, `orderbook`, `resolve`, order placement) accept those references directly.
84
+
- Discovery is intentionally separate from execution: `browse` and `search` help humans and agents find candidates quickly, then adapters lazily normalize the chosen `reference` only when a quote or order is requested.
85
+
- For Polymarket, discovery references are typically market slugs. The adapter resolves those slugs into outcome token ids behind the scenes when you ask for quotes or place orders.
86
+
- Hyperliquid derives `quantityStep` and fractional support from `szDecimals`, and enforces per-reference `maxLeverage`.
87
+
- Browse sort options are market-specific and discoverable from `GET /api/markets`. Polymarket exposes `volume`, `liquidity`, `endingSoon`, and `newest`; Hyperliquid exposes `price`.
88
+
89
+
### Market Discovery
90
+
91
+
Typical discovery flow:
92
+
93
+
```bash
94
+
GET /api/markets
95
+
GET /api/markets/:market/browse?sort=<market-specific-sort>
96
+
GET /api/markets/:market/search?q=iran
97
+
GET /api/markets/:market/quote?reference=<reference>
98
+
POST /api/orders
99
+
```
100
+
101
+
The platform now treats `reference` as the single external identifier across markets:
102
+
- Polymarket: usually a slug during discovery, resolved lazily to a token id for execution
103
+
- Hyperliquid: usually a ticker such as `BTC`
104
+
- Future markets: whatever adapter-specific identifier makes the most sense externally
- both endpoints return lightweight discovery records shaped like:
109
+
110
+
```json
111
+
{
112
+
"reference": "btc",
113
+
"name": "BTC-PERP",
114
+
"price": 94321.1,
115
+
"volume": 12003455.2,
116
+
"liquidity": 882100.4,
117
+
"endDate": null,
118
+
"metadata": {}
119
+
}
120
+
```
121
+
122
+
- discovery results are not required to be execution-ready exchange ids
123
+
- adapters normalize the supplied `reference` lazily when `quote`, `orderbook`, `resolve`, or order placement is called
124
+
99
125
### Trading constraints response
100
126
101
127
Example:
102
128
103
129
```json
104
130
{
105
-
"symbol": "BTC",
131
+
"reference": "BTC",
106
132
"constraints": {
107
133
"minQuantity": 0.00001,
108
134
"quantityStep": 0.00001,
@@ -156,6 +182,9 @@ The structured liquidation event includes:
156
182
-`cancelledReduceOnlyOrderIds`
157
183
-`liquidatedAt`
158
184
185
+
Note:
186
+
- timeline and settlement/liquidation audit surfaces still expose internal normalized `symbol` fields because accounting is stored against resolved execution identifiers
187
+
159
188
## Admin API
160
189
161
190
The full operator workflow is documented in [Admin Guide](admin-guide.md). The main admin-only endpoints are:
0 commit comments