pdmt5 0.0.9__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdmt5-0.0.9 → pdmt5-0.1.0}/CLAUDE.md +1 -1
- {pdmt5-0.0.9 → pdmt5-0.1.0}/PKG-INFO +1 -1
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pdmt5/trading.py +2 -2
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pyproject.toml +1 -1
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/test_trading.py +13 -25
- {pdmt5-0.0.9 → pdmt5-0.1.0}/uv.lock +1 -1
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.claude/settings.json +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.github/FUNDING.yml +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.github/copilot-instructions.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.github/dependabot.yml +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.github/workflows/ci.yml +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/.gitignore +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/LICENSE +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/README.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/api/dataframe.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/api/index.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/api/mt5.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/api/trading.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/api/utils.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/docs/index.md +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/mkdocs.yml +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pdmt5/__init__.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pdmt5/dataframe.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pdmt5/mt5.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/pdmt5/utils.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/renovate.json +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/__init__.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/test_dataframe.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/test_init.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/test_mt5.py +0 -0
- {pdmt5-0.0.9 → pdmt5-0.1.0}/test/test_utils.py +0 -0
|
@@ -113,7 +113,7 @@ Uses MkDocs with Material theme for API documentation built from Google-style do
|
|
|
113
113
|
|
|
114
114
|
## Web Search Instructions
|
|
115
115
|
|
|
116
|
-
For tasks requiring web search, always use Gemini CLI (`gemini` command) instead of the built-in web search
|
|
116
|
+
For tasks requiring web search, always use Gemini CLI (`gemini` command) instead of the built-in web search tools (WebFetch and WebSearch).
|
|
117
117
|
Gemini CLI is an AI workflow tool that provides reliable web search capabilities.
|
|
118
118
|
|
|
119
119
|
### Usage
|
|
@@ -161,13 +161,13 @@ class Mt5TradingClient(Mt5DataClient):
|
|
|
161
161
|
"""
|
|
162
162
|
symbol_info = self.symbol_info_as_dict(symbol=symbol)
|
|
163
163
|
symbol_info_tick = self.symbol_info_tick_as_dict(symbol=symbol)
|
|
164
|
-
min_ask_order_margin = self.
|
|
164
|
+
min_ask_order_margin = self.order_calc_margin(
|
|
165
165
|
action=self.mt5.ORDER_TYPE_BUY,
|
|
166
166
|
symbol=symbol,
|
|
167
167
|
volume=symbol_info["volume_min"],
|
|
168
168
|
price=symbol_info_tick["ask"],
|
|
169
169
|
)
|
|
170
|
-
min_bid_order_margin = self.
|
|
170
|
+
min_bid_order_margin = self.order_calc_margin(
|
|
171
171
|
action=self.mt5.ORDER_TYPE_SELL,
|
|
172
172
|
symbol=symbol,
|
|
173
173
|
volume=symbol_info["volume_min"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pdmt5"
|
|
3
|
-
version = "0.0
|
|
3
|
+
version = "0.1.0"
|
|
4
4
|
description = "Pandas-based data handler for MetaTrader 5"
|
|
5
5
|
authors = [{name = "dceoy", email = "dceoy@users.noreply.github.com"}]
|
|
6
6
|
maintainers = [{name = "dceoy", email = "dceoy@users.noreply.github.com"}]
|
|
@@ -642,17 +642,17 @@ class TestMt5TradingClient:
|
|
|
642
642
|
|
|
643
643
|
# Verify first call (buy order)
|
|
644
644
|
first_call = mock_mt5_import.order_calc_margin.call_args_list[0]
|
|
645
|
-
assert first_call[
|
|
646
|
-
assert first_call[
|
|
647
|
-
assert first_call[
|
|
648
|
-
assert first_call[
|
|
645
|
+
assert first_call[0][0] == mock_mt5_import.ORDER_TYPE_BUY # action
|
|
646
|
+
assert first_call[0][1] == "EURUSD" # symbol
|
|
647
|
+
assert first_call[0][2] == 0.01 # volume
|
|
648
|
+
assert first_call[0][3] == 1.1000 # price
|
|
649
649
|
|
|
650
650
|
# Verify second call (sell order)
|
|
651
651
|
second_call = mock_mt5_import.order_calc_margin.call_args_list[1]
|
|
652
|
-
assert second_call[
|
|
653
|
-
assert second_call[
|
|
654
|
-
assert second_call[
|
|
655
|
-
assert second_call[
|
|
652
|
+
assert second_call[0][0] == mock_mt5_import.ORDER_TYPE_SELL # action
|
|
653
|
+
assert second_call[0][1] == "EURUSD" # symbol
|
|
654
|
+
assert second_call[0][2] == 0.01 # volume
|
|
655
|
+
assert second_call[0][3] == 1.0998 # price
|
|
656
656
|
|
|
657
657
|
def test_calculate_minimum_order_margins_failure_ask(
|
|
658
658
|
self,
|
|
@@ -678,13 +678,9 @@ class TestMt5TradingClient:
|
|
|
678
678
|
# Mock order_calc_margin to return None for ask margin
|
|
679
679
|
mock_mt5_import.order_calc_margin.side_effect = [None, 99.8]
|
|
680
680
|
|
|
681
|
-
with pytest.raises(
|
|
681
|
+
with pytest.raises(Mt5RuntimeError):
|
|
682
682
|
client.calculate_minimum_order_margins("EURUSD")
|
|
683
683
|
|
|
684
|
-
assert "Failed to calculate minimum order margins for symbol: EURUSD" in str(
|
|
685
|
-
exc_info.value
|
|
686
|
-
)
|
|
687
|
-
|
|
688
684
|
def test_calculate_minimum_order_margins_failure_bid(
|
|
689
685
|
self,
|
|
690
686
|
mock_mt5_import: ModuleType,
|
|
@@ -709,13 +705,9 @@ class TestMt5TradingClient:
|
|
|
709
705
|
# Mock order_calc_margin to return None for bid margin
|
|
710
706
|
mock_mt5_import.order_calc_margin.side_effect = [100.5, None]
|
|
711
707
|
|
|
712
|
-
with pytest.raises(
|
|
708
|
+
with pytest.raises(Mt5RuntimeError):
|
|
713
709
|
client.calculate_minimum_order_margins("EURUSD")
|
|
714
710
|
|
|
715
|
-
assert "Failed to calculate minimum order margins for symbol: EURUSD" in str(
|
|
716
|
-
exc_info.value
|
|
717
|
-
)
|
|
718
|
-
|
|
719
711
|
def test_calculate_minimum_order_margins_failure_both(
|
|
720
712
|
self,
|
|
721
713
|
mock_mt5_import: ModuleType,
|
|
@@ -737,12 +729,8 @@ class TestMt5TradingClient:
|
|
|
737
729
|
"bid": 1.0998,
|
|
738
730
|
}
|
|
739
731
|
|
|
740
|
-
# Mock order_calc_margin to return
|
|
741
|
-
mock_mt5_import.order_calc_margin.side_effect = [
|
|
732
|
+
# Mock order_calc_margin to return 0.0 for both margins (indicates failure)
|
|
733
|
+
mock_mt5_import.order_calc_margin.side_effect = [0.0, 0.0]
|
|
742
734
|
|
|
743
|
-
with pytest.raises(Mt5TradingError)
|
|
735
|
+
with pytest.raises(Mt5TradingError):
|
|
744
736
|
client.calculate_minimum_order_margins("EURUSD")
|
|
745
|
-
|
|
746
|
-
assert "Failed to calculate minimum order margins for symbol: EURUSD" in str(
|
|
747
|
-
exc_info.value
|
|
748
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|