11import json
22import time
33import unittest
4+ from cryptomarket .dataclasses .order import OrderStatus
45
56from test_helpers import *
67
@@ -23,6 +24,8 @@ def tearDown(self):
2324class GetTradingBalance (AuthCallsTestCase ):
2425 def test_successfull_call (self ):
2526 trading_balances = self .client .get_spot_trading_balances ()
27+ print ("**balances**" )
28+ print (trading_balances )
2629 if len (trading_balances ) == 0 :
2730 self .fail ("no balances" )
2831 if not good_list (good_balance , trading_balances ):
@@ -88,6 +91,7 @@ def test_successfull_call(self): # create order should work properly
8891 quantity = '0.01' ,
8992 client_order_id = client_order_id ,
9093 price = '1000' )
94+ print (order )
9195 if not good_order (order ):
9296 self .fail ("not good order" )
9397 # get
@@ -151,6 +155,23 @@ def test_successfull_call(self):
151155 order = self .client .get_active_spot_order (client_order_id )
152156
153157
158+
159+ class CancelOrderByClientId (AuthCallsTestCase ):
160+ def test_successfull_call (self ):
161+ order = self .client .create_spot_order (
162+ symbol = 'ADAUSDT' ,
163+ side = args .Side .BUY ,
164+ quantity = '5' ,
165+ type = args .OrderType .LIMIT ,
166+ price = '0.1'
167+ )
168+ assert (order .status == OrderStatus .NEW )
169+ time .sleep (5 )
170+ canceled_order = self .client .cancel_spot_order (order .client_order_id )
171+ assert (canceled_order .status == OrderStatus .CANCELED )
172+
173+
174+
154175class GetAllTradingCommissions (AuthCallsTestCase ):
155176 def test_successfull_call (self ):
156177 result = self .client .get_all_trading_commissions ()
@@ -204,6 +225,7 @@ def test_create_order_list(self):
204225 time_in_force = args .TimeInForce .FOK ,
205226 quantity = "0.1" ,
206227 price = "10000" )])
228+ print (orders )
207229 if not good_list (good_order , orders ):
208230 self .fail ("not valid orders: " + orders )
209231 self .client .cancel_all_orders ()
0 commit comments