Loading...
Loading...
Use to perform market backtests with PlausibleAI Backtester, including symbol discovery, strategy validation, strategy mining, and batch execution.
npx skill4agent add serenorg/seren-skills backtesterhttps://api.serendb.com/publishers/plausibleaiAuthorization: Bearer $SEREN_API_KEYSEREN_API_KEYSEREN_PUBLISHER_BASE_URLhttps://api.serendb.com/publishers/plausibleaiGET /api/markets/typesGET /api/markets/symbolsmarket_typesearchlimitoffsetGET /api/markets/symbols/{symbol}GET /api/backtests/catalogprice_adjustment_modesentry_price_basesididlogicANDPOST /api/backtests/validatePOST /api/backtestsPOST /api/backtests/batchidexpires_atPOST /api/backtests/mine{ "symbol": "BTC-USD" }profit_factorbacktestidexpires_atGET /api/backtests/{id}GET /api/backtests/{id}/trades?limit=&offset=GET /api/backtests/{id}/equity-curve?limit=&offset=reportbenchmarks.buy_and_holdexecution.provider_symboltradestrade_numbersideentry_bar_indexexit_bar_indexentry_dateexit_datepnlduration_barsexit_reasontrades[].exit_reasontake_profitstop_losstrailing_stophighest_high_exitlowest_low_exitexit_signalend_of_dataothercatalog.trade_exit_reasonsequity_curvetrade_numbertradesfirst_entry_signal_atlast_entry_signal_atdiagnostics| Key | Category | Required Params | Optional Params / Notes |
|---|---|---|---|
| trend | | |
| trend | | |
| trend | | — |
| trend | | — |
| trend | | — |
| trend | | Returns +1 (uptrend) or -1 (downtrend); compare against 0 |
| momentum | | |
| momentum | | range 0–100 |
| momentum | | — |
| momentum | | — |
| momentum | | — |
| momentum | | — |
| momentum | | — |
| momentum | | — |
| momentum | | range: -100 to +100 |
| volatility | | source not accepted |
| volatility | | — |
| volatility | | — |
| volatility | | — |
| volatility | | |
| volatility | | — |
| volatility | | — |
| price_action | | |
| price_action | | |
| seasonal | — | Sun=0, Mon=1 … Fri=5, Sat=6; use |
| seasonal | — | 1–31 |
| seasonal | — | 1–5; resets on month change |
| seasonal | — | 1–12 |
| seasonal | — | 1–4 |
periodindicators[].parameters| Field | Type | Required | Notes |
|---|---|---|---|
| | yes | trade direction |
| enum | yes | |
| integer | no | used when any ATR-based entry offset or exit is present; defaults to |
| | no | only valid with |
exitsexit_signal| Field | Type | Mode options | Notes |
|---|---|---|---|
| | | value > 0 |
| | | value > 0 |
| | | value > 0 |
| integer | — | exits after N bars |
| integer | — | exits after N cumulative profitable closes since entry |
| integer | — | exits at the rolling highest high over N bars |
| integer | — | exits at the rolling lowest low over N bars |
| rule set | — | rule-based exit logic that can be combined with price exits |
execution.atr_period20entry_priceentry_mode: next_bar_limitnext_bar_stopexit_signal{
"symbol": "BTC-USD",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_open"
},
"entry": {
"rules": [
{
"id": "golden_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_above",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "golden_cross"
}
},
"exit_signal": {
"rules": [
{
"id": "death_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_below",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "death_cross"
}
}
}stop_losstake_profit{
"symbol": "AAPL",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_open"
},
"entry": {
"rules": [
{
"id": "rsi_oversold",
"lhs": {
"indicator": {
"key": "rsi",
"params": {
"period": 14,
"source": "close"
}
}
},
"operator": "lte",
"rhs": {
"value": 30
}
}
],
"logic": {
"type": "rule",
"id": "rsi_oversold"
}
},
"exits": {
"stop_loss": {
"mode": "percent",
"value": 5
},
"take_profit": {
"mode": "percent",
"value": 10
},
"max_hold_bars": 20
}
}{
"symbol": "BTC-USD",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_stop",
"entry_price": {
"basis": "highest_high",
"lookback": 55,
"offset": {
"mode": "fixed",
"value": 0
}
}
},
"entry": {
"rules": [
{
"id": "above_sma_200",
"lhs": {
"field": "close"
},
"operator": "gte",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "above_sma_200"
}
},
"exits": {
"lowest_low_exit_lookback": 20
}
}SEREN_PUBLISHER_BASE_URL="${SEREN_PUBLISHER_BASE_URL:-https://api.serendb.com/publishers/plausibleai}"
SEREN_API_KEY="${SEREN_API_KEY:?Set SEREN_API_KEY}"-H "Authorization: Bearer $SEREN_API_KEY"curl -sS "$SEREN_PUBLISHER_BASE_URL/api/markets/types" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/markets/symbols?market_type=crypto&search=bitcoin&limit=20" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/markets/symbols/BTC-USD" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/catalog" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/validate" \
-H "Authorization: Bearer $SEREN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"symbol": "BTC-USD",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_open"
},
"entry": {
"rules": [
{
"id": "golden_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_above",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "golden_cross"
}
},
"exit_signal": {
"rules": [
{
"id": "death_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_below",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "death_cross"
}
}
}' | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests" \
-H "Authorization: Bearer $SEREN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"symbol": "BTC-USD",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_open"
},
"entry": {
"rules": [
{
"id": "golden_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_above",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "golden_cross"
}
},
"exit_signal": {
"rules": [
{
"id": "death_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_below",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "death_cross"
}
}
}' | jqPOST /api/backtestsidlinks.full_result_pathidPOST /api/backtestsPOST /api/backtests/minecurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/<BACKTEST_ID>" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/<BACKTEST_ID>/trades" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/<BACKTEST_ID>/trades?limit=100&offset=0" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/<BACKTEST_ID>/equity-curve" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/<BACKTEST_ID>/equity-curve?limit=100&offset=0" \
-H "Authorization: Bearer $SEREN_API_KEY" | jqcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/mine" \
-H "Authorization: Bearer $SEREN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"symbol": "BTC-USD"
}' | jqsymbolsignal_atfitness_metricfitness_valuemined_candidatesactionable_candidatesrankbacktestbacktestidkindcreated_atexpires_atrequestsummarylinks.full_result_pathlinks.trades_pathlinks.equity_curve_pathcurl -sS "$SEREN_PUBLISHER_BASE_URL/api/backtests/batch" \
-H "Authorization: Bearer $SEREN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"requests": [
{
"symbol": "BTC-USD",
"timeframe": "daily",
"start_at": "2020-01-01",
"initial_capital": 100000,
"execution": {
"side": "long",
"entry_mode": "next_bar_open"
},
"entry": {
"rules": [
{
"id": "golden_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_above",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "golden_cross"
}
},
"exit_signal": {
"rules": [
{
"id": "death_cross",
"lhs": {
"indicator": {
"key": "sma",
"params": {
"period": 50,
"source": "close"
}
}
},
"operator": "crosses_below",
"rhs": {
"indicator": {
"key": "sma",
"params": {
"period": 200,
"source": "close"
}
}
}
}
],
"logic": {
"type": "rule",
"id": "death_cross"
}
}
}
]
}' | jqbars_agolhsrhscrosses_abovecrosses_belowgtelteeqnexorcatalog.limits.max_bars_agobars_agoatrperiodsourceatrperiodperiod"negate": truecrosses_abovecrosses_belownegateanyall| Mistake | Fix |
|---|---|
Omitting | Every rule in |
| Guessing indicator defaults | Always provide |
Passing | ATR does not accept source; use |
Using | Use |
| Cross operators need one additional prior bar beyond the indicator lookback |
| Not allowed — cross operators fire on a single bar; their negation fires on ~99% of bars. Use the complementary operator instead |
| Validation error — step must be ≤ max |
| Validation error — short must be < long |
| Both are valid simultaneously; |
| |
| Logic node referencing undefined id | Logic node |
| No signals firing | Check |
POST /api/backtestsPOST /api/backtests/minetradesequity_curve?limit=&offset=tradesequity_curvetradesequity_curvediagnostics