Market Backtest
by FiatDock in Markets & finance
Backtest a stated trading rule on a crypto asset's daily USD closes (Coinbase Exchange) and compare it with buying and holding: SMA crossover, RSI mean reversion, DCA or buy-and-hold, 30-365 days, with fees. Returns total return, drawdown, Sharpe, win rate, exposure, every trade and the equity curve; the rules are published in every answer. Send {} for BTC, SMA 20/50, 180 days. A test of the past, not advice. Pay-per-call via x402.
https://fiatdock.com/v1/market/backtest- Price
- $0.009
- per call in USDC
- Uptime
- 98.0%
- last 30 days
- Response time
- 202 ms
- 311 ms slowest 5%
- Last check
- Passed
- 2 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://fiatdock.com/v1/market/backtest
Each call costs $0.009 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://fiatdock.com/v1/market/backtest
content-type: application/json
{
"asset": "BTC",
"days": 180,
"fast": 20,
"slow": 50,
"strategy": "sma_cross"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
asset | string | No | Crypto asset ticker with a USD market on Coinbase Exchange (BTC, ETH, SOL, …). Default BTC |
capitalUsd | number | No | Starting capital in USD, 10-10000000 (default 1000) |
days | integer | No | Length of the tested window in days, 30-365 (default 180) |
dcaEveryDays | integer | No | dca: days between purchases, 1-30 (default 7) |
fast | integer | No | sma_cross: fast moving-average length in days, 2-100 (default 20) |
feeBps | number | No | Fee on every trade in basis points, 0-100 (default 10 = 0.1%) |
rsiBuy | number | No | rsi_reversion: buy when RSI falls below this, 1-50 (default 30) |
rsiPeriod | integer | No | rsi_reversion: RSI length in days, 2-50 (default 14) |
rsiSell | number | No | rsi_reversion: sell when RSI rises above this, 50-99 (default 70) |
slow | integer | No | sma_cross: slow moving-average length in days, 3-200, longer than fast (default 50) |
strategy | string | No | sma_cross (long while the fast moving average is above the slow one), rsi_reversion (buy when RSI falls below rsiBuy, sell when it rises above rsiSell), dca (buy a fixed amount every dcaEveryDays), buy_and_hold. Default sma_cross One of: sma_cross, rsi_reversion, dca, buy_and_hold. |
Example response
The provider's example. We can't check it without paying. Shortened for display.
Example response, 80 lines
{
"asOf": "2026-10-16T13:21:41.862Z",
"asset": "BTC",
"buyAndHoldReturnPct": 11.25,
"endPriceUsd": 82131.46,
"equityCurve": [
{
"date": "2026-04-19",
"equityUsd": 999,
"priceUsd": 73823.14
},
{
"date": "2026-05-25",
"equityUsd": 1045.36,
"priceUsd": 77249.07
},
{
"date": "2026-06-30",
"equityUsd": 994.65,
"priceUsd": 58523.93
},
{
"date": "2026-08-05",
"equityUsd": 965.07,
"priceUsd": 64603.03
},
{
"date": "2026-09-10",
"equityUsd": 1143.34,
"priceUsd": 76536.55
},
{
"date": "2026-10-15",
"equityUsd": 1226.92,
"priceUsd": 82131.46
}
],
"exposurePct": 71.7,
"finalEquityUsd": 1226.92,
"market": "BTC-USD",
"maxDrawdownPct": 15.71,
"method": "Daily USD closes of completed UTC days (Coinbase Exchange). A signal formed at a day's close is executed at the next day's close (no look-ahead); buy_and_hold buys at the first close and dca buys every dcaEveryDays from the first close. Long or flat only, no leverage, no slippage or funding; a fee of feeBps on every trade's notional. sma_cross: long while the fast simple moving average is above the slow one. rsi_reversion: Wilder RSI, seeded with the simple average of the first rsiPeriod changes of a warm-up of 10 x rsiPeriod days before the window, with the long/flat state carried through the warm-up; buy when it falls below rsiBuy, sell when it rises above rsiSell. dca: capitalUsd split into equal purchases, one every dcaEveryDays from the first close (floor((days - 1) / dcaEveryDays) + 1 of them). sma_cross reads the slow average's length of history before the window. A window with a missing day, or a market with no close in the last 3 days, is refused, never filled in. totalReturn…",
"note": "A test of a stated rule on past prices — not a forecast and not investment advice. Results ignore slippage, taxes and funding; a different window can give the opposite result.",
"params": {
"capitalUsd": 1000,
"days": 180,
"fast": 20,
"feeBps": 10,
"slow": 50
},
"period": {
"days": 180,
"from": "2026-04-19",
"to": "2026-10-15"
},
"sharpe": 1.54,
"source": "Coinbase Exchange daily candles (api.exchange.coinbase.com)",
"startPriceUsd": 73823.14,
"strategy": "sma_cross",
"totalReturnPct": 22.69,
"tradeList": [
{
"date": "2026-04-19",
"priceUsd": 73823.14,
"side": "buy"
},
{
"date": "2026-05-31",
"priceUsd": 73575.17,
"side": "sell"
},
{
"date": "2026-07-21",
"priceUsd": 66516.18,
"side": "buy"
}
],
"trades": 3,
"winRatePct": 0
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.009.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://fiatdock.com/v1/market/backtest' \
-H 'content-type: application/json' \
--data-raw '{"asset":"BTC","days":180,"fast":20,"slow":50,"strategy":"sma_cross"}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://fiatdock.com/v1/market/backtest' \
-H 'content-type: application/json' \
--data-raw '{"asset":"BTC","days":180,"fast":20,"slow":50,"strategy":"sma_cross"}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.009 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.009" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.009 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Ffiatdock.com%2Fv1%2Fmarket%2Fbacktest&method=POST
const res = await pay("https://fiatdock.com/v1/market/backtest", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"asset": "BTC",
"days": 180,
"fast": 20,
"slow": 50,
"strategy": "sma_cross"
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.009 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.009"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://fiatdock.com/v1/market/backtest",
json={
"asset": "BTC",
"days": 180,
"fast": 20,
"slow": 50,
"strategy": "sma_cross",
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 2 h ago | Passed | 402 | 214 ms | $0.009 |
| 12 h ago | Passed | 402 | 439 ms | $0.009 |
| 32 h ago | Timed out | - | - | - |
| 4 days ago | Timed out | - | - | - |
| 4 days ago | Passed | 402 | 250 ms | $0.009 |
Show 10 older checks
| 5 days ago | Passed | 402 | 208 ms | $0.009 |
| 5 days ago | Passed | 402 | 238 ms | $0.009 |
| 6 days ago | Passed | 402 | 287 ms | $0.009 |
| 6 days ago | Passed | 402 | 1.2 s | $0.009 |
| 6 days ago | Passed | 402 | 202 ms | $0.009 |
| 7 days ago | Passed | 402 | 239 ms | $0.009 |
| 7 days ago | Passed | 402 | 218 ms | $0.009 |
| 7 days ago | Passed | 402 | 235 ms | $0.009 |
| 8 days ago | Passed | 402 | 191 ms | $0.009 |
| 8 days ago | Passed | 402 | 204 ms | $0.009 |