b5e82e71c7
* Add trading session helpers and extend ThrottledHistoryUpdater Introduce mt5cli.trading with mt5_trading_session() for Mt5TradingClient lifecycle management and reusable operational helpers for position-side detection, margin/volume sizing, and protective order price derivation. Extend ThrottledHistoryUpdater to validate inputs before updates and to optionally suppress ValueError, OSError, and missing-method errors without advancing the throttle timestamp. Export the new helpers from mt5cli.__init__, add unit tests with mocked clients, and document migration guidance for downstream projects such as mteor. Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> * Narrow ThrottledHistoryUpdater suppress_errors handling (#27) * Narrow ThrottledHistoryUpdater suppress_errors for MT5 capability only Remove broad AttributeError/TypeError handling from recoverable errors. Add _is_mt5_client_capability_error() to detect missing history API methods or non-callable client attributes by message and attribute name. Generic AttributeError/TypeError values always propagate even when suppress_errors=True. Update docs and tests accordingly. Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> * Detect non-callable history client methods in suppress_errors Address review feedback: when a history API attribute exists but is not callable, Python raises a generic TypeError. Inspect the traceback for mt5cli.history client call sites so these capability mismatches are still suppressed without matching all TypeError values. Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> * Address PR review feedback on trading helpers - Resolve history module path once at import time - Only treat non-callable TypeErrors as capability errors at the raise site - Validate SL/TP ratios in determine_order_limits - Add tests for margin_free edge cases, body-raise shutdown, and internal TypeError propagation - Clarify ThrottledHistoryUpdater suppress_errors docs - Split README migration example into trading vs read-only history sessions Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> * Tighten protective ratio validation and clamp negative margin_free Add _require_protective_ratio enforcing 0 <= ratio < 1 for SL/TP limits so a ratio of 1.0 cannot produce zero protective prices. Clamp negative margin_free to 0.0 in calculate_margin_and_volume before sizing. Add boundary and negative-margin tests; document constraints in trading API docs. Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Daichi Narushima <dceoy@users.noreply.github.com>
77 lines
1.8 KiB
YAML
77 lines
1.8 KiB
YAML
site_name: mt5cli API Documentation
|
|
site_description: Command-line tool for MetaTrader 5
|
|
site_author: dceoy
|
|
site_url: https://github.com/dceoy/mt5cli
|
|
|
|
repo_name: dceoy/mt5cli
|
|
repo_url: https://github.com/dceoy/mt5cli
|
|
|
|
theme:
|
|
name: material
|
|
palette:
|
|
- scheme: default
|
|
primary: blue
|
|
accent: blue
|
|
toggle:
|
|
icon: material/brightness-7
|
|
name: Switch to dark mode
|
|
- scheme: slate
|
|
primary: blue
|
|
accent: blue
|
|
toggle:
|
|
icon: material/brightness-4
|
|
name: Switch to light mode
|
|
features:
|
|
- content.code.annotate
|
|
- content.code.copy
|
|
- content.code.mermaid
|
|
- navigation.indexes
|
|
- navigation.sections
|
|
- navigation.tabs
|
|
- navigation.top
|
|
- search.highlight
|
|
- search.share
|
|
- search.suggest
|
|
- toc.follow
|
|
|
|
plugins:
|
|
- search
|
|
- mkdocstrings:
|
|
handlers:
|
|
python:
|
|
paths: [.]
|
|
options:
|
|
show_source: true
|
|
show_root_heading: true
|
|
show_root_toc_entry: true
|
|
docstring_style: google
|
|
docstring_section_style: table
|
|
separate_signature: true
|
|
show_signature_annotations: true
|
|
signature_crossrefs: true
|
|
merge_init_into_class: true
|
|
show_if_no_docstring: true
|
|
|
|
nav:
|
|
- Home: index.md
|
|
- API Reference:
|
|
- Overview: api/index.md
|
|
- CLI: api/cli.md
|
|
- SDK: api/sdk.md
|
|
- Trading: api/trading.md
|
|
- History Collection (SQLite): api/history.md
|
|
- Utils: api/utils.md
|
|
|
|
markdown_extensions:
|
|
- admonition
|
|
- pymdownx.details
|
|
- pymdownx.superfences
|
|
- pymdownx.highlight:
|
|
anchor_linenums: true
|
|
- pymdownx.inlinehilite
|
|
- pymdownx.snippets
|
|
- pymdownx.tabbed:
|
|
alternate_style: true
|
|
- toc:
|
|
permalink: true
|