Ditto
Native account metadata, analytics, and position and stop monitors. Broker execution remains unavailable.
Part of FlintTrade: the open-source self-hosted trading software monorepo built with Python, React, TypeScript, and Rust.
Language: Python
Public surface
src/flinttrade_ditto/account_manager.py: non-secret native account metadata; sessions remain gateway-ownedsrc/flinttrade_ditto/mirror.py: allocation and position-monitor primitives; native copy execution unavailablesrc/flinttrade_ditto/margin_calculator.py: margin calculations and estimatessrc/flinttrade_ditto/trailing_sl.py: trailing-stop calculations and monitor statesrc/flinttrade_ditto/risk_manager.py: exposure and drawdown checks
(See the source for the full surface.)
Install
This package is part of the FlintTrade monorepo. Install via the workspace from the repo root:
uv pip install -e packages/services/dittoIf you only want to use the package in isolation, the package's pyproject.toml,
Cargo.toml, or package.json lists its dependencies. The supported path is the
root workspace.
Tests
python -m pytest packages/services/ditto/tests/ -v --import-mode=importlibRun one command per line. They work unchanged in bash, zsh and Windows
PowerShell. Do not join them with &&, which Windows PowerShell 5.1 does not
support.
For the full test matrix, see the contributor guide at docs/DEVELOPER_GUIDE.md.
How this fits in
This package's role in the wider FlintTrade architecture is documented in docs/ARCHITECTURE.md. For the end-user features it provides, see docs/USER_GUIDE.md.
Contributing
Contributions are welcome. Read contributing.md at the repo root before opening a pull request.
License
AGPL-3.0. Same as the parent repository. See LICENSE for the full text.
Backtest Engine
Strategy simulator, walk-forward and Monte Carlo testing, portfolio backtester, and 94 strategy template modules across 6 categories.
Engine
Five-layer order admission, gated scheduled strategies, a scheduler, a base strategy class, an AST-guarded sandbox, bracket orders, a mode guard, and reconciliation.