"use client"; import Link from "next/link"; import { ArrowLeft } from "lucide-react"; import { api, type InstrumentDetail } from "@/lib/api"; import { useAsync, useQueryParam } from "@/lib/hooks"; import { fmtCompact, fmtInt } from "@/lib/format"; import { Card, Empty, ErrorState, KV, PageHeader, Skeleton, StatusBadge } from "@/components/ui"; import { DataTable } from "@/components/DataTable"; import { JsonView } from "@/components/JsonView"; export default function SymbolDetailPage() { const symbol = useQueryParam("symbol")?.toUpperCase() ?? null; const { data, error, loading, reload } = useAsync((s) => api.get(`/instruments/${encodeURIComponent(symbol!)}`, undefined, s), [symbol], { enabled: !!symbol }); const inst = data?.instrument; return ( <> Symbols {inst && } Bars Sessions Fundamentals SQL ) } /> {!symbol && Missing ?symbol= parameter.} {error && } {loading && !data && } {data && (
{inst ? ( {inst.instrument_id}], ["Asset class", inst.asset_class], ["Currency", inst.currency ?? "—"], ["First date", inst.first_date ?? "—"], ["Last date", inst.last_date ?? "—"], ...Object.entries(inst) .filter(([k]) => !["instrument_id", "symbol", "name", "asset_class", "status", "first_date", "last_date", "currency"].includes(k)) .map(([k, v]) => [k, typeof v === "object" && v !== null ? : String(v ?? "—")] as [string, React.ReactNode]), ]} /> ) : ( No master record. )} {data.fundamentals && data.fundamentals.facts > 0 ? ( ) : ( No fundamentals ingested for frd:{symbol}. )} c.dataset_id} mobile="scroll" columns={[ { key: "dataset_id", header: "Dataset", render: (c) => ( {c.dataset_id} ), }, { key: "sessions", header: "Sessions", num: true, render: (c) => fmtInt(c.sessions) }, { key: "bars", header: "Bars", num: true, render: (c) => {fmtCompact(c.bars)} }, { key: "d0", header: "From" }, { key: "d1", header: "To" }, ]} empty="No bars for this symbol yet." /> `${a.action_type}-${a.ex_date}-${i}`} mobile="scroll" maxHeight="24rem" columns={[ { key: "ex_date", header: "Ex-date", render: (a) => {a.ex_date} }, { key: "action_type", header: "Type", render: (a) => }, { key: "value", header: "Value", render: (a) => }, ]} empty="No splits or dividends recorded." /> {data.aliases.length === 0 ? ( No aliases. ) : (
    {data.aliases.map((a, i) => (
  • ))}
)}
)} ); }