{
  "serviceId": "backtest-reconcile-v1",
  "displayName": "Backtest Reconcile",
  "description": "Do the claimed backtest numbers follow from the trades? Send a TradingView \"List of trades\" CSV or a JSON trade list with the claimed metrics; get net profit, win rate, profit factor, drawdown and per-trade P&L recomputed, each claim marked MATCH or MISMATCH, and findings such as cost-free backtests. Deterministic, no market data. POST /v1/reconcile.",
  "category": "finance",
  "resourceUrl": "https://agent.pocket.network/v1/backtest-reconcile-v1",
  "priceUsd": "0.005000",
  "priceVersion": 1,
  "rails": [
    {
      "id": "base",
      "network": "eip155:8453",
      "chainId": 8453,
      "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "tokenDecimals": 6,
      "payToAddress": "0xF732ea490c5766071785a2310523f7fA2CEbB829"
    }
  ],
  "paymentNetworks": [
    "eip155:8453",
    "eip155:4217"
  ],
  "paymentProtocols": [
    "x402",
    "mpp"
  ],
  "protocols": [
    "rest"
  ],
  "inputSchema": {
    "type": "object",
    "description": "The body of POST /v1/reconcile, up to 2 MiB. Send trades_csv or trades.",
    "properties": {
      "trades_csv": {
        "type": "string",
        "description": "A TradingView Strategy Tester \"List of trades\" CSV export."
      },
      "trades": {
        "type": "array",
        "description": "The trades as a JSON list, in place of trades_csv.",
        "items": {
          "type": "object",
          "properties": {
            "n": {
              "description": "Trade number."
            },
            "side": {
              "type": "string",
              "enum": [
                "long",
                "short"
              ]
            },
            "entry_time": {
              "type": "string"
            },
            "exit_time": {
              "type": "string"
            },
            "entry_price": {
              "type": "number"
            },
            "exit_price": {
              "type": "number"
            },
            "qty": {
              "type": "number"
            },
            "commission": {
              "type": "number"
            },
            "reported_pnl": {
              "type": "number"
            }
          }
        }
      },
      "initial_capital": {
        "type": "number",
        "description": "Starting capital for the percentage figures."
      },
      "commission": {
        "type": "object",
        "description": "Commission applied to every trade.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "percent",
              "per_contract",
              "cash_per_order"
            ]
          },
          "value": {
            "type": "number"
          }
        }
      },
      "claimed": {
        "type": "object",
        "description": "The claimed metrics to check, any of net_profit, net_profit_pct, gross_profit, gross_loss, total_trades, win_rate, profit_factor, max_drawdown, max_drawdown_pct, avg_trade, largest_win, largest_loss."
      },
      "tolerance_pct": {
        "type": "number",
        "default": 0.5,
        "description": "How far a claim may differ, in percent, and still MATCH."
      },
      "single_position": {
        "type": "boolean",
        "default": true,
        "description": "Flag overlapping trades."
      }
    }
  },
  "outputSchema": {
    "type": "object",
    "description": "POST /v1/reconcile answers a backtest-reconcile/v1 object: verdict, the recomputed metrics, each claim with claimed, recomputed, diff and status, findings with code and severity, counts, and the assumptions used."
  },
  "methods": {
    "GET /v1/health": "read",
    "GET /v1/rules": "read",
    "GET /v1/version": "read",
    "POST /v1/reconcile": "read"
  },
  "firstParty": true,
  "networks": [
    "eip155:8453",
    "eip155:4217"
  ],
  "serving": true,
  "page": "https://agent.pocket.network/services/backtest-reconcile-v1",
  "descriptor": "https://agent.pocket.network/services/backtest-reconcile-v1/descriptor.json"
}