Skip to content

docs: add Java SDK documentation#154

Merged
MarketDataApp merged 5 commits into
MarketDataApp:stagingfrom
MarketDataDev03:01_sdk_java_docs
Jun 26, 2026
Merged

docs: add Java SDK documentation#154
MarketDataApp merged 5 commits into
MarketDataApp:stagingfrom
MarketDataDev03:01_sdk_java_docs

Conversation

@MarketDataDev03

Copy link
Copy Markdown

docs: add Java SDK documentation

Adds the documentation for the Java SDK under sdk/java/, following the same
structure and format as the existing SDK docs (Docusaurus MDX with <Tabs>). It
also adds Java and Kotlin code examples to the existing api/ reference pages,
alongside the other languages.

  • Base: MarketDataApp/documentationstaging
  • Head: MarketDataDev03:01_sdk_java_docs

What's included

sdk/java/ — the documentation (25 pages)

  • Getting started: index, installation, authentication, client, settings
  • Resources: stocks (candles, quotes, prices, news, earnings), options
    (lookup, expirations, strikes, quotes, chain), funds (candles), markets
    (status), utilities (status, user, headers)
  • Every quick-start has both a Java and a Kotlin example (first-class Kotlin
    interop is a requirement of the SDK).
  • All method signatures, request builders, response records, enums and exception
    types were verified against the SDK source — the snippets compile.

api/ — Java & Kotlin examples on every endpoint

Adds a Java tab and a Kotlin tab to every language-tab group in api/*
(alongside HTTP/JavaScript/TypeScript/Python/Go/PHP), so the REST reference shows
JVM examples too. 22 tab groups across 19 pages — coverage is complete
(Python = Java = Kotlin = 22).

  • Endpoint pages use the real SDK, mirroring the existing JavaScript example in
    each group (same symbols/variants).
  • api/stocks/bulkcandles: the SDK has no bulk-candles method yet, so the Java
    and Kotlin tabs use the JDK java.net.http.HttpClient directly with a :::note
    (same approach as the JS/TS/Python tabs there).
  • Troubleshooting pages (logging, real-time-data, service-outages,
    too-many-concurrent-requests) get tailored Java/Kotlin equivalents using the SDK's
    real features (logging via MARKETDATA_LOGGING_LEVEL, ServiceStatus,
    RateLimitError backoff, Mode.LIVE + StockQuote.updated()).

Shared files (flagging for review)

These touch site-wide files, not just sdk/java/:

  • sdk/index.mdx — adds the Java card to the SDK landing page.
  • static/img/java-logo.svg — the Java logo for that card.
  • docusaurus.config.js — adds java, kotlin, groovy to Prism
    additionalLanguages so the code blocks get syntax highlighting.

Docs → SDK sync (Phase 2)

Enables the existing sync pipeline for Java:

  • scripts/export-sdk-docs.js — adds java to SUPPORTED_SDKS.
  • .github/workflows/sync-sdk-docs.yml — adds java to the trigger paths, the
    workflow_dispatch options, and the job matrix.

Testing

  • yarn build passes with no broken links/anchors.
  • api/ tab coverage verified: every group that has a Python tab now has a Java and
    a Kotlin tab (22 / 22 / 22).
  • node scripts/export-sdk-docs.js --sdk java converts all 25 sdk/java .mdx
    clean .md + .sync-manifest.txt (Tabs → headings, no leftover JSX), exit 0.

Follow-up (NOT in this PR — needs org admin)

For the sync to actually publish to MarketDataApp/sdk-java, the
marketdata-docs-sync GitHub App must be granted access to the sdk-java repo
(Contents: R/W, Pull requests: R/W). Once granted, the first push to
staging touching sdk/java/** opens an automated PR in sdk-java.

Checklist

  • Base branch is staging (not main)
  • Preview verified on www-staging.marketdata.app/docs/sdk/java/ after merge
  • GitHub App granted access to sdk-java (separate, org admin)
  • Maven version in installation.mdx matches the published release

@MarketDataApp

Copy link
Copy Markdown
Owner

Guiding principle for the API-section SDK examples: optimize for "look how easy this is."

A reader skimming the API docs should see they can get data from us in 1–3 lines. The Java/Kotlin examples should read as minimally as the JS/Python ones next to them. Two concrete rules:

1. Use the convenience factory, not the builder, unless the example is about an optional param.

// instead of
StockCandlesRequest.builder(StockResolution.DAILY, "AAPL").build()
// use
StockCandlesRequest.of(StockResolution.DAILY, "AAPL")

Keep the builder only where the optional parameter is the point of the example (e.g. markets/status demonstrating .from(...).to(...)).

2. Let the records print themselves. Every response row is a Java record with a generated toString(). Replace field-by-field printf loops with:

candles.values().forEach(System.out::println);

Blocked on the SDK: the multi-symbol examples (stocks/quotes, troubleshooting/logging) use StockQuotesRequest.builder(...) because that type has no of(...) factory — every sibling request type has one. Tracked in MarketDataApp/sdk-java#17. Once that ships, these examples can go minimal too; until then they stay on the builder.

Net effect — the canonical single-quote example should look like this and nothing more:

try (MarketDataClient client = new MarketDataClient()) {
    client.stocks().quote(StockQuoteRequest.of("AAPL")).values().forEach(System.out::println);
}

@MarketDataDev03

Copy link
Copy Markdown
Author

Guiding principle for the API-section SDK examples: optimize for "look how easy this is."

A reader skimming the API docs should see they can get data from us in 1–3 lines. The Java/Kotlin examples should read as minimally as the JS/Python ones next to them. Two concrete rules:

1. Use the convenience factory, not the builder, unless the example is about an optional param.

// instead of
StockCandlesRequest.builder(StockResolution.DAILY, "AAPL").build()
// use
StockCandlesRequest.of(StockResolution.DAILY, "AAPL")

Keep the builder only where the optional parameter is the point of the example (e.g. markets/status demonstrating .from(...).to(...)).

2. Let the records print themselves. Every response row is a Java record with a generated toString(). Replace field-by-field printf loops with:

candles.values().forEach(System.out::println);

Blocked on the SDK: the multi-symbol examples (stocks/quotes, troubleshooting/logging) use StockQuotesRequest.builder(...) because that type has no of(...) factory — every sibling request type has one. Tracked in MarketDataApp/sdk-java#17. Once that ships, these examples can go minimal too; until then they stay on the builder.

Net effect — the canonical single-quote example should look like this and nothing more:

try (MarketDataClient client = new MarketDataClient()) {
    client.stocks().quote(StockQuoteRequest.of("AAPL")).values().forEach(System.out::println);
}

Thanks, makes sense — applied both rules across the api/ examples: switched to the .of(...) factory (keeping the builder only where an optional param is the point), and let the records print themselves via ....values().forEach(System.out::println).

For the blocked multi-symbol case, opened MarketDataApp/sdk-java#18 (closes #17), which adds the of(...) factory — those examples now use the minimal form too.

@MarketDataApp MarketDataApp merged commit 5dd69d3 into MarketDataApp:staging Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants