@@ -14,7 +14,7 @@ def teardown
1414 sleep ( 2 )
1515 end
1616
17- def gen_checker_callback ( checker )
17+ def gen_list_checker_callback ( checker )
1818 msg = ""
1919 callback = Proc . new { |error , result |
2020 if not error . nil?
@@ -29,7 +29,7 @@ def gen_checker_callback(checker)
2929 return { msg :msg , callback :callback }
3030 end
3131
32- def gen_not_list_checker_callback ( checker )
32+ def gen_checker_callback ( checker )
3333 msg = ""
3434 callback = Proc . new { |error , result |
3535 if not error . nil?
@@ -43,15 +43,15 @@ def gen_not_list_checker_callback(checker)
4343 end
4444
4545 def test_get_spot_trading_balance
46- hash = gen_not_list_checker_callback ( -> ( balance ) { goodBalance ( balance ) } )
46+ hash = gen_checker_callback ( -> ( balance ) { goodBalance ( balance ) } )
4747 @wsclient . get_spot_trading_balance ( callback :hash [ :callback ] , currency :"EOS" )
4848 sleep ( 3 )
4949 assert ( hash [ :msg ] == "" , hash [ :msg ] )
5050 end
5151
5252
5353 def test_get_spot_trading_balances
54- hash = gen_checker_callback ( -> ( balance ) {
54+ hash = gen_list_checker_callback ( -> ( balance ) {
5555 puts balance
5656 return goodBalance ( balance )
5757 } )
@@ -63,7 +63,7 @@ def test_get_spot_trading_balances
6363 def test_order_work_flow
6464 timestamp = Time . now . to_i . to_s
6565 symbol = 'EOSETH'
66- hash = gen_not_list_checker_callback ( -> ( order ) { goodOrder ( order ) } )
66+ hash = gen_checker_callback ( -> ( order ) { goodOrder ( order ) } )
6767 @wsclient . create_spot_order (
6868 client_order_id :timestamp ,
6969 symbol : symbol ,
@@ -74,7 +74,7 @@ def test_order_work_flow
7474 )
7575 sleep ( 3 )
7676 assert ( hash [ :msg ] == "" , hash [ :msg ] )
77- hash2 = gen_not_list_checker_callback ( -> ( result ) {
77+ hash2 = gen_checker_callback ( -> ( result ) {
7878 for order in result
7979 if order [ 'client_order_id' ] == timestamp
8080 return true
@@ -96,7 +96,7 @@ def test_order_work_flow
9696 )
9797 sleep ( 3 )
9898 assert ( hash [ :msg ] == "" , hash [ :msg ] )
99- hash3 = gen_not_list_checker_callback ( -> ( result ) {
99+ hash3 = gen_checker_callback ( -> ( result ) {
100100 for order in result
101101 if order [ 'client_order_id' ] == new_timestamp
102102 return true
@@ -172,16 +172,47 @@ def test_cancel_spot_orders
172172 end
173173
174174 def test_get_spot_commissions
175- hash = gen_checker_callback ( -> ( commission ) { goodTradingCommission ( commission ) } )
175+ hash = gen_list_checker_callback ( -> ( commission ) { goodTradingCommission ( commission ) } )
176176 @wsclient . get_spot_commissions ( callback :hash [ :callback ] )
177177 sleep ( 3 )
178178 assert ( hash [ :msg ] == "" , hash [ :msg ] )
179179 end
180180
181181 def test_get_spot_commission_of_symbol
182- hash = gen_not_list_checker_callback ( -> ( commission ) { goodTradingCommission ( commission ) } )
182+ hash = gen_checker_callback ( -> ( commission ) { goodTradingCommission ( commission ) } )
183183 @wsclient . get_spot_commission_of_symbol ( symbol :'EOS' , callback :hash [ :callback ] )
184184 sleep ( 3 )
185185 assert ( hash [ :msg ] == "" , hash [ :msg ] )
186186 end
187+
188+ def test_create_spot_order_list
189+ firstOrderID = Time . now . to_s
190+ @wsclient . create_spot_order_list (
191+ order_list_id : firstOrderID ,
192+ contingency_type : Cryptomarket ::Args ::Contingency ::AON ,
193+ orders : [
194+ {
195+ 'symbol' => 'EOSETH' ,
196+ 'side' => Cryptomarket ::Args ::Side ::SELL ,
197+ 'quantity' => '0.1' ,
198+ 'time_in_force' => Cryptomarket ::Args ::TimeInForce ::FOK ,
199+ 'price' => '1000'
200+ } ,
201+ {
202+ 'symbol' => 'EOSUSDT' ,
203+ 'side' => Cryptomarket ::Args ::Side ::SELL ,
204+ 'quantity' => '0.1' ,
205+ 'time_in_force' => Cryptomarket ::Args ::TimeInForce ::FOK ,
206+ 'price' => '1000'
207+ }
208+ ] ,
209+ callback : Proc . new { |error , result |
210+ if not error . nil?
211+ puts error
212+ return
213+ end
214+ puts result
215+ } )
216+ sleep ( 5 )
217+ end
187218end
0 commit comments