OpenClaw Trading Documentation
This directory contains the Sphinx documentation for OpenClaw Trading.
Building the Documentation
Prerequisites
Install documentation dependencies:
pip install sphinx sphinx-rtd-theme
Or install with all dev dependencies:
pip install -e ".[dev]"
Build HTML Documentation
cd docs
make html
The built documentation will be in build/html/.
Live Reload (for development)
make livehtml
This starts a local server that rebuilds documentation automatically when files change.
Clean Build
make clean
make html
Documentation Structure
source/
├── index.rst # Main documentation index
├── quickstart.rst # Quick start guide
├── installation.rst # Installation instructions
├── architecture.rst # System architecture overview
├── agents.rst # Agent documentation
├── workflow.rst # Workflow system documentation
├── factors.rst # Trading factors documentation
├── learning.rst # Learning system documentation
├── backtesting.rst # Backtesting system documentation
├── monitoring.rst # Monitoring and alerts documentation
├── configuration.rst # Configuration guide
├── deployment.rst # Deployment guide
├── examples.rst # Usage examples
├── api.rst # API reference (autogenerated)
├── conf.py # Sphinx configuration
├── _static/ # Static files (CSS, images)
└── _templates/ # HTML templates
Writing Documentation
reStructuredText Format
Documentation is written in reStructuredText (.rst) format.
Basic syntax:
Section Header
==============
Subsection
----------
This is a paragraph with **bold** and *italic* text.
- Bullet point 1
- Bullet point 2
#. Numbered item 1
#. Numbered item 2
Code blocks::
def hello():
print("Hello, World!")
Links:
- External: `Link text <https://example.com>`_
- Internal: :doc:`quickstart`
- Reference: :ref:`section-label`
Code Examples
Include code examples with:
.. code-block:: python
from openclaw.core.economy import TradingEconomicTracker
tracker = TradingEconomicTracker("agent_001", 1000.0)
Auto-generating API Docs
Use autodoc to generate API documentation from docstrings:
.. automodule:: openclaw.core.economy
:members:
:undoc-members:
:show-inheritance:
Cross-References
Link between documents:
See the :doc:`quickstart` for a quick introduction.
See :doc:`/api` for API reference.
For more details, see the :ref:`configuration-section` section.
Style Guidelines
- Line length: Keep lines under 100 characters
- Headings: Use sentence case
- Code: Always specify the language for syntax highlighting
- Examples: Include runnable code examples
- Links: Use descriptive link text
- Images: Place in
_static/directory - Formatting: Use consistent indentation (3 spaces)
Deploying Documentation
GitHub Pages
Deploy to GitHub Pages:
make deploy
This requires:
ghp-importinstalled:pip install ghp-import- Push access to the repository
Read the Docs
The documentation is automatically built and hosted on Read the Docs.
URL: https://openclaw-trading.readthedocs.io
Custom Server
Build and copy to web server:
make html
rsync -avz build/html/ user@server:/var/www/docs/
Testing Documentation
Check for Broken Links
make linkcheck
Check for Missing References
make html
# Check for warnings about undefined references
Updating Documentation
When adding new features:
- Update relevant
.rstfiles - Add code examples
- Update API reference
- Test build with
make html - Check for warnings/errors
- Commit changes
Help
For Sphinx documentation:
- Official docs: https://www.sphinx-doc.org/
- RST primer: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
- Autodoc extension: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html