Update Strategy
Patch one or more editable fields. name is not editable.
Endpoint
PUT /strategies/{strategy_id}
Authentication: Public.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
strategy_id | integer | Yes | DB-assigned id. |
Request body
All fields optional. Any field omitted (or sent as null) is left unchanged on the stored record.
| Field | Type | Notes |
|---|---|---|
author | string | |
description | string | |
entry_condition | string | |
exit_condition | string | |
bot_name | string |
updated_at is bumped automatically by the server on every successful PUT.
Response — 200 OK
The full strategy object after the update:
{
"id": 1,
"name": "btc-momentum-1h",
"author": "alice",
"description": "BTC momentum on 1h — tightened RSI",
"entry_condition": "close > ema(50) AND rsi(14) > 60",
"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-03T12:00:00"
}
Errors
| HTTP | Backend detail | English equivalent |
|---|---|---|
404 | 策略不存在 | Strategy not found |
422 | (FastAPI validation) | Body field has wrong type |
Example
curl -X PUT "https://api.pipai.org/strategies/1" \
-H "Content-Type: application/json" \
-d '{
"description": "BTC momentum on 1h — tightened RSI",
"entry_condition": "close > ema(50) AND rsi(14) > 60"
}'