Skip to content

Commit 91a6c44

Browse files
authored
fix: remove deprecated endpoints, update existing, add arenas (#131)
# API Documentation Update ## Summary Comprehensive update to API documentation to include new arena and perpetual futures endpoints. ## Changes ### Documentation (recall-docs) - **Added new endpoints**: - Arena endpoints: `GET /api/arenas`, `GET /api/arenas/{id}` - Perpetual futures endpoints: `GET /api/agent/perps/*`, `GET /api/competitions/{id}/perps/*` - Leaderboard: `GET /api/leaderboard` (supports both global and arena-specific queries) - **Removed deprecated endpoints**: `/api/competitions/leaderboard`, `/api/competitions/status`, `/api/competitions/rules`, `/api/competitions/upcoming` - **Updated competition schemas**: Added all arena architecture fields (arenaId, engineId, engineVersion, vips, allowlist, blocklist, participation rules, reward allocations) - **Fixed field naming**: Changed `position` → `rank` throughout for consistency - **Generated new pages**: `arenas.mdx`, `competitions.mdx` (perps only), `leaderboard.mdx` ## Files Changed - `recall-docs/specs/competitions.json` - `recall-docs/docs/reference/endpoints/*.mdx` (10 files regenerated)
1 parent 790d150 commit 91a6c44

13 files changed

Lines changed: 3022 additions & 2628 deletions

File tree

app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export async function POST(request: Request) {
175175

176176
// Parse OpenAI streaming response chunks to extract content
177177
try {
178-
const lines = chunkText.split("\n").filter(line => line.trim());
178+
const lines = chunkText.split("\n").filter((line) => line.trim());
179179
for (const line of lines) {
180180
if (line.startsWith("data: ")) {
181181
const data = line.slice(6);
@@ -203,7 +203,7 @@ export async function POST(request: Request) {
203203
// Create complete conversation history including the assistant's response
204204
const completeMessages = [
205205
...messages,
206-
{ role: "assistant" as const, content: assistantResponse }
206+
{ role: "assistant" as const, content: assistantResponse },
207207
];
208208

209209
// Generate contextual suggestions based on the complete conversation

docs/competitions/build-agent/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: Build your agent
33
description: Learn how to build and develop AI trading agents for Recall competitions
44
---
55

6-
Build powerful AI trading agents using popular frameworks and tools. These guides will help you develop, test, and deploy trading strategies for competition.
6+
Build powerful AI trading agents using popular frameworks and tools. These guides will help you
7+
develop, test, and deploy trading strategies for competition.
78

89
## Building your agent
910

docs/competitions/build-agent/trading.mdx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ The trading simulator enables agent developers to:
2020

2121
## Key features
2222

23-
- Trade [across EVM chains](/competitions/build-agent/trading) (Ethereum, Polygon, Base) and
24-
SVM chains (Solana)
23+
- Trade [across EVM chains](/competitions/build-agent/trading) (Ethereum, Polygon, Base) and SVM
24+
chains (Solana)
2525
- Team [registration](/competitions/register-agent/register) and API key authentication
2626
- [Accurate token prices](/competitions/build-agent/trading) from DexScreener with realistic
2727
slippage
@@ -497,7 +497,9 @@ This will return a JSON object with the trade result:
497497

498498
## Building a self-rebalancing portfolio manager
499499

500-
You've successfully executed your first trade! Now let's take it to the next level by building a sophisticated portfolio manager that automatically rebalances your holdings to maintain target allocations.
500+
You've successfully executed your first trade! Now let's take it to the next level by building a
501+
sophisticated portfolio manager that automatically rebalances your holdings to maintain target
502+
allocations.
501503

502504
### What you'll build
503505

@@ -535,7 +537,7 @@ OPENAI_API_KEY=sk_live_xxx # optional; omit if you don't want AI tuning
535537
```
536538

537539
<Callout type="warning">
538-
Treat your API keys like passwords. **Never** commit them to GitHub or share them in chat.
540+
Treat your API keys like passwords. **Never** commit them to GitHub or share them in chat.
539541
</Callout>
540542

541543
### Define your target allocation
@@ -571,7 +573,8 @@ pip install -r requirements.txt
571573

572574
### Create the portfolio manager
573575

574-
Create `portfolio_manager.py` with the following code. This implementation includes several key improvements over a basic trading bot:
576+
Create `portfolio_manager.py` with the following code. This implementation includes several key
577+
improvements over a basic trading bot:
575578

576579
<Tabs items={["Python"]}>
577580
<Tab>
@@ -828,8 +831,9 @@ if __name__ == "__main__":
828831
<Callout type="warning">
829832
**Time zones**
830833

831-
`schedule.every().day.at("09:00")` runs at server-local time. If your bot is on a VPS,
832-
confirm its timezone or switch to cron + UTC for deterministic timing.
834+
`schedule.every().day.at("09:00")` runs at server-local time. If your bot is on a VPS, confirm its
835+
timezone or switch to cron + UTC for deterministic timing.
836+
833837
</Callout>
834838

835839
### Understanding the rebalancing logic
@@ -839,7 +843,8 @@ The portfolio manager implements a drift-based rebalancing strategy:
839843
1. **Calculate current allocation**: For each token, compute its percentage of total portfolio value
840844
2. **Identify drift**: Compare current allocation to target allocation
841845
3. **Generate orders**: If drift exceeds threshold (2%), create buy/sell orders to restore balance
842-
4. **Execute strategically**: Sell overweight positions first to generate USDC, then buy underweight positions
846+
4. **Execute strategically**: Sell overweight positions first to generate USDC, then buy underweight
847+
positions
843848

844849
**Key design decisions:**
845850

@@ -876,14 +881,18 @@ Console output should look like:
876881
🎯 Rebalance complete!
877882
```
878883

879-
Leave it running, or deploy as a **systemd** service, **Docker container**, or **GitHub Actions** workflow for continuous operation.
884+
Leave it running, or deploy as a **systemd** service, **Docker container**, or **GitHub Actions**
885+
workflow for continuous operation.
880886

881887
### Next steps for your portfolio manager
882888

883-
- **Adjust drift threshold**: 2% is conservative; tighten for passive strategies, loosen for active trading
889+
- **Adjust drift threshold**: 2% is conservative; tighten for passive strategies, loosen for active
890+
trading
884891
- **Customize schedule**: Use `schedule.every(4).hours` for more frequent rebalancing
885-
- **Add risk controls**: Implement stop-loss logic in `compute_orders()` to protect against large drawdowns
886-
- **Use alternative price feeds**: Replace CoinGecko with Chainlink oracles or DEX TWAPs for production
892+
- **Add risk controls**: Implement stop-loss logic in `compute_orders()` to protect against large
893+
drawdowns
894+
- **Use alternative price feeds**: Replace CoinGecko with Chainlink oracles or DEX TWAPs for
895+
production
887896
- **Expand token universe**: Add more tokens to `TOKEN_MAP`, `COINGECKO_IDS`, and your config file
888897
- **Implement backtesting**: Test your strategy against historical data before going live
889898

docs/competitions/register-agent/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
title: Register your agent
3-
description: Get started with Recall competitions by creating your profile and registering your agent
3+
description:
4+
Get started with Recall competitions by creating your profile and registering your agent
45
---
56

6-
To participate in Recall competitions, you need to create a profile, set up your agent, and register for competitions. These guides will walk you through the registration process step by step.
7+
To participate in Recall competitions, you need to create a profile, set up your agent, and register
8+
for competitions. These guides will walk you through the registration process step by step.
79

810
## Registration steps
911

docs/get-started/skill-markets.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ personalized healthcare diagnostics, multilingual content adaptation, supply cha
1414
legal document analysis.
1515

1616
<Callout type="info">
17-
Ready to compete? Check out the [paper trading](/competitions/paper-trading) and [perpetual futures](/competitions/perps-guide) competition guides to get started.
17+
Ready to compete? Check out the [paper trading](/competitions/paper-trading) and [perpetual
18+
futures](/competitions/perps-guide) competition guides to get started.
1819
</Callout>
1920

2021
## How skill markets work

docs/reference/endpoints/agent.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ _openapi:
1111
Retrieve the profile information for the currently authenticated agent and its owner
1212
- content: >-
1313
Update the profile information for the currently authenticated agent (limited fields)
14-
- content: Retrieve all token balances for the authenticated agent
15-
- content: Retrieve the trading history for the authenticated agent
14+
- content: >-
15+
Retrieve all token balances with current prices for the authenticated agent. Only
16+
available during paper trading competitions.
17+
- content: >-
18+
Retrieve the trading history for the authenticated agent. Only available during paper
19+
trading competitions.
1620
- content: >-
1721
Generate a new API key for the authenticated agent (invalidates the current key)
22+
- content: >-
23+
Returns current perpetual futures positions for the authenticated agent in the specified
24+
competition
25+
- content: >-
26+
Returns the perpetual futures account summary including equity, PnL, and statistics
1827
---
1928

2029
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
@@ -27,6 +36,8 @@ _openapi:
2736
{ path: "/api/agent/balances", method: "get" },
2837
{ path: "/api/agent/trades", method: "get" },
2938
{ path: "/api/agent/reset-api-key", method: "post" },
39+
{ path: "/api/agent/perps/positions", method: "get" },
40+
{ path: "/api/agent/perps/account", method: "get" },
3041
]}
3142
webhooks={[]}
3243
hasHead={true}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Arenas
3+
description: Arena endpoints for browsing competition environments
4+
full: true
5+
_openapi:
6+
toc: []
7+
structuredData:
8+
headings: []
9+
contents:
10+
- content: Get paginated list of all arenas with optional name filtering
11+
- content: Get detailed information about a specific arena
12+
---
13+
14+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
15+
16+
<APIPage
17+
document={"specs/competitions.json"}
18+
operations={[
19+
{ path: "/api/arenas", method: "get" },
20+
{ path: "/api/arenas/{id}", method: "get" },
21+
]}
22+
webhooks={[]}
23+
hasHead={true}
24+
/>

docs/reference/endpoints/competition.mdx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@ _openapi:
88
headings: []
99
contents:
1010
- content: Get all competitions
11-
- content: >-
12-
Get the leaderboard for the active competition or a specific competition. Access may be
13-
restricted to administrators only based on environment configuration.
14-
- content: Get the status of the active competition
15-
- content: >-
16-
Get the rules, rate limits, and other configuration details for the competition
17-
- content: Get all competitions that have not started yet (status=PENDING)
1811
- content: >-
1912
Get detailed information about a specific competition including all metadata
2013
- content: >-
2114
Get a list of all agents participating in a specific competition with their scores and
22-
positions
15+
ranks
2316
- content: Register an agent for a pending competition
2417
- content: >
2518
Remove an agent from a competition. Updates the agent's status in the competition to
@@ -31,8 +24,24 @@ _openapi:
3124
Get the competition rules including trading constraints, rate limits, and formulas for a
3225
specific competition
3326
- content: Get the timeline for all agents in a competition
34-
- content: Get all trades for a specific competition
35-
- content: Get all trades for a specific agent in a specific competition
27+
- content: >-
28+
Get all trades for a specific competition. Only available for paper trading competitions.
29+
- content: >-
30+
Get all trades for a specific agent in a specific competition. Only available for paper
31+
trading competitions.
32+
- content: >
33+
Returns the current perpetual futures positions for a specific agent in a specific
34+
competition.
35+
36+
This endpoint is only available for perpetual futures competitions.
37+
- content: >
38+
Returns all perpetual futures positions for a competition with pagination support.
39+
40+
Similar to GET /api/competitions/{id}/trades for paper trading, but for perps positions.
41+
42+
By default returns only open positions. Use status query param to filter.
43+
44+
Includes embedded agent information for each position.
3645
---
3746

3847
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
@@ -41,10 +50,6 @@ _openapi:
4150
document={"specs/competitions.json"}
4251
operations={[
4352
{ path: "/api/competitions", method: "get" },
44-
{ path: "/api/competitions/leaderboard", method: "get" },
45-
{ path: "/api/competitions/status", method: "get" },
46-
{ path: "/api/competitions/rules", method: "get" },
47-
{ path: "/api/competitions/upcoming", method: "get" },
4853
{ path: "/api/competitions/{competitionId}", method: "get" },
4954
{ path: "/api/competitions/{competitionId}/agents", method: "get" },
5055
{ path: "/api/competitions/{competitionId}/agents/{agentId}", method: "post" },
@@ -53,6 +58,8 @@ _openapi:
5358
{ path: "/api/competitions/{competitionId}/timeline", method: "get" },
5459
{ path: "/api/competitions/{competitionId}/trades", method: "get" },
5560
{ path: "/api/competitions/{competitionId}/agents/{agentId}/trades", method: "get" },
61+
{ path: "/api/competitions/{competitionId}/agents/{agentId}/perps/positions", method: "get" },
62+
{ path: "/api/competitions/{competitionId}/perps/all-positions", method: "get" },
5663
]}
5764
webhooks={[]}
5865
hasHead={true}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Leaderboard
3+
description: Global and arena leaderboard endpoints
4+
full: true
5+
_openapi:
6+
method: GET
7+
route: /api/leaderboard
8+
toc: []
9+
structuredData:
10+
headings: []
11+
contents:
12+
- content: >
13+
Get global leaderboard by type or arena-specific leaderboard if arenaId provided.
14+
15+
When arenaId is provided, returns rankings specific to that arena.
16+
17+
When arenaId is omitted, returns global rankings for the specified type.
18+
---
19+
20+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
21+
22+
<APIPage
23+
document={"specs/competitions.json"}
24+
operations={[{ path: "/api/leaderboard", method: "get" }]}
25+
webhooks={[]}
26+
hasHead={true}
27+
/>

docs/reference/endpoints/trade.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ _openapi:
77
structuredData:
88
headings: []
99
contents:
10-
- content: Execute a trade between two tokens
11-
- content: Get a quote for a potential trade between two tokens
10+
- content: >-
11+
Execute a trade between two tokens. Only available during paper trading competitions.
12+
- content: >-
13+
Get a quote for a potential trade between two tokens. Only available during paper trading
14+
competitions.
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

0 commit comments

Comments
 (0)