trade_log_analysis

Analyze supplied raw trade records for deterministic performance, execution quality, grouping, streaks, data-quality issues and risk patterns.

When to use

Use when an agent needs structured statistics and findings from a trading log or execution history.

Selection guidance

Role: supporting. Use when an agent needs structured statistics and findings from a trading log or execution history.

Use cases

Access

Price: $0.30 USD per call. Payment options are deployment-configured; inspect /api/v1/payment-methods. Prices and payment semantics are unchanged from the canonical registry.

Related tools

Example input

{
  "records": [
    {
      "tradeId": "t1",
      "symbol": "BTCUSD",
      "direction": "long",
      "entryTime": "2026-01-01T10:00:00Z",
      "exitTime": "2026-01-01T11:00:00Z",
      "entryPrice": 100,
      "exitPrice": 110,
      "quantity": 1,
      "fees": 1,
      "status": "closed",
      "strategy": "breakout",
      "session": "London"
    }
  ]
}

Example output

{
  "summary": {
    "totalTrades": 1,
    "closedTrades": 1,
    "openTrades": 0,
    "wins": 1,
    "losses": 0,
    "netPnl": 9,
    "fees": 1,
    "maxWinningStreak": 1,
    "maxLosingStreak": 0,
    "averageHoldingDurationSeconds": 3600
  },
  "performanceBySymbol": [],
  "performanceByStrategy": [],
  "performanceBySession": [],
  "executionMetrics": {
    "completeRecords": 1,
    "malformedRecords": 0,
    "duplicateTradeIds": [],
    "outOfOrderTimestamps": 0,
    "missingPrices": 0
  },
  "behavioralPatterns": [],
  "anomalies": [],
  "riskFlags": [],
  "dataQuality": {
    "completeTradeCount": 1,
    "incompleteTradeCount": 0,
    "warnings": []
  }
}

Input schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "records": {
      "maxItems": 100000,
      "type": "array",
      "items": {}
    },
    "accountEquity": {
      "type": "number",
      "minimum": 0
    },
    "duplicateTradeIdPolicy": {
      "type": "string",
      "enum": [
        "flag",
        "deduplicate"
      ]
    }
  },
  "required": [
    "records"
  ],
  "additionalProperties": false
}

Output schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "summary": {
      "type": "object",
      "properties": {
        "totalTrades": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "closedTrades": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "openTrades": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "wins": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "losses": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "netPnl": {
          "type": [
            "number",
            "null"
          ]
        },
        "fees": {
          "type": [
            "number",
            "null"
          ]
        },
        "maxWinningStreak": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "maxLosingStreak": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "averageHoldingDurationSeconds": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "totalTrades",
        "closedTrades",
        "openTrades",
        "wins",
        "losses",
        "netPnl",
        "fees",
        "maxWinningStreak",
        "maxLosingStreak",
        "averageHoldingDurationSeconds"
      ],
      "additionalProperties": false
    },
    "performanceBySymbol": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "trades": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "wins": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "losses": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "netPnl": {
            "type": [
              "number",
              "null"
            ]
          },
          "fees": {
            "type": [
              "number",
              "null"
            ]
          },
          "winRate": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "trades",
          "wins",
          "losses",
          "netPnl",
          "fees",
          "winRate"
        ],
        "additionalProperties": false
      }
    },
    "performanceByStrategy": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "trades": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "wins": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "losses": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "netPnl": {
            "type": [
              "number",
              "null"
            ]
          },
          "fees": {
            "type": [
              "number",
              "null"
            ]
          },
          "winRate": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "trades",
          "wins",
          "losses",
          "netPnl",
          "fees",
          "winRate"
        ],
        "additionalProperties": false
      }
    },
    "performanceBySession": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "trades": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "wins": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "losses": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "netPnl": {
            "type": [
              "number",
              "null"
            ]
          },
          "fees": {
            "type": [
              "number",
              "null"
            ]
          },
          "winRate": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "key",
          "trades",
          "wins",
          "losses",
          "netPnl",
          "fees",
          "winRate"
        ],
        "additionalProperties": false
      }
    },
    "executionMetrics": {
      "type": "object",
      "properties": {
        "completeRecords": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "malformedRecords": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "duplicateTradeIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outOfOrderTimestamps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "missingPrices": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "completeRecords",
        "malformedRecords",
        "duplicateTradeIds",
        "outOfOrderTimestamps",
        "missingPrices"
      ],
      "additionalProperties": false
    },
    "behavioralPatterns": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "anomalies": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "riskFlags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "dataQuality": {
      "type": "object",
      "properties": {
        "completeTradeCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "incompleteTradeCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "completeTradeCount",
        "incompleteTradeCount",
        "warnings"
      ],
      "additionalProperties": false
    },
    "sourceTraceability": {
      "type": "object",
      "properties": {
        "strategyPerformance": {
          "type": "string",
          "enum": [
            "GROK",
            "SIGNALFLOW",
            "MERGED",
            "NEW"
          ]
        },
        "tradeRisk": {
          "type": "string",
          "enum": [
            "GROK",
            "SIGNALFLOW",
            "MERGED",
            "NEW"
          ]
        },
        "portfolioExposure": {
          "type": "string",
          "enum": [
            "GROK",
            "SIGNALFLOW",
            "MERGED",
            "NEW"
          ]
        },
        "tradeLog": {
          "type": "string",
          "enum": [
            "GROK",
            "SIGNALFLOW",
            "MERGED",
            "NEW"
          ]
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "strategyPerformance",
        "tradeRisk",
        "portfolioExposure",
        "tradeLog",
        "notes"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "summary",
    "performanceBySymbol",
    "performanceByStrategy",
    "performanceBySession",
    "executionMetrics",
    "behavioralPatterns",
    "anomalies",
    "riskFlags",
    "dataQuality"
  ],
  "additionalProperties": false
}

Category: Trading Intelligence · hierarchy: supporting · idempotent: yes · side effects: no