Platform /Cookbook
Cookbook

Widget · HTML

Embed AI Trade Idea on a partner site

Mount the widget, update chart evidence and clean up on navigation.

Before you begin

  • Implement an authenticated same-origin /your-api/trade-eyes-session endpoint using the session recipe.
  • Provide real broker market data; allow scripts and frames from tradeeyes.app in your CSP.

Implementation

  1. 1.Load the widget script and add a mount target.
  2. 2.Fetch the short-lived session from your own authenticated server.
  3. 3.Mount with the server-verified name and market evidence.
  4. 4.Use updateInstrument on chart changes and destroy before remounting.
trade-idea.html
<script src="https://tradeeyes.app/business-widget.js"></script>
<div id="trade-eyes"></div>
<script>
async function mountAssistant(brokerMarketData) {
  const response = await fetch('/your-api/trade-eyes-session', {
    method: 'POST', credentials: 'same-origin'
  });
  if (!response.ok) throw new Error('Session unavailable');
  const session = await response.json();
  const target = document.getElementById('trade-eyes');
  if (!target) return;
  return TradeEyes.mount(target, {
    sessionToken: session.token,
    name: session.name,
    marketData: brokerMarketData
  });
}
// In your application's chart lifecycle:
// const widget = await mountAssistant(currentBrokerMarketData);
// widget.updateInstrument(nextBrokerMarketData);
// widget.destroy();
</script>

Validation & limitations

  • Instrument updates do not automatically spend analysis quota.
  • The customer explicitly starts the analysis.
  • Trade Eyes does not execute orders; retain human confirmation on your platform.