{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "iSpeed.my — Accounts & Portfolio Flow",
    "subtitle": "Account balances, holdings, and portfolio retrieval",
    "output": "ispeed-accounts.html",
    "viewBox": [1080, 650],
    "column_fit": "spread",
    "animation": "trace",
    "quality_profile": "showcase",
    "views": [
      { "id": "session-accounts", "label": "Session Accounts", "focus": ["user", "app", "mobile-api", "session"], "note": "Account list from the session" },
      { "id": "summary", "label": "Account Summary", "focus": ["app", "mobile-api", "vbroker"], "note": "Balances and margin" },
      { "id": "full-flow", "label": "Full Flow", "focus": ["user", "app", "mobile-api", "session", "vbroker"], "note": "Complete accounts 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": "session", "type": "database", "label": "AuthConn", "sublabel": "session accounts" },
    { "id": "vbroker", "type": "backend", "label": "VBroker API", "sublabel": "/account + /portfolio" }
  ],
  "segments": [
    { "from": 150, "to": 265, "label": "Session Accounts" },
    { "from": 275, "to": 415, "label": "Account Summary" },
    { "from": 425, "to": 600, "label": "Portfolio" }
  ],
  "messages": [
    { "id": "ac1", "from": "user", "to": "app", "y": 160, "label": "Open accounts tab", "variant": "default" },
    { "id": "ac2", "from": "app", "to": "mobile-api", "y": 190, "label": "getAccounts (40001)", "variant": "emphasis" },
    { "id": "ac3", "from": "mobile-api", "to": "session", "y": 220, "label": "read session accounts", "variant": "security" },
    { "id": "ac4", "from": "mobile-api", "to": "app", "y": 250, "label": "account list", "variant": "return" },
    { "id": "ac5", "from": "app", "to": "mobile-api", "y": 280, "label": "AccountSummary (11310)", "variant": "emphasis" },
    { "id": "ac6", "from": "mobile-api", "to": "vbroker", "y": 310, "label": "/account/account_enquiry", "variant": "default" },
    { "id": "ac7", "from": "mobile-api", "to": "vbroker", "y": 340, "label": "/account/portfolio/summary", "variant": "default" },
    { "id": "ac8", "from": "vbroker", "to": "mobile-api", "y": 370, "label": "balances", "variant": "return" },
    { "id": "ac9", "from": "mobile-api", "to": "app", "y": 400, "label": "summary", "variant": "return" },
    { "id": "ac10", "from": "app", "to": "mobile-api", "y": 430, "label": "Portfolio (12044)", "variant": "emphasis" },
    { "id": "ac11", "from": "mobile-api", "to": "vbroker", "y": 460, "label": "/account/portfolio/summary (paged)", "variant": "default" },
    { "id": "ac12", "from": "vbroker", "to": "mobile-api", "y": 490, "label": "holdings", "variant": "return" },
    { "id": "ac13", "from": "mobile-api", "to": "app", "y": 520, "label": "portfolio", "variant": "return" },
    { "id": "ac14", "from": "app", "to": "user", "y": 550, "label": "Render accounts", "variant": "return" }
  ],
  "activations": [
    { "participant": "app", "from": 155, "to": 560, "type": "frontend" },
    { "participant": "mobile-api", "from": 185, "to": 535, "type": "backend" },
    { "participant": "session", "from": 215, "to": 230, "type": "database" },
    { "participant": "vbroker", "from": 305, "to": 500, "type": "backend" }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "Account List",
      "items": [
        "RequestID 40001 reads accounts from the session",
        "No VBroker call is made for the list",
        "Includes foreign-market (FT) accounts"
      ]
    },
    {
      "dot": "violet",
      "title": "Portfolio",
      "items": [
        "Blank/ALL market merges Bursa + US/HK",
        "PER/PBR/yield from ice_ratios tables",
        "Portfolio summary is paginated"
      ]
    },
    {
      "dot": "cyan",
      "title": "Data Store",
      "items": [
        "vb_customer_acct, vb_customer_acct_bal",
        "vb_portfolio, vb_asset_tran, vb_trade_tran",
        "Foreign market uses ft_* tables"
      ]
    }
  ]
}
