Skip to content
Skip to Content
DalalOSdocs

Recipe

Portfolio dashboard

Show the latest prices and a few checks for a list of companies you keep. What you may do with the data is set by the terms.

What you will build

A table of your symbols with their latest close, their move against an index, their shareholding and their next results date.

Before you start

  • An API key on a plan that includes the REST API. Create one on the keys page of your dashboard and set it as DALALOS_API_KEY.
  • Credits: each call costs credits from your plan. The limits say how many calls a run makes. Plans and credits are on Plans, credits and errors.
  • Your list of NSE symbols. The list lives in your app, not in DalalOS.
  • The index to compare against, for example NIFTY 50.

Step 1: Batch EOD quotes

Read the latest end-of-day quote for up to 20 symbols in one call. For a longer list, send the symbols in batches of 20. data has one entry per symbol: status, then quote (with nse_symbol, price, pct_change) and as_of.

GET /quotes has the parameters, the errors and a box to send the call.

Batch EOD quotes
curl -H "Authorization: Bearer $DALALOS_API_KEY" "https://mcp.dalalos.in/v1/quotes?symbols=RELIANCE%2CTCS%2CINFY"
{
  "status": "success",
  "data": [
    {
      "query": "RELIANCE",
      "status": "success",
      "quote": {
        "isin": "INE002A01018",
        "nse_symbol": "RELIANCE",
        "price": 1382.6,
        "change": -13.6,
        "pct_change": -0.974072482452,
        "volume": 12173225,
        "market_cap": 18710088037000,
        "pe": 22.7851,
        "pb": 1.9812,
        "week52_high": 1611.8,
        "week52_low": 1152.2,
        "week52_high_unadjusted": 1611.8,
        "week52_low_unadjusted": 1152.2,
        "week52_adjustment_incomplete": 0,
        "day_open": 1393.8,
        "day_high": 1398,
        "day_low": 1373.1,
        "prev_close": 1396.2,
        "turnover": 16824840078.3,
        "num_trades": 249818,
        "deliv_pct": 54.74,
        "market_cap_source": "nse_daily_market_cap",
        "bse_reported": {
          "roe": 0.0836,
          "operating_margin": 0.1046,
          "net_margin": 0.0507,
          "note": "BSE ComHeader's own published figures (fractions) — a different, BSE-computed number from this project's XBRL-derived TTM ratios, not necessarily TTM or the …"
        },
        "week52": {
          "high": 1611.8,
          "low": 1152.2,
          "validity": "valid",
          "reason_codes": [],
          "reason_text": null,
          "reason_texts": {},
          "as_of": "2026-11-27"
        },
        "recent_dividends": [
          {
            "ex_date": "2026-06-05",
            "type": "final",
            "amount": 6
          }
        ],
        "upcoming_dividends": [],
        "dividend_yield": 0.0043,
        "currency": "INR",
        "vwap": 1382.1185,
        "pe_reason": null,
        "pe_reason_text": null,
        "pb_reason": null,
        "pb_reason_text": null
      },
      "cached_at": "2026-11-27T14:45:05+00:00",
      "as_of": "2026-11-27",
      "freshness": {
        "version": 1,
        "stale": false,
        "price": {
          "basis": "end_of_day",
          "session": "2026-11-27",
          "market_latest_session": "2026-11-27",
          "fetched_at": "2026-11-27T14:45:05+00:00",
          "status": "latest_session"
        },
        "source_check": {
          "job": "refresh_quotes",
          "job_last_success_at": "2026-11-27T14:48:26+00:00",
          "status": "recent"
        },
        "reason_codes": [
          "end_of_day_price"
        ],
        "reason_text": "Closing price for Friday 27 Nov 2026, the latest trading session on file. This is not a live price."
      },
      "error": null,
      "reason_code": null,
      "resolved_via": null,
      "source": "nse-bhavcopy"
    }
  ],
  "cached_at": "2026-11-27T14:45:05+00:00",
  "source": "nse-bhavcopy",
  "stale": false,
  "error": null,
  "reason_code": null,
  "data_age_seconds": 4056.57
}

Saved answer. Run on 2026-11-27, answered 200. Lists show their first item in full; the other items and long text are shortened. A call you make now gets the current answer.

Feeds the next step: One row per symbol.

Step 2: One stock's return against an index

Read one stock's return against an index over a window. Use index to pick the index and days for the window. The answer has stock and index_stats (each with return_pct) and difference_pct.

GET /stock-vs-index/{symbol} has the parameters, the errors and a box to send the call.

One stock's return against an index for RELIANCE
curl -H "Authorization: Bearer $DALALOS_API_KEY" "https://mcp.dalalos.in/v1/stock-vs-index/RELIANCE?index=Nifty+50&days=90"
{
  "status": "success",
  "data": {
    "symbol": "RELIANCE",
    "index": "Nifty 50",
    "from": "2026-08-29",
    "to": "2026-11-27",
    "stock": {
      "from": "2026-08-31",
      "to": "2026-11-27",
      "return_pct": 8.27,
      "annualised_volatility_pct": 31.74,
      "max_drawdown_pct": -12.41,
      "best_day": {
        "date": "2026-11-02",
        "return_pct": 11.6
      },
      "worst_day": {
        "date": "2026-10-28",
        "return_pct": -3.19
      },
      "trading_days": 61
    },
    "index_stats": {
      "from": "2026-08-31",
      "to": "2026-11-27",
      "return_pct": 6.34,
      "annualised_volatility_pct": 15.17,
      "max_drawdown_pct": -7.68,
      "best_day": {
        "date": "2026-11-05",
        "return_pct": 2.4
      },
      "worst_day": {
        "date": "2026-11-23",
        "return_pct": -1.75
      },
      "trading_days": 61
    },
    "difference_pct": 1.93,
    "days_without_row": 0,
    "series_used": [
      "EQ"
    ],
    "share_change_adjustments": [],
    "method": "stock return compounds close/prev_close over its own trading days, one row a day from the regular series (EQ, BE, BZ, E1; block-deal rows excluded), with pre…"
  },
  "cached_at": "2026-11-27T14:51:03+00:00",
  "source": "nse",
  "stale": false,
  "error": null,
  "reason_code": null,
  "data_age_seconds": 517.144
}

Saved answer. Run on 2026-11-27, answered 200. Lists show their first item in full; the other items and long text are shortened. A call you make now gets the current answer.

Step 3: Shareholding pattern

Read the quarterly shareholding of one symbol: promoters, institutions and the public. periods lists the quarters and window_changes the change over 1 year, 3 years and all.

GET /stocks/{q}/shareholding has the parameters, the errors and a box to send the call.

Shareholding pattern for RELIANCE
curl -H "Authorization: Bearer $DALALOS_API_KEY" "https://mcp.dalalos.in/v1/stocks/RELIANCE/shareholding?limit=8"
{
  "status": "success",
  "data": {
    "isin": "INE002A01018",
    "name": "Reliance Industries Limited",
    "nse_symbol": "RELIANCE",
    "periods": [
      {
        "period_end": "2026-09-30",
        "promoter_pct": 50.44,
        "fii_pct": 16.67,
        "dii_pct": 21.72,
        "public_category_total_pct": 49.56,
        "non_promoter_pct": 49.56,
        "public_pct": 49.56,
        "retail_and_other_pct": 11.17,
        "breakdown_available": true,
        "detail": {
          "pledged_pct": 0,
          "pledged_shares": 0,
          "locked_in_pct": 0,
          "demat_pct": 99.79,
          "voting_rights_pct": 49.62,
          "num_shareholders": 5072457,
          "pct_after_dilution": 50.44,
          "pledged_pct_of_total_shares": 0,
          "promoter_voting_rights_pct": 49.62,
          "promoter_pct_after_dilution": 50.44
        },
        "promoter_pct_change_pp": -0.04,
        "promoter_pct_change_reason": null,
        "fii_pct_change_pp": -0.53,
        "fii_pct_change_reason": null,
        "dii_pct_change_pp": 0.53,
        "dii_pct_change_reason": null,
        "retail_and_other_pct_change_pp": 0.04,
        "retail_and_other_pct_change_reason": null,
        "non_promoter_pct_change_pp": 0.04,
        "non_promoter_pct_change_reason": null,
        "pledged_pct_change_pp": 0,
        "pledged_pct_change_reason": null,
        "breakdown": {
          "quarter_name": "September 2026",
          "qtrid": "131.00",
          "institutions": [
            {
              "category": "Mutual Funds",
              "pct": 10.31
            }
          ],
          "named_institutional_holders": [
            {
              "name": "ICICI Prudential Mutual Funds",
              "category": "Mutual Funds",
              "pct": 1.85
            }
          ]
        }
      }
    ],
    "window_change": {
      "from_period_end": "2024-12-31",
      "to_period_end": "2026-09-30",
      "periods": 8,
      "changes": {
        "promoter_pct": {
          "change_pp": 0.31,
          "reason": null
        },
        "fii_pct": {
          "change_pp": -2.48,
          "reason": null
        },
        "dii_pct": {
          "change_pp": 2.62,
          "reason": null
        },
        "…": "3 more keys"
      }
    },
    "window_changes": {
      "1y": {
        "from_period_end": "2025-09-30",
        "to_period_end": "2026-09-30",
        "periods": 5,
        "changes": {
          "promoter_pct": {
            "start_pct": 50.01,
            "end_pct": 50.44,
            "change_pp": 0.43,
            "reason": null
          },
          "fii_pct": {
            "start_pct": 18.65,
            "end_pct": 16.67,
            "change_pp": -1.98,
            "reason": null
          },
          "dii_pct": {
            "start_pct": 20.33,
            "end_pct": 21.72,
            "change_pp": 1.39,
            "reason": null
          },
          "…": "3 more keys"
        }
      },
      "3y": {
        "from_period_end": "2023-09-30",
        "to_period_end": "2026-09-30",
        "periods": 13,
        "changes": {
          "promoter_pct": {
            "start_pct": 50.27,
            "end_pct": 50.44,
            "change_pp": 0.17,
            "reason": null
          },
          "fii_pct": {
            "start_pct": 22.6,
            "end_pct": 16.67,
            "change_pp": -5.93,
            "reason": null
          },
          "dii_pct": {
            "start_pct": 16.07,
            "end_pct": 21.72,
            "change_pp": 5.65,
            "reason": null
          },
          "…": "3 more keys"
        }
      },
      "all": {
        "from_period_end": "2024-12-31",
        "to_period_end": "2026-09-30",
        "periods": 8,
        "changes": {
          "promoter_pct": {
            "start_pct": 50.13,
            "end_pct": 50.44,
            "change_pp": 0.31,
            "reason": null
          },
          "fii_pct": {
            "start_pct": 19.15,
            "end_pct": 16.67,
            "change_pp": -2.48,
            "reason": null
          },
          "dii_pct": {
            "start_pct": 19.1,
            "end_pct": 21.72,
            "change_pp": 2.62,
            "reason": null
          },
          "…": "3 more keys"
        }
      }
    },
    "definitions": {
      "detail.pledged_pct": {
        "measure": "Promoter shares pledged or otherwise encumbered, as a percent of the promoter…",
        "basis": "disclosed",
        "formula": {
          "numerator": "pledged_shares",
          "denominator": "shares held by the promoter and promoter group"
        },
        "unit": "percent",
        "glossary": "promoter_pledge"
      },
      "detail.pledged_pct_of_total_shares": {
        "measure": "Promoter shares pledged or otherwise encumbered, as a percent of all shares",
        "basis": "computed",
        "formula": {
          "numerator": "pledged_shares",
          "denominator": "total shares in the same shareholding filing"
        },
        "unit": "percent",
        "glossary": "promoter_pledge_of_total"
      }
    }
  },
  "cached_at": "2026-10-21T16:00:22+00:00",
  "source": "bse-shp",
  "stale": false,
  "error": null,
  "reason_code": null,
  "data_age_seconds": 3196614.745,
  "as_of": "2026-09-30",
  "freshness": {
    "version": 1,
    "stale": false,
    "period": {
      "as_of": "2026-09-30",
      "latest_due": "2026-09-30",
      "status": "latest_filed"
    },
    "source_check": {
      "company_fetched_at": "2026-10-21T16:00:22+00:00",
      "job_last_success_at": "2026-11-26T16:14:00+00:00",
      "status": "recent"
    },
    "reason_codes": [
      "latest_period_on_file"
    ],
    "reason_text": "Shareholding pattern for the latest filed quarter (period ended 30 Sep 2026)."
  }
}

Saved answer. Run on 2026-11-27, answered 200. The data in it was collected on 2026-10-21, not on the run date. Lists show their first item in full; the other items and long text are shortened. A call you make now gets the current answer.

Step 4: Upcoming results

List upcoming results dates. The route has no symbol filter, so set days to 90 and limit to 200 and keep the rows whose nse_symbol is one of yours.

GET /results-calendar has the parameters, the errors and a box to send the call.

Upcoming results
curl -H "Authorization: Bearer $DALALOS_API_KEY" "https://mcp.dalalos.in/v1/results-calendar?days=30&limit=10"
{
  "status": "success",
  "data": {
    "from": "2026-11-27",
    "to": "2026-12-27",
    "days": 30,
    "count": 10,
    "total_count": 15,
    "truncated": true,
    "results": [
      {
        "meeting_date": "2026-11-27",
        "bse_code": "505075",
        "isin": "INE878E01021",
        "attachment_url": "https://www.bseindia.com/stock-share-price/setco-automotive-ltd/setco/505075/",
        "nse_symbol": "SETCO",
        "name": "Setco Automotive Limited",
        "sector": "Consumer Discretionary",
        "source": "bse"
      },
      {
        "meeting_date": "2026-11-27",
        "bse_code": "523782",
        "isin": "INE844D01017",
        "attachment_url": "https://www.bseindia.com/stock-share-price/mitshi-india-ltd/mitshi/523782/",
        "nse_symbol": null,
        "name": "Mitshi India Ltd",
        "sector": "Services",
        "source": "bse"
      }
    ],
    "note_truncated": "Showing the first 10 of 15 meetings in the window (earliest first); raise limit (max 200) or shorten days to see the rest."
  },
  "cached_at": "2026-11-26T15:15:02+00:00",
  "source": "bse-corpforthresults",
  "stale": false,
  "error": null,
  "reason_code": null,
  "data_age_seconds": 85388.618,
  "as_of": "2026-11-26"
}

Saved answer. Run on 2026-11-27, answered 200. Lists show their first item in full; the other items and long text are shortened. A call you make now gets the current answer.

The full script

Python 3 with the requests package. It reads your key from DALALOS_API_KEY, waits once when the API asks it to slow down, stops with a plain message on 401, 402 and 403, and prints what it reads.

portfolio_dashboard.py
import json
import os
import sys
import time

import requests

BASE = "https://mcp.dalalos.in/v1"
HEADERS = {"Authorization": "Bearer " + os.environ["DALALOS_API_KEY"]}


def call(method, path, **kwargs):
    """One request. Waits once on a 429. Stops with a plain message on 401, 402 and 403."""
    for attempt in range(2):
        response = requests.request(method, BASE + path, headers=HEADERS, timeout=30, **kwargs)
        if response.status_code == 429 and attempt == 0:
            time.sleep(float(response.headers.get("Retry-After", "2")))
            continue
        break
    if response.status_code == 401:
        sys.exit("401: the key is missing or not valid. Create one at https://dalalos.in/dashboard/keys")
    if response.status_code == 402:
        sys.exit("402: the monthly credits are used up.")
    if response.status_code == 403:
        sys.exit("403: this plan does not include the REST API.")
    response.raise_for_status()
    return response.json()


def show(title, answer, limit=1200):
    print("==", title)
    print(json.dumps(answer, indent=2)[:limit])


SYMBOLS = ["RELIANCE", "TCS", "INFY"]  # your list: NSE symbols
INDEX = "NIFTY 50"

for start in range(0, len(SYMBOLS), 20):  # /quotes takes at most 20 symbols a call
    batch = SYMBOLS[start:start + 20]
    for item in call("GET", "/quotes", params={"symbols": ",".join(batch)})["data"]:
        if item["status"] != "success":
            print(item["query"], "no quote:", item["reason_code"])
            continue
        quote = item["quote"]
        print(quote["nse_symbol"], quote["price"], str(quote["pct_change"]) + "%", "as of", item["as_of"])

for symbol in SYMBOLS:
    move = call("GET", f"/stock-vs-index/{symbol}", params={"index": INDEX, "days": 90})["data"]
    print(symbol, "return", move["stock"]["return_pct"], "%;", INDEX, move["index_stats"]["return_pct"], "%; difference", move["difference_pct"], "points")
    holding = call("GET", f"/stocks/{symbol}/shareholding", params={"limit": 4})["data"]
    show(symbol + " shareholding, latest quarter", holding["periods"][:1], limit=600)

calendar = call("GET", "/results-calendar", params={"days": 90, "limit": 200})["data"]
for row in calendar["results"]:
    if row["nse_symbol"] in SYMBOLS:
        print(row["nse_symbol"], "results meeting on", row["meeting_date"])

Limits

  • Prices are end of day, not live.
  • A run costs one call per 20 symbols, two calls for each symbol, and one for the calendar. Each call costs credits from your plan.
  • /quotes answers for the symbols it knows. Check a short answer against your list.

Extend it

KEEP EXPLORING