File tree Expand file tree Collapse file tree 2 files changed +2
-11
lines changed Expand file tree Collapse file tree 2 files changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -53,4 +53,5 @@ def release(self) -> bool:
53
53
Returns:
54
54
bool: True if successful, False otherwise.
55
55
"""
56
- return Mt5 .market_book_release (self .symbol )
56
+ result = Mt5 .market_book_release (self .symbol )
57
+ return False if result is None else result
Original file line number Diff line number Diff line change @@ -91,45 +91,35 @@ def test_full_workflow(symbol):
91
91
92
92
def test_multiple_symbols ():
93
93
"""Test using Book with multiple symbols simultaneously."""
94
- # Get available symbols
95
94
symbols = Mt5 .symbols_get ()
96
95
if len (symbols ) < 2 :
97
96
pytest .skip ("Need at least 2 symbols for this test" )
98
97
99
- # Select two different symbols
100
98
symbol1 = symbols [0 ].name
101
99
symbol2 = symbols [1 ].name
102
100
103
- # Create books for both symbols
104
101
book1 = Book (symbol1 )
105
102
book2 = Book (symbol2 )
106
103
107
- # Wait for market books to populate
108
104
time .sleep (1 )
109
105
110
- # Get market data for both symbols
111
106
data1 = book1 .get ()
112
107
data2 = book2 .get ()
113
108
114
- # Verify both returned data
115
109
assert data1 is not None
116
110
assert data2 is not None
117
111
118
- # Clean up
119
112
book1 .release ()
120
113
book2 .release ()
121
114
122
115
def test_unavailable_symbol (caplog ):
123
116
"""Test behavior with an unavailable symbol."""
124
117
caplog .set_level (logging .ERROR )
125
118
126
- # Use an invalid symbol name
127
119
invalid_symbol = "INVALID_SYMBOL_THAT_DOESNT_EXIST"
128
120
129
- # Create a book with invalid symbol
130
121
book = Book (invalid_symbol )
131
122
132
- # Check that an error was logged
133
123
assert "Error adding INVALID_SYMBOL_THAT_DOESNT_EXIST to the market book" in caplog .text
134
124
135
125
release_result = book .release ()
You can’t perform that action at this time.
0 commit comments