@@ -399,19 +399,28 @@ def test_ccxt__calculate_funding_fees(self, exchange_futures: EXCHANGE_FIXTURE_T
399399 assert isinstance (funding_fee , float )
400400 assert funding_fee != 0
401401
402- def test_ccxt__async_get_trade_history (self , exchange : EXCHANGE_FIXTURE_TYPE ):
402+ def test_ccxt__async_get_trade_history (self , exchange : EXCHANGE_FIXTURE_TYPE , mocker ):
403403 exch , exchangename = exchange
404404 if not (lookback := EXCHANGES [exchangename ].get ("trades_lookback_hours" )):
405405 pytest .skip ("test_fetch_trades not enabled for this exchange" )
406406 pair = EXCHANGES [exchangename ]["pair" ]
407407 since = int ((datetime .now (UTC ) - timedelta (hours = lookback )).timestamp () * 1000 )
408+ nvspy = mocker .spy (exch , "_get_trade_pagination_next_value" )
408409 res = exch .loop .run_until_complete (exch ._async_get_trade_history (pair , since , None , None ))
409410 assert len (res ) == 2
410411 res_pair , res_trades = res
411412 assert res_pair == pair
412413 assert isinstance (res_trades , list )
413414 assert res_trades [0 ][0 ] >= since
414415 assert len (res_trades ) > 1200
416+ assert nvspy .call_count > 5
417+ if exchangename == "kraken" :
418+ # for Kraken, the pagination value is added to the last trade result by ccxt.
419+ # We therefore expect that the last row has one additional field
420+
421+ # Pick a random spy call
422+ trades_orig = nvspy .call_args_list [2 ][0 ][0 ]
423+ assert len (trades_orig [- 1 ].get ("info" )) > len (trades_orig [- 2 ].get ("info" ))
415424
416425 def test_ccxt_get_fee (self , exchange : EXCHANGE_FIXTURE_TYPE ):
417426 exch , exchangename = exchange
0 commit comments