Drop Mt5TradingError support; require pdmt5>=1.0.4 (#101)

* chore: upgrade pdmt5 to v1.0.4

pdmt5 1.0.4 removes Mt5TradingClient/Mt5TradingError entirely and wraps
Mt5Config.password in pydantic SecretStr. Drop the now-dead conditional
Mt5TradingError handling in mt5cli.exceptions/sdk/retry (mt5cli already
type-checks trading clients against its own protocol, so no functional
change), and unwrap SecretStr when forwarding a base config's password to
per-account configs. Update tests and docs accordingly.

* chore: declare pydantic as a direct runtime dependency

mt5cli.sdk imports SecretStr directly from pydantic, so pin it explicitly
instead of relying on pdmt5's transitive dependency.

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Daichi Narushima
2026-07-04 01:30:32 +09:00
committed by GitHub
parent efc0de230a
commit c2cf0656dd
10 changed files with 173 additions and 173 deletions
+3 -5
View File
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
import pandas as pd
import pytest
from pdmt5 import Mt5RuntimeError, Mt5TradingError
from pdmt5 import Mt5RuntimeError
from pytest_mock import MockerFixture # noqa: TC002
import mt5cli
@@ -26,7 +26,6 @@ from mt5cli import (
MT5Client,
Mt5CliError,
Mt5ConnectionError,
Mt5OperationError,
Mt5SchemaError,
OrderExecutionResult,
OrderLimits,
@@ -247,7 +246,7 @@ def test_granularity_name_maps_timeframe_alias() -> None:
@pytest.mark.parametrize(
"exc",
[Mt5RuntimeError("init failed"), Mt5TradingError("trade failed")],
[Mt5RuntimeError("init failed")],
)
def test_is_recoverable_mt5_error(exc: Exception) -> None:
"""Recoverable MT5 errors are classified consistently."""
@@ -258,12 +257,11 @@ def test_is_recoverable_mt5_error(exc: Exception) -> None:
("exc", "expected_type"),
[
(Mt5RuntimeError("x"), Mt5ConnectionError),
(Mt5TradingError("x"), Mt5OperationError),
],
)
def test_normalize_mt5_exception_maps_types(
exc: Exception,
expected_type: type[Mt5ConnectionError | Mt5OperationError],
expected_type: type[Mt5ConnectionError],
) -> None:
"""MT5 exceptions map to stable mt5cli types."""
assert isinstance(normalize_mt5_exception(exc), expected_type)