{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — Market Data Flow",
    "subtitle": "Quote and chart retrieval across ICE, TRKD, and SSFC",
    "output": "ispeed-market-data.html",
    "viewBox": [1080, 560],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "quote", "label": "Quote", "focus": ["user", "app", "mobile-api", "market-db"], "note": "Real-time/delayed quote lookup" },
      { "id": "chart", "label": "Chart", "focus": ["app", "mobile-api", "external"], "note": "Intraday and historical chart data" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["user", "app", "mobile-api", "market-db", "external"], "note": "Complete market data lifecycle" }
    ]
  },
  "participants": [
    { "id": "user", "type": "external", "label": "User", "sublabel": "Trader" },
    { "id": "app", "type": "frontend", "label": "React Native App", "sublabel": "Expo SDK 56" },
    { "id": "mobile-api", "type": "backend", "label": "Mobile API", "sublabel": "rt-mx-mobile-api" },
    { "id": "market-db", "type": "database", "label": "Market DB", "sublabel": "ICE market tables" },
    { "id": "external", "type": "external", "label": "TRKD / SSFC", "sublabel": "Refinitiv + symbol cache" }
  ],
  "segments": [
    { "from": 150, "to": 295, "label": "Quote" },
    { "from": 305, "to": 505, "label": "Chart" }
  ],
  "messages": [
    { "id": "md1", "from": "user", "to": "app", "y": 160, "label": "Open symbol", "variant": "default" },
    { "id": "md2", "from": "app", "to": "mobile-api", "y": 190, "label": "GetQuote (20109)", "variant": "emphasis" },
    { "id": "md3", "from": "mobile-api", "to": "market-db", "y": 220, "label": "query market_mover / symbols", "variant": "default" },
    { "id": "md4", "from": "market-db", "to": "mobile-api", "y": 250, "label": "quote", "variant": "return" },
    { "id": "md5", "from": "mobile-api", "to": "app", "y": 280, "label": "quote + AI rating", "variant": "return" },
    { "id": "md6", "from": "user", "to": "app", "y": 310, "label": "Open chart", "variant": "default" },
    { "id": "md7", "from": "app", "to": "mobile-api", "y": 340, "label": "Chart intraday (21301)", "variant": "emphasis" },
    { "id": "md8", "from": "mobile-api", "to": "external", "y": 370, "label": "TRKD TimeSeries / SSFC", "variant": "dashed" },
    { "id": "md9", "from": "external", "to": "mobile-api", "y": 400, "label": "history data", "variant": "return" },
    { "id": "md10", "from": "mobile-api", "to": "app", "y": 430, "label": "chart data", "variant": "return" },
    { "id": "md11", "from": "app", "to": "user", "y": 460, "label": "Render chart", "variant": "return" }
  ],
  "activations": [
    { "participant": "app", "from": 155, "to": 470, "type": "frontend" },
    { "participant": "mobile-api", "from": 185, "to": 445, "type": "backend" },
    { "participant": "market-db", "from": 215, "to": 260, "type": "database" },
    { "participant": "external", "from": 365, "to": 410, "type": "external" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Data Sources",
      "items": [
        "ICE market tables for Bursa/HK/US quotes",
        "TRKD for historical charts (cached)",
        "SSFC cache for short symbol searches"
      ]
    },
    {
      "dot": "violet",
      "title": "Chart Resolutions",
      "items": [
        "0=5MIN, 1=DAILY, 2=WEEKLY, 3=MONTHLY",
        "4=1MIN, 100=15MIN, 101=60MIN",
        "Client renders via WebView + generated scripts"
      ]
    },
    {
      "dot": "cyan",
      "title": "Enrichments",
      "items": [
        "Bridgewise AI rating and fundamentals",
        "Indices share the indices table by type",
        "News merges Reuters, Motley Fool, AAStocks"
      ]
    }
  ]
}
