Platform /Cookbook
Cookbook

Analysis · JavaScript

Analyze your own OHLC evidence

Submit authorized candles with a stable request ID and read a saved job.

Before you begin

  • Active Broker access with a server API key.
  • 30–500 real candles in ascending timestamp order from your authorized feed.

Implementation

  1. 1.Prepare symbol, timeframe, currency, asOf and candles from your market feed.
  2. 2.Generate and persist a requestId before sending the request.
  3. 3.Reuse that requestId for a network retry; do not generate a new ID.
  4. 4.Handle running results through the status recipe before displaying the final review.
instrument-analysis.js
export async function analyzeInstrument({
  brokerApiKey, requestId, authenticatedCustomer, marketData
}) {
  const response = await fetch('https://tradeeyes.app/api/public/business/v1/instrument', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer ' + brokerApiKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      requestId,
      endUserId: authenticatedCustomer.internalId,
      lang: 'en',
      plan: null,
      marketData
    })
  });
  if (!response.ok) throw new Error('Analysis failed: ' + response.status);
  return response.json(); // { jobId, status, result } or running job
}
// marketData: { symbol, timeframe, currency, asOf, candles }
// candle: { timestamp, open, high, low, close, volume }
// volume is a number or null; timestamps are unique ISO timestamps.
// Supply real feed data. Do not synthesize production evidence.

Validation & limitations

  • WAIT is a meaningful result, not an error.
  • A numeric policy pass is not regulatory approval or a probability of profit.
  • A per-user daily cap requires a stable endUserId; never rotate IDs to bypass it.