Create Strategy
Register a new strategy. The platform stores metadata only — no execution side effects.
Endpoint
POST /strategies
Authentication: Public.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Unique label across the platform. |
author | string | No | Free-form. |
description | string | No | Free-form. |
entry_condition | string | No | Free-form. Stored as an opaque string. |
exit_condition | string | No | Free-form. |
bot_name | string | No | Executor reference key. |
Response — 200 OK
{
"id": 1,
"name": "btc-momentum-1h",
"author": "alice",
"description": "BTC momentum on 1h candles",
"entry_condition": "close > ema(50) AND rsi(14) > 55",
"exit_condition": "close < ema(50) OR rsi(14) < 45",
"bot_name": "executor-momentum-v1",
"created_at": "2026-05-03T10:00:00",
"updated_at": "2026-05-03T10:00:00"
}
Errors
| HTTP | Backend detail | English equivalent |
|---|---|---|
400 | 策略 <name> 已存在 | Strategy <name> already exists |
422 | (FastAPI validation) | Missing or wrong-typed name |
500 | (varies) | Unhandled server error |
Example
curl -X POST "https://api.pipai.org/strategies" \
-H "Content-Type: application/json" \
-d '{
"name": "btc-momentum-1h",
"author": "alice",
"description": "BTC momentum on 1h candles",
"entry_condition": "close > ema(50) AND rsi(14) > 55",
"exit_condition": "close < ema(50) OR rsi(14) < 45",
"bot_name": "executor-momentum-v1"
}'