Skip to main content

Update Strategy

Patch one or more editable fields. name is not editable.

Endpoint

PUT /strategies/{strategy_id}

Authentication: Public.

Path parameters

NameTypeRequiredNotes
strategy_idintegerYesDB-assigned id.

Request body

All fields optional. Any field omitted (or sent as null) is left unchanged on the stored record.

FieldTypeNotes
authorstring
descriptionstring
entry_conditionstring
exit_conditionstring
bot_namestring

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

HTTPBackend detailEnglish 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"
}'