Platform /Cookbook
Cookbook

Risk review · JavaScript

Import company trades into Trading Coach

Evaluate transaction evidence against an organization account’s versioned mandate.

Before you begin

  • Active Risk access and a permanent server API key.
  • An organization-owned account and mandate created in the business workspace.

Implementation

  1. 1.Map your authorized trade export to the required evidence fields.
  2. 2.Include equity before each trade; retain missing optional evidence as null.
  3. 3.Send a unique requestId and the organization account UUID.
  4. 4.Read the stored report in the team workspace and record human review.
risk-import.js
export async function importTrades({
  brokerApiKey, requestId, accountId, rows
}) {
  const response = await fetch('https://tradeeyes.app/api/public/business/v1/risk', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer ' + brokerApiKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      requestId, accountId,
      source: 'Partner trade export',
      rows
    })
  });
  if (!response.ok) throw new Error('Import failed: ' + response.status);
  return response.json(); // { jobId, status, result: { recordId, report } }
}
// Each row: { trade_id, timestamp, symbol, currency,
// pnl, equity_before, entry, stop, quantity }
// entry, stop and quantity may be null when unavailable.
// Use actual transaction records, not illustrative trades.

Validation & limitations

  • Maximum 2,000 rows per request; duplicate trade IDs are rejected.
  • Risk ingestion requires a permanent key, not a widget session.
  • Reports use imported linear-unit evidence and UTC days; missing evidence is unassessed.
  • No automatic live-account restrictions or broker synchronization are provided.