Skip to content

Dashboard API

The dashboard server exposes a small HTTP API on port 8000. All endpoints return JSON (except the two HTML pages) with the CORS header Access-Control-Allow-Origin: *.

All timestamps in API responses are in EST and formatted as dd/mm/yy HH:mm by the fmtEST() function in server.js.

Endpoints

GET /

Serves index.html, the main dashboard page.

Content-Type: text/html


GET /settings

Serves settings.html, the standalone settings page.

Content-Type: text/html


GET /api/data

Returns the full strategy state as JSON. The frontend polls this endpoint every 5 seconds.

Response:

{
  "symbol": "NQ1!",
  "tf": "5",
  "price": 18450.25,
  "bias": {
    "d1": "bullish",
    "w1": "bearish",
    "pdh": 18500.00,
    "pdl": 18200.00,
    "pwh": 18600.00,
    "pwl": 18100.00,
    "pdh_swept": false,
    "pdl_swept": true,
    "pwh_swept": false,
    "pwl_swept": false
  },
  "session": {
    "high": 18470.00,
    "low": 18350.00,
    "high_swept": false,
    "low_swept": true,
    "hunt_side": "HUNT_HIGH",
    "re_extension": false
  },
  "ob": {
    "blocks": [
      {
        "dir": "BULL",
        "high": 18400.00,
        "low": 18380.00,
        "spent": false,
        "x1": 100,
        "x2": 105,
        "size": 20.00,
        "fvg": "18385.00-18395.00",
        "dist": 50.25,
        "time": "14/04/26 09:35",
        "stack": 1
      }
    ]
  },
  "smt": {
    "active": 2,
    "bull": 1,
    "bear": 1,
    "labels": [
      {
        "text": "BULL SMT vs ES1!",
        "direction": "BULL",
        "p1": 18450.00,
        "p2": 18420.00,
        "t1": "14/04/26 09:30",
        "t2": "14/04/26 09:15"
      },
      {
        "text": "BEAR SMT vs ES1!",
        "direction": "BEAR",
        "p1": 18500.00,
        "p2": 18530.00,
        "t1": "14/04/26 08:45",
        "t2": "14/04/26 08:30"
      }
    ]
  },
  "strategy": {
    "direction": "LONG",
    "entry": 18380.00,
    "stop": 18350.00,
    "target": 18500.00,
    "rr": 4.0,
    "atr": 45.5,
    "qty": 2
  }
}

SMT Labels Schema

Each entry in smt.labels[] is an object:

Field Type Description
text string Display text for the divergence label
direction string "BULL" or "BEAR"
p1 number First swing point price
p2 number Second swing point price
t1 string Timestamp of first swing point (EST dd/mm/yy HH:mm)
t2 string Timestamp of second swing point (EST dd/mm/yy HH:mm)

Order Blocks Schema

Each entry in ob.blocks[] is an object:

Field Type Description
dir string "BULL" or "BEAR"
high number Upper boundary of the OB
low number Lower boundary of the OB
spent boolean Whether the OB has been mitigated
x1 number Start bar index
x2 number End bar index
size number Height of the zone in price
fvg string Associated FVG range (e.g., "18385.00-18395.00"), or null
dist number Distance from current price
time string Creation timestamp (EST dd/mm/yy HH:mm)
stack number Stack index of the order block

GET /api/settings

Returns indicator settings for all studies on the chart.

Response:

{
  "symbol": "NQ1!",
  "resolution": "5",
  "indicators": [
    {
      "name": "HTF Bias",
      "entity_id": "study_abc123",
      "settings": [
        {
          "id": "in_0",
          "name": "Lookback Period",
          "value": 20,
          "isColor": false,
          "hex": null,
          "alpha": null
        },
        {
          "id": "in_5",
          "name": "Bull Color",
          "value": -16711936,
          "isColor": true,
          "hex": "#00ff00",
          "alpha": 255
        }
      ]
    }
  ]
}

Color values are stored as ARGB integers by TradingView. The API converts them to hex and extracts the alpha channel for convenience.


GET /api/screenshot

Returns a base64-encoded PNG screenshot of the TradingView chart. The image is cached server-side for 10 seconds.

Response:

{
  "data": "iVBORw0KGgoAAAANSUhEUgAA..."
}

See Screenshots for details on how captures work.

CORS

All API endpoints include the header:

Access-Control-Allow-Origin: *

This allows the dashboard to be embedded or called from any origin.