{
  "x402Version": 2,
  "id": 33405,
  "slug": "33405",
  "resource": "https://api.edifiedlab.com/v1/market/pnl-stats",
  "description": "Compute trade P&L statistics from caller-supplied realized P&L values: win rate, profit factor, max drawdown, and rolling-window statistics. No market data or account access -- purely a function of the numbers supplied.",
  "type": "http",
  "serviceName": "P&L Stats Calculator",
  "resourceType": "Security",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x5037546753d64F77A6fA95B6f85659B6a4A7F6FD",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "11000",
      "amountUsd": 0.011,
      "maxTimeoutSeconds": 600
    }
  ],
  "outputSchema": {
    "properties": {
      "example": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "const": "calculate",
            "type": "string"
          },
          "avg_loss": {
            "type": "number"
          },
          "avg_win": {
            "type": "number"
          },
          "expectancy": {
            "type": "number"
          },
          "expectancy_pvalue": {
            "type": "number"
          },
          "expectancy_pvalue_method": {
            "const": "student_t_two_sided",
            "type": "string"
          },
          "expectancy_pvalue_sample_size": {
            "minimum": 1,
            "type": "integer"
          },
          "kelly": {
            "type": "number"
          },
          "longest_loss_streak": {
            "type": "integer"
          },
          "max_drawdown": {
            "type": "number"
          },
          "n": {
            "type": "integer"
          },
          "payload": {
            "const": "pnl_stats",
            "type": "string"
          },
          "profit_factor": {
            "type": [
              "number",
              "null"
            ]
          },
          "rolling_expectancy": {
            "type": "number"
          },
          "rolling_kelly": {
            "type": "number"
          },
          "rolling_n": {
            "type": "integer"
          },
          "rolling_win_rate": {
            "type": "number"
          },
          "trailing_loss_streak": {
            "type": "integer"
          },
          "win_rate": {
            "type": "number"
          }
        },
        "required": [
          "payload",
          "action",
          "n",
          "win_rate",
          "avg_win",
          "avg_loss",
          "expectancy",
          "profit_factor",
          "max_drawdown",
          "longest_loss_streak",
          "trailing_loss_streak",
          "kelly",
          "rolling_n",
          "rolling_expectancy",
          "rolling_win_rate",
          "rolling_kelly",
          "expectancy_pvalue",
          "expectancy_pvalue_sample_size",
          "expectancy_pvalue_method"
        ],
        "type": "object"
      },
      "type": {
        "type": "string"
      }
    },
    "required": [
      "type"
    ],
    "type": "object"
  },
  "extensions": {
    "bazaar": {
      "info": {
        "input": {
          "body": {
            "pnls": [
              120.5,
              -45,
              300.25
            ],
            "rolling_window": 20
          },
          "bodyType": "json",
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "action": "calculate",
            "avg_loss": 1,
            "avg_win": 2.5,
            "expectancy": 1.333333,
            "expectancy_pvalue": 0.133629,
            "expectancy_pvalue_method": "student_t_two_sided",
            "expectancy_pvalue_sample_size": 3,
            "kelly": 0.533333,
            "longest_loss_streak": 1,
            "max_drawdown": 1,
            "n": 3,
            "payload": "pnl_stats",
            "profit_factor": 5,
            "rolling_expectancy": 1,
            "rolling_kelly": 0.333333,
            "rolling_n": 2,
            "rolling_win_rate": 0.5,
            "trailing_loss_streak": 0,
            "win_rate": 0.667
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "additionalProperties": false,
                "properties": {
                  "pnls": {
                    "items": {
                      "maximum": 1e+150,
                      "minimum": -1e+150,
                      "type": "number"
                    },
                    "maxItems": 5000,
                    "minItems": 1,
                    "type": "array"
                  },
                  "rolling_window": {
                    "default": 20,
                    "maximum": 5000,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "pnls"
                ],
                "type": "object"
              },
              "bodyType": {
                "enum": [
                  "json",
                  "form-data",
                  "text"
                ],
                "type": "string"
              },
              "method": {
                "enum": [
                  "POST",
                  "PUT",
                  "PATCH"
                ],
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "method",
              "bodyType",
              "body"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "const": "calculate",
                    "type": "string"
                  },
                  "avg_loss": {
                    "type": "number"
                  },
                  "avg_win": {
                    "type": "number"
                  },
                  "expectancy": {
                    "type": "number"
                  },
                  "expectancy_pvalue": {
                    "type": "number"
                  },
                  "expectancy_pvalue_method": {
                    "const": "student_t_two_sided",
                    "type": "string"
                  },
                  "expectancy_pvalue_sample_size": {
                    "minimum": 1,
                    "type": "integer"
                  },
                  "kelly": {
                    "type": "number"
                  },
                  "longest_loss_streak": {
                    "type": "integer"
                  },
                  "max_drawdown": {
                    "type": "number"
                  },
                  "n": {
                    "type": "integer"
                  },
                  "payload": {
                    "const": "pnl_stats",
                    "type": "string"
                  },
                  "profit_factor": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "rolling_expectancy": {
                    "type": "number"
                  },
                  "rolling_kelly": {
                    "type": "number"
                  },
                  "rolling_n": {
                    "type": "integer"
                  },
                  "rolling_win_rate": {
                    "type": "number"
                  },
                  "trailing_loss_streak": {
                    "type": "integer"
                  },
                  "win_rate": {
                    "type": "number"
                  }
                },
                "required": [
                  "payload",
                  "action",
                  "n",
                  "win_rate",
                  "avg_win",
                  "avg_loss",
                  "expectancy",
                  "profit_factor",
                  "max_drawdown",
                  "longest_loss_streak",
                  "trailing_loss_streak",
                  "kelly",
                  "rolling_n",
                  "rolling_expectancy",
                  "rolling_win_rate",
                  "rolling_kelly",
                  "expectancy_pvalue",
                  "expectancy_pvalue_sample_size",
                  "expectancy_pvalue_method"
                ],
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "finance",
    "statistics",
    "pnl",
    "risk",
    "x402",
    "bazaar"
  ],
  "sourceHost": "api.edifiedlab.com",
  "lastUpdated": "2026-09-19T15:31:46.277Z",
  "quality": {
    "calls30d": 1,
    "uniquePayers30d": 1,
    "lastCalledAt": "2026-09-19T15:31:46.017Z"
  },
  "metadata": {
    "serviceName": "P&L Stats Calculator",
    "extensions": {
      "bazaar": {
        "info": {
          "input": {
            "body": {
              "pnls": [
                120.5,
                -45,
                300.25
              ],
              "rolling_window": 20
            },
            "bodyType": "json",
            "method": "POST",
            "type": "http"
          },
          "output": {
            "example": {
              "action": "calculate",
              "avg_loss": 1,
              "avg_win": 2.5,
              "expectancy": 1.333333,
              "expectancy_pvalue": 0.133629,
              "expectancy_pvalue_method": "student_t_two_sided",
              "expectancy_pvalue_sample_size": 3,
              "kelly": 0.533333,
              "longest_loss_streak": 1,
              "max_drawdown": 1,
              "n": 3,
              "payload": "pnl_stats",
              "profit_factor": 5,
              "rolling_expectancy": 1,
              "rolling_kelly": 0.333333,
              "rolling_n": 2,
              "rolling_win_rate": 0.5,
              "trailing_loss_streak": 0,
              "win_rate": 0.667
            },
            "type": "json"
          }
        },
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "properties": {
            "input": {
              "additionalProperties": false,
              "properties": {
                "body": {
                  "additionalProperties": false,
                  "properties": {
                    "pnls": {
                      "items": {
                        "maximum": 1e+150,
                        "minimum": -1e+150,
                        "type": "number"
                      },
                      "maxItems": 5000,
                      "minItems": 1,
                      "type": "array"
                    },
                    "rolling_window": {
                      "default": 20,
                      "maximum": 5000,
                      "minimum": 1,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "pnls"
                  ],
                  "type": "object"
                },
                "bodyType": {
                  "enum": [
                    "json",
                    "form-data",
                    "text"
                  ],
                  "type": "string"
                },
                "method": {
                  "enum": [
                    "POST",
                    "PUT",
                    "PATCH"
                  ],
                  "type": "string"
                },
                "type": {
                  "const": "http",
                  "type": "string"
                }
              },
              "required": [
                "type",
                "method",
                "bodyType",
                "body"
              ],
              "type": "object"
            },
            "output": {
              "properties": {
                "example": {
                  "additionalProperties": false,
                  "properties": {
                    "action": {
                      "const": "calculate",
                      "type": "string"
                    },
                    "avg_loss": {
                      "type": "number"
                    },
                    "avg_win": {
                      "type": "number"
                    },
                    "expectancy": {
                      "type": "number"
                    },
                    "expectancy_pvalue": {
                      "type": "number"
                    },
                    "expectancy_pvalue_method": {
                      "const": "student_t_two_sided",
                      "type": "string"
                    },
                    "expectancy_pvalue_sample_size": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "kelly": {
                      "type": "number"
                    },
                    "longest_loss_streak": {
                      "type": "integer"
                    },
                    "max_drawdown": {
                      "type": "number"
                    },
                    "n": {
                      "type": "integer"
                    },
                    "payload": {
                      "const": "pnl_stats",
                      "type": "string"
                    },
                    "profit_factor": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "rolling_expectancy": {
                      "type": "number"
                    },
                    "rolling_kelly": {
                      "type": "number"
                    },
                    "rolling_n": {
                      "type": "integer"
                    },
                    "rolling_win_rate": {
                      "type": "number"
                    },
                    "trailing_loss_streak": {
                      "type": "integer"
                    },
                    "win_rate": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "payload",
                    "action",
                    "n",
                    "win_rate",
                    "avg_win",
                    "avg_loss",
                    "expectancy",
                    "profit_factor",
                    "max_drawdown",
                    "longest_loss_streak",
                    "trailing_loss_streak",
                    "kelly",
                    "rolling_n",
                    "rolling_expectancy",
                    "rolling_win_rate",
                    "rolling_kelly",
                    "expectancy_pvalue",
                    "expectancy_pvalue_sample_size",
                    "expectancy_pvalue_method"
                  ],
                  "type": "object"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          },
          "required": [
            "input"
          ],
          "type": "object"
        }
      }
    }
  },
  "liveness": {
    "reliability": null
  },
  "verified": false,
  "featured": false,
  "provider": {
    "host": "api.edifiedlab.com",
    "manifest_name": "api.edifiedlab.com",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-10-14T01:15:01.050Z"
  },
  "exampleResponse": {
    "action": "calculate",
    "avg_loss": 1,
    "avg_win": 2.5,
    "expectancy": 1.333333,
    "expectancy_pvalue": 0.133629,
    "expectancy_pvalue_method": "student_t_two_sided",
    "expectancy_pvalue_sample_size": 3,
    "kelly": 0.533333,
    "longest_loss_streak": 1,
    "max_drawdown": 1,
    "n": 3,
    "payload": "pnl_stats",
    "profit_factor": 5,
    "rolling_expectancy": 1,
    "rolling_kelly": 0.333333,
    "rolling_n": 2,
    "rolling_win_rate": 0.5,
    "trailing_loss_streak": 0,
    "win_rate": 0.667
  }
}