docs/developer_guide/docs.md
This guide outlines the style conventions and best practices for writing documentation for NautilusTrader.
The Markdown Style guide is the shared baseline for Markdown syntax and
formatting, and .markdownlint.jsonc enforces its mechanical subset. This guide covers what is
specific to NautilusTrader documentation rather than repeating that baseline.
Most pages should fit one of four types (Divio documentation system). Mixing types in a single page makes it harder to read and harder to maintain.
| Type | Purpose | Section |
|---|---|---|
| Tutorial | Teach by walking through a task | tutorials/ |
| How‑to guide | Solve a specific problem | how_to/ |
| Explanation | Clarify design and architecture | concepts/ |
| Reference | Describe the machinery | api_reference/ |
Two sections are exceptions: getting_started/ is an onboarding path that
combines tutorial-style walkthroughs with setup instructions, and
integrations/ pages mix reference (capabilities, symbology) with how-to
content (setup, configuration) so each venue page is self-contained.
Standalone how-to content that is not venue-specific belongs in how_to/.
A tutorial says "do this, then this, then this." The author picks the path. A how-to guide says "here is how to achieve X." The reader already knows they want X. Keep these distinct:
When one type needs to reference another, link to it instead of inlining. For
example, a how-to guide that configures TradingNodeConfig should link to the
API reference for field definitions rather than listing them again.
Table syntax, pipe alignment, and delimiter padding follow the Markdown Style guide.
| Order Type | Spot | Margin | USDT Futures | Coin Futures | Notes |
| ---------------------- | ---- | ------ | ------------ | ------------ | ----------------------- |
| `MARKET` | ✓ | ✓ | ✓ | ✓ | |
| `STOP_MARKET` | - | ✓ | ✓ | ✓ | Not supported for Spot. |
| `MARKET_IF_TOUCHED` | - | - | ✓ | ✓ | Futures only. |
✓ for supported features.- for unsupported features (not ✗ or other symbols).*Not supported*.*Not supported by <venue>*
for venue gaps, or *Not currently implemented* for adapter gaps.Inline code and fenced code blocks follow the Markdown Style guide.
When referencing code locations, use file_path::function_name or file_path::ClassName rather
than line numbers, which become stale as code changes.
Heading style, case, and hierarchy follow the Markdown Style guide: title case for the page heading, sentence case below it.
Always capitalize proper nouns regardless of heading level (product names, technologies, companies, acronyms).
List markers, ordering, and indentation follow the Markdown Style guide.
End list items with periods when they are complete sentences.
Link text, link style, and images follow the Markdown Style guide.
Reference external documentation when appropriate.
Use admonition blocks to highlight important information:
| Admonition | Purpose |
|---|---|
:::note | Supplementary context that clarifies but isn't essential. |
:::info | Important information the reader should be aware of. |
:::tip | Helpful suggestions or best practices. |
:::warning | Potential pitfalls or important caveats. |
:::danger | Critical issues that could cause data loss or system failure. |
Avoid overusing admonitions; too many diminish their impact.
The docs site (fumadocs) provides built-in MDX components available in all .md files.
No imports are needed.
Use tabs for language-specific or variant content. List Rust before Python so Rust is the default (left-most) tab.
For code examples, add tab="..." to consecutive fenced code blocks:
\`\`\`rust tab="Rust"
let params = Params::from([("close_position", true.into())]);
\`\`\`
\`\`\`python tab="Python"
strategy.submit_order(order, params={"close_position": True})
\`\`\`
For tables or other content, wrap each variant in <Tabs> and <Tab>. The instrument Fields
tables use this so each language shows a single type column instead of side-by-side Rust and
Python columns. Leave a blank line above and below the inner content so the Markdown renders.
<Tabs items={["Rust", "Python"]}>
<Tab value="Rust">
| Field | Type | Required/default | Notes |
| --------------- | -------------- | ---------------- | ----------------------- |
| `instrument_id` | `InstrumentId` | Required | Stored as `id` in Rust. |
</Tab>
<Tab value="Python">
| Field | Type | Required/default | Notes |
| --------------- | -------------- | ---------------- | ----- |
| `instrument_id` | `InstrumentId` | Required | |
</Tab>
</Tabs>
Use Steps and Step for sequential procedures.
<Steps>
<Step>
Configure the adapter.
</Step>
<Step>
Start the trading node.
</Step>
</Steps>
Use Accordions and Accordion for collapsible content.
<Accordions>
<Accordion title="Advanced configuration">
Content here.
</Accordion>
</Accordions>
Use Files, Folder, and File for directory tree visualizations.
<Files>
<Folder name="src" defaultOpen>
<File name="main.rs" />
<File name="lib.rs" />
</Folder>
</Files>
Use Cards and Card for linked content grids.
<Cards>
<Card title="Getting started" href="/latest/getting_started" />
<Card title="Concepts" href="/latest/concepts" />
</Cards>
Use TypeTable for parameter or type documentation tables.