Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@

## Hosting & URLs

- Docs site is hosted on **Vercel** at `docs.marketdata.app`
- Cloudflare rules proxy it to the public URL: `www.marketdata.app/docs/`
- Staging is at `docs-staging.marketdata.app` → `www.marketdata.app/docs-staging/`
- Docs site is hosted on **Cloudflare Pages** with a **Cloudflare Worker** reverse proxy
- Worker (`worker/`) proxies `www.marketdata.app/docs/*` → `marketdata-docs.pages.dev`
- Staging: `www.marketdata.app/docs-staging/*` → `marketdata-docs-staging.pages.dev`
- CI/CD: GitHub Actions (`.github/workflows/deploy-docs.yml`) builds Docusaurus, restructures output to match URL paths, and deploys to Cloudflare Pages + Worker via Wrangler
- Build output is restructured in CI to nest under `docs/` or `docs-staging/` so static files serve from correct paths without rewrite rules
- Edge caching enabled on Worker subrequests; `_headers` file generated in CI for asset cache control

## Workflow

- Work on the **staging** branch, verify changes at `www.marketdata.app/docs-staging/`
- Once verified, open a PR from `staging` → `main` and merge to deploy to production

## Package Manager

- Use **yarn**, not npm (project uses `yarn.lock`)

## Search

- Algolia DocSearch (App ID: IUHZFO750H, Index: "Market Data Documentation")
- Crawler config is managed in the Algolia dashboard, not in the codebase
- `hierarchy.lvl1` is ranked above `hierarchy.lvl0` in searchable attributes (custom tweak from Docusaurus default)

## Sidebar Badges

- Badges (New, Premium, Beta, High Usage) are configured via `sidebar_custom_props: { badge: n/p/b/h }` in page frontmatter
- Rendered by `src/theme/RenderTag.js`, styled in `src/css/custom.css`
- Supported in sidebar links, sidebar categories, and page titles via swizzled theme components
70 changes: 48 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
# Market Data Documentation

