Files
majd-trading/src/lib/market/index.ts
T
Alireza HassaniandClaude Opus 5 02aaf61bb6 Initial import: Majd Trading website
Next.js 15 site for گروه بازرگانی بین المللی آریو مجد آسیا, rebuilt from
majdtrading.com. Persian, English and Arabic; RTL and LTR.

- Pages: home, about, contact, six product categories, blog index and detail
- i18n: prose in per-locale JSON, structure in TypeScript, drift checked by
  `npm run i18n:check`. Blog stays single-language by design
- Meshkee backend: blog content, tenant resolution, session via the customer
  portal, and /meshkee/sitemap-config.json
- Live market data from livedata.ir, cached server-side once a minute
- Self-hosted fonts: IRANYekan (fa), IBM Plex Sans Arabic (ar), Space Grotesk
  and BBH Bartle (Latin)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 19:16:32 +03:30

24 lines
825 B
TypeScript

import { displayed } from "./displayed";
import { livedataSource } from "./livedata";
import type { MarketSnapshot, MarketSource } from "./types";
/** Swap this line to change where the figures come from. */
const source: MarketSource = livedataSource;
/**
* Never throws. Nothing selected, or an unreachable upstream, returns null and
* the caller renders nothing — a build must not depend on a third party being
* up, and a visitor should never see a broken widget.
*/
export async function getMarketSnapshot(): Promise<MarketSnapshot | null> {
try {
return await source.fetchSnapshot(displayed);
} catch (error) {
console.error("[market] snapshot unavailable:", (error as Error).message);
return null;
}
}
export { instruments, type InstrumentId } from "./instruments";
export * from "./types";