@@ -18,117 +18,94 @@ async def test_clientAsync_initialization(clientAsync):
1818@pytest .mark .skip (reason = "Endpoint not documented" )
1919async def test_get_products (clientAsync ):
2020 await clientAsync .get_products ()
21-
21+
2222
2323async def test_get_exchange_info (clientAsync ):
2424 await clientAsync .get_exchange_info ()
25-
26-
25+
2726async def test_get_symbol_info (clientAsync ):
2827 await clientAsync .get_symbol_info ("BTCUSDT" )
29-
28+
3029
3130async def test_ping (clientAsync ):
3231 await clientAsync .ping ()
33-
34-
32+
3533async def test_get_server_time (clientAsync ):
3634 await clientAsync .get_server_time ()
37-
38-
35+
3936async def test_get_all_tickers (clientAsync ):
4037 await clientAsync .get_all_tickers ()
4138
42-
4339async def test_get_orderbook_tickers (clientAsync ):
4440 await clientAsync .get_orderbook_tickers ()
45-
46-
41+
4742async def test_get_order_book (clientAsync ):
4843 await clientAsync .get_order_book (symbol = "BTCUSDT" )
49-
50-
44+
5145async def test_get_recent_trades (clientAsync ):
5246 await clientAsync .get_recent_trades (symbol = "BTCUSDT" )
5347
5448
5549async def test_get_historical_trades (clientAsync ):
5650 await clientAsync .get_historical_trades (symbol = "BTCUSDT" )
57-
51+
5852
5953async def test_get_aggregate_trades (clientAsync ):
6054 await clientAsync .get_aggregate_trades (symbol = "BTCUSDT" )
61-
62-
55+
6356async def test_get_klines (clientAsync ):
6457 await clientAsync .get_klines (symbol = "BTCUSDT" , interval = "1d" )
65-
66-
58+
6759async def test_get_uiklines (clientAsync ):
6860 await clientAsync .get_ui_klines (symbol = "BTCUSDT" , interval = "1d" )
69-
70-
61+
7162async def test_futures_mark_price_klines (clientAsync ):
7263 await clientAsync .futures_mark_price_klines (symbol = "BTCUSDT" , interval = "1h" )
73-
74-
64+
7565async def test_futures_index_price_klines (clientAsync ):
7666 await clientAsync .futures_index_price_klines (pair = "BTCUSDT" , interval = "1h" )
77-
78-
67+
7968async def test_futures_premium_index_klines (clientAsync ):
8069 await clientAsync .futures_premium_index_klines (symbol = "BTCUSDT" , interval = "1h" )
81-
82-
70+
8371@pytest .mark .skip (reason = "network error" )
8472async def test_futures_coin_premium_index_klines (clientAsync ):
8573 await clientAsync .futures_coin_premium_index_klines (symbol = "BTCUSD" , interval = "1h" )
86-
87-
74+
8875async def test_get_avg_price (clientAsync ):
8976 await clientAsync .get_avg_price (symbol = "BTCUSDT" )
90-
91-
77+
9278async def test_get_ticker (clientAsync ):
9379 await clientAsync .get_ticker (symbol = "BTCUSDT" )
94-
95-
80+
9681async def test_get_symbol_ticker (clientAsync ):
9782 await clientAsync .get_symbol_ticker (symbol = "BTCUSDT" )
98-
99-
83+
10084async def test_get_orderbook_ticker (clientAsync ):
10185 await clientAsync .get_orderbook_ticker (symbol = "BTCUSDT" )
102-
103-
86+
10487async def test_get_account (clientAsync ):
10588 await clientAsync .get_account ()
106-
107-
89+
10890async def test_get_asset_balance (clientAsync ):
10991 await clientAsync .get_asset_balance (asset = "BTC" )
110-
111-
92+
11293async def test_get_asset_balance_no_asset_provided (clientAsync ):
11394 await clientAsync .get_asset_balance ()
114-
115-
95+
11696async def test_get_my_trades (clientAsync ):
11797 await clientAsync .get_my_trades (symbol = "BTCUSDT" )
118-
119-
98+
12099async def test_get_system_status (clientAsync ):
121100 await clientAsync .get_system_status ()
122-
123-
101+
124102# User Stream Endpoints
125103
126104
127105async def test_stream_get_listen_key_and_close (clientAsync ):
128106 listen_key = await clientAsync .stream_get_listen_key ()
129107 await clientAsync .stream_close (listen_key )
130-
131-
108+
132109# Quoting interface endpoints
133110
134111
@@ -139,76 +116,62 @@ async def test_stream_get_listen_key_and_close(clientAsync):
139116
140117async def test_ws_get_order_book (clientAsync ):
141118 await clientAsync .ws_get_order_book (symbol = "BTCUSDT" )
142-
143-
119+
144120async def test_ws_get_recent_trades (clientAsync ):
145121 await clientAsync .ws_get_recent_trades (symbol = "BTCUSDT" )
146-
147-
122+
148123async def test_ws_get_historical_trades (clientAsync ):
149124 await clientAsync .ws_get_historical_trades (symbol = "BTCUSDT" )
150-
151-
125+
152126async def test_ws_get_aggregate_trades (clientAsync ):
153127 await clientAsync .ws_get_aggregate_trades (symbol = "BTCUSDT" )
154-
155-
128+
156129async def test_ws_get_klines (clientAsync ):
157130 await clientAsync .ws_get_klines (symbol = "BTCUSDT" , interval = "1m" )
158-
159-
131+
160132async def test_ws_get_uiKlines (clientAsync ):
161133 await clientAsync .ws_get_uiKlines (symbol = "BTCUSDT" , interval = "1m" )
162-
163-
134+
164135async def test_ws_get_avg_price (clientAsync ):
165136 await clientAsync .ws_get_avg_price (symbol = "BTCUSDT" )
166-
167-
137+
168138async def test_ws_get_ticker (clientAsync ):
169139 ticker = await clientAsync .ws_get_ticker (symbol = "BTCUSDT" )
170-
171-
140+
172141async def test_ws_get_trading_day_ticker (clientAsync ):
173142 await clientAsync .ws_get_trading_day_ticker (symbol = "BTCUSDT" )
174-
175-
143+
176144async def test_ws_get_symbol_ticker_window (clientAsync ):
177145 await clientAsync .ws_get_symbol_ticker_window (symbol = "BTCUSDT" )
178-
179-
146+
180147async def test_ws_get_symbol_ticker (clientAsync ):
181148 await clientAsync .ws_get_symbol_ticker (symbol = "BTCUSDT" )
182-
183-
149+
184150async def test_ws_get_orderbook_ticker (clientAsync ):
185151 await clientAsync .ws_get_orderbook_ticker (symbol = "BTCUSDT" )
186-
187-
152+
188153async def test_ws_ping (clientAsync ):
189154 await clientAsync .ws_ping ()
190-
191-
155+
192156async def test_ws_get_time (clientAsync ):
193157 await clientAsync .ws_get_time ()
194-
195-
158+
196159async def test_ws_get_exchange_info (clientAsync ):
197160 await clientAsync .ws_get_exchange_info (symbol = "BTCUSDT" )
198-
161+
199162@pytest .mark .skip (reason = "can't test margin endpoints" )
200163async def test_margin_next_hourly_interest_rate (clientAsync ):
201164 await clientAsync .margin_next_hourly_interest_rate (
202165 assets = "BTC" ,
203166 isIsolated = "FALSE"
204167 )
205-
168+
206169@pytest .mark .skip (reason = "can't test margin endpoints" )
207170async def test_margin_interest_history (clientAsync ):
208171 await clientAsync .margin_interest_history (
209172 asset = "BTC" ,
210173 )
211-
174+
212175@pytest .mark .skip (reason = "can't test margin endpoints" )
213176async def test_margin_borrow_repay (clientAsync ):
214177 await clientAsync .margin_borrow_repay (
@@ -218,27 +181,26 @@ async def test_margin_borrow_repay(clientAsync):
218181 symbol = "BTCUSDT" ,
219182 type = "BORROW"
220183 )
221-
184+
222185@pytest .mark .skip (reason = "can't test margin endpoints" )
223186async def test_margin_get_borrow_repay_records (clientAsync ):
224187 await clientAsync .margin_get_borrow_repay_records (
225188 asset = "BTC" ,
226189 isolatedSymbol = "BTCUSDT" ,
227190 )
228-
191+
229192@pytest .mark .skip (reason = "can't test margin endpoints" )
230193async def test_margin_interest_rate_history (clientAsync ):
231194 await clientAsync .margin_interest_rate_history (
232195 asset = "BTC" ,
233196 )
234-
197+
235198@pytest .mark .skip (reason = "can't test margin endpoints" )
236199async def test_margin_max_borrowable (clientAsync ):
237200 await clientAsync .margin_max_borrowable (
238201 asset = "BTC" ,
239202 )
240-
241-
203+
242204async def test_time_unit_microseconds ():
243205 micro_client = AsyncClient (
244206 api_key , api_secret , https_proxy = proxy , testnet = testnet , time_unit = "MICROSECOND"
@@ -247,7 +209,7 @@ async def test_time_unit_microseconds():
247209 assert len (str (micro_trades [0 ]["time" ])) >= 16 , (
248210 "Time should be in microseconds (16+ digits)"
249211 )
250-
212+ await micro_client . close_connection ()
251213
252214async def test_time_unit_milloseconds ():
253215 milli_client = AsyncClient (
@@ -257,6 +219,7 @@ async def test_time_unit_milloseconds():
257219 assert len (str (milli_trades [0 ]["time" ])) == 13 , (
258220 "Time should be in milliseconds (13 digits)"
259221 )
222+ await milli_client .close_connection ()
260223
261224
262225async def test_handle_response (clientAsync ):
@@ -295,3 +258,4 @@ async def test_handle_response(clientAsync):
295258 mock_response ._body = b'error message'
296259 with pytest .raises (BinanceAPIException ):
297260 await clientAsync ._handle_response (mock_response )
261+
0 commit comments