This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator.
The official documentation for [Market Data](https://www.marketdata.app/) — covering the REST API, SDKs, and Google Sheets Add-On. Built with [Docusaurus 3](https://docusaurus.io/).

### Installation
```
$ yarn
```
### Local Development
```
$ yarn start
```
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
### Build
```
$ yarn build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Deployment
Using SSH:
```
$ USE_SSH=true yarn deploy
**Production:** [www.marketdata.app/docs/](https://www.marketdata.app/docs/)
**Staging:** [www.marketdata.app/docs-staging/](https://www.marketdata.app/docs-staging/)

## Documentation Sections

| Section | Path | Description |
|---------|------|-------------|
| **API** | `/api` | REST API reference — stocks, options, indices, funds, markets, and utilities |
| **SDKs** | `/sdk` | Client libraries for Go, Python, and PHP |
| **Sheets Add-On** | `/sheets` | Google Sheets Add-On documentation |
| **Accounts & Billing** | `/account` | Account management, plans, billing, and entitlements |

## Local Development

```bash
yarn # Install dependencies
yarn start # Start dev server at localhost:3000
yarn build # Production build
```
Not using SSH:

## Deployment

The site is hosted on **Cloudflare Pages** with a **Cloudflare Worker** reverse proxy. Deployment is fully automated via GitHub Actions.

1. Push to `staging` — deploys to the staging site
2. Verify changes at the staging URL
3. Open a PR from `staging` → `main` and merge — deploys to production

The CI pipeline (`.github/workflows/deploy-docs.yml`) builds the Docusaurus site, restructures the output to match the `/docs/` and `/docs-staging/` URL paths, generates cache headers, and deploys via Wrangler.

## Project Structure

```
$ GIT_USER=<Your GitHub username> yarn deploy
api/ # API reference docs (MDX)
sdk/ # SDK docs — Go, Python, PHP (MDX)
sheets/ # Google Sheets Add-On docs (MDX)
account/ # Account & billing docs (MDX)
src/
theme/ # Swizzled Docusaurus theme components
css/ # Custom styles
worker/ # Cloudflare Worker reverse proxy
.github/workflows # CI/CD pipeline
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

## Search

Search is powered by [Algolia DocSearch](https://docsearch.algolia.com/). The crawler configuration is managed in the Algolia dashboard, not in this repository.

## License

MIT
4 changes: 3 additions & 1 deletion api/funds/candles.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Candles tg n
title: Candles
sidebar_position: 1
sidebar_custom_props:
badge: n
---

import Tabs from "@theme/Tabs";
Expand Down
4 changes: 3 additions & 1 deletion api/options/quotes.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Quotes tg h
title: Quotes
sidebar_position: 4
tags:
- "API: High Usage"
sidebar_custom_props:
badge: h
---

Get a current or historical end of day quote for a single options contract.
Expand Down
4 changes: 3 additions & 1 deletion api/stocks/earnings.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Earnings tg p
title: Earnings
sidebar_position: 4
tags:
- "API: Premium"
sidebar_custom_props:
badge: p
---

Get historical earnings per share data or a future earnings calendar for a stock.
Expand Down
4 changes: 3 additions & 1 deletion api/stocks/news.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: News tg b
title: News
sidebar_position: 5
tags:
- "API: Beta"
sidebar_custom_props:
badge: b
---

:::warning Beta Endpoint
Expand Down
4 changes: 3 additions & 1 deletion api/stocks/prices.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Real-Time Prices tg h
title: Real-Time Prices
sidebar_position: 1
tags:
- "API: High Usage"
sidebar_custom_props:
badge: h
---

Get real-time midpoint prices for one or more stocks. This endpoint returns real-time prices for stocks, using the [SmartMid](https://www.marketdata.app/smart-mid/) model.
Expand Down
4 changes: 3 additions & 1 deletion api/utilities/status.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: API Status tg n
title: API Status
sidebar_position: 1
sidebar_custom_props:
badge: n
---

import Tabs from "@theme/Tabs";
Expand Down
2 changes: 2 additions & 0 deletions sdk/php/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: PHP SDK
sidebar_position: 4
slug: /php
sidebar_custom_props:
badge: n
---

Welcome to the Market Data PHP SDK documentation. This SDK allows you to easily integrate Market Data services into your PHP applications.
Expand Down
2 changes: 2 additions & 0 deletions sdk/py/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Python SDK
sidebar_position: 3
slug: /py
sidebar_custom_props:
badge: n
---

Welcome to the Market Data Python SDK documentation. This SDK allows you to easily integrate Market Data services into your Python applications.
Expand Down
6 changes: 2 additions & 4 deletions src/theme/DocBreadcrumbs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ import { translate } from "@docusaurus/Translate";
import HomeBreadcrumbItem from "@theme/DocBreadcrumbs/Items/Home";
import EditThisPage from "@theme/EditThisPage";
import styles from "./styles.module.css";
import { getLabelAndTag } from "@site/src/utils/functions";
// TODO move to design system folder
function BreadcrumbsItemLink({ children, href, isLast }) {
let { label, tag } = getLabelAndTag({ label: children });
const className = "breadcrumbs__link";
if (isLast) {
return (
<span className={className} itemProp="name">
{label}
{children}
</span>
);
}
Expand Down Expand Up @@ -60,7 +58,7 @@ export default function DocBreadcrumbs() {
const { editUrl } = metadata;
const windowSize = useWindowSize();
const isDesktop = windowSize === "desktop" || windowSize === "ssr";

if (!breadcrumbs) {
return null;
}
Expand Down
6 changes: 2 additions & 4 deletions src/theme/DocCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import isInternalUrl from "@docusaurus/isInternalUrl";
import { translate } from "@docusaurus/Translate";
import Heading from "@theme/Heading";
import styles from "./styles.module.css";
import { getLabelAndTag } from "@site/src/utils/functions";
function CardContainer({ href, children }) {
return (
<Link
Expand All @@ -20,14 +19,13 @@ function CardContainer({ href, children }) {
);
}
function CardLayout({ href, icon, title, description }) {
let { label, tag } = getLabelAndTag({ label: title || "" });
return (
<CardContainer href={href}>
<Heading
as="h2"
className={clsx("text--truncate", styles.cardTitle)}
title={label}>
{icon} {label}
title={title}>
{icon} {title}
</Heading>
{description && (
<p
Expand Down
8 changes: 4 additions & 4 deletions src/theme/DocItem/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useDoc } from "@docusaurus/theme-common/internal";
import Heading from "@theme/Heading";
import MDXContent from "@theme/MDXContent";
import RenderTag from "../../RenderTag";
import { getLabelAndTag } from "@site/src/utils/functions";
/**
Title can be declared inside md content or declared through
front matter and added manually. To make both cases consistent,
Expand All @@ -27,7 +26,8 @@ function useSyntheticTitle() {
}
export default function DocItemContent({ children }) {
const syntheticTitle = useSyntheticTitle();
let { label, tag } = getLabelAndTag({ label: syntheticTitle || "" });
const { frontMatter } = useDoc();
const badge = frontMatter.sidebar_custom_props?.badge;
return (
<div className={clsx(ThemeClassNames.docs.docMarkdown, "markdown")}>
{syntheticTitle && (
Expand All @@ -38,7 +38,7 @@ export default function DocItemContent({ children }) {
alignItems: "center",
display: "flex",
}}>
{`${label} `}
{`${syntheticTitle} `}
<div
style={{
height: "100%",
Expand All @@ -47,7 +47,7 @@ export default function DocItemContent({ children }) {
justifyContent: "center",
paddingTop: 7,
}}>
<RenderTag tag={tag} />
<RenderTag tag={badge} />
</div>
</Heading>
</header>
Expand Down
4 changes: 1 addition & 3 deletions src/theme/DocItem/Metadata/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from "react";
import { PageMetadata } from "@docusaurus/theme-common";
import { useDoc } from "@docusaurus/theme-common/internal";
import { getLabelAndTag } from "@site/src/utils/functions";

export default function DocItemMetadata() {
const { metadata, frontMatter, assets } = useDoc();
let { label, tag } = getLabelAndTag({ label: metadata.title || "" });
return (
<PageMetadata
title={label}
title={metadata.title}
description={metadata.description}
keywords={frontMatter.keywords}
image={assets.image ?? frontMatter.image}
Expand Down
5 changes: 4 additions & 1 deletion src/theme/DocSidebarItem/Category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Link from '@docusaurus/Link';
import {translate} from '@docusaurus/Translate';
import useIsBrowser from '@docusaurus/useIsBrowser';
import DocSidebarItems from '@theme/DocSidebarItems';
import RenderTag from '../../RenderTag';
// If we navigate to a category and it becomes active, it should automatically
// expand itself
function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed}) {
Expand Down Expand Up @@ -86,7 +87,8 @@ export default function DocSidebarItemCategory({
index,
...props
}) {
const {items, label, collapsible, className, href} = item;
const {items, label, collapsible, className, href, customProps} = item;
const badge = customProps?.badge;
const {
docs: {
sidebar: {autoCollapseCategories},
Expand Down Expand Up @@ -163,6 +165,7 @@ export default function DocSidebarItemCategory({
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
{...props}>
{label}
<RenderTag size="small" tag={badge} />
</Link>
{href && collapsible && (
<CollapseButton
Expand Down
10 changes: 3 additions & 7 deletions src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import isInternalUrl from "@docusaurus/isInternalUrl";
import IconExternalLink from "@theme/Icon/ExternalLink";
import styles from "./styles.module.css";
import RenderTag from "../../RenderTag";
import { getLabelAndTag } from "@site/src/utils/functions";

export default function DocSidebarItemLink({
item,
Expand All @@ -17,13 +16,10 @@ export default function DocSidebarItemLink({
index,
...props
}) {
let { href, label, className, autoAddBaseUrl } = item;
const labelTag = getLabelAndTag({ label });
label = labelTag.label;
const tag = labelTag.tag;
const { href, label, className, autoAddBaseUrl, customProps } = item;
const badge = customProps?.badge;
const isActive = isActiveSidebarItem(item, activePath);
const isInternalLink = isInternalUrl(href);
// const { metadata, frontMatter, contentTitle } = useDoc();
return (
<li
className={clsx(
Expand All @@ -49,7 +45,7 @@ export default function DocSidebarItemLink({
})}
{...props}>
{label}
<RenderTag size="small" tag={tag} />
<RenderTag size="small" tag={badge} />
{!isInternalLink && <IconExternalLink />}
</Link>
</li>
Expand Down
4 changes: 1 addition & 3 deletions src/theme/PaginatorNavLink/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from "react";
import clsx from "clsx";
import Link from "@docusaurus/Link";
import { getLabelAndTag } from "@site/src/utils/functions";
export default function PaginatorNavLink(props) {
const { permalink, title, subLabel, isNext } = props;
let { label, tag } = getLabelAndTag({ label: title || "" });
return (
<Link
className={clsx(
Expand All @@ -13,7 +11,7 @@ export default function PaginatorNavLink(props) {
)}
to={permalink}>
{subLabel && <div className="pagination-nav__sublabel">{subLabel}</div>}
<div className="pagination-nav__label">{label}</div>
<div className="pagination-nav__label">{title}</div>
</Link>
);
}
13 changes: 0 additions & 13 deletions src/utils/functions.js

This file was deleted.