<?php
namespace ccxt;

// ----------------------------------------------------------------------------

// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

// -----------------------------------------------------------------------------
use React\Async;
use React\Promise;
include_once PATH_TO_CCXT . '/test/exchange/base/test_shared_methods.php';
include_once PATH_TO_CCXT . '/test/exchange/base/test_trade.php';

function test_fetch_trades($exchange, $skipped_properties, $symbol) {
    return Async\async(function () use ($exchange, $skipped_properties, $symbol) {
        $method = 'fetchTrades';
        $trades = Async\await($exchange->fetch_trades($symbol));
        assert_non_emtpy_array($exchange, $skipped_properties, $method, $trades);
        $now = $exchange->milliseconds();
        for ($i = 0; $i < count($trades); $i++) {
            test_trade($exchange, $skipped_properties, $method, $trades[$i], $symbol, $now);
            assert_in_array($exchange, $skipped_properties, $method, $trades[$i], 'takerOrMaker', ['taker', null]);
        }
        if (!(is_array($skipped_properties) && array_key_exists('timestampSort', $skipped_properties))) {
            assert_timestamp_order($exchange, $method, $symbol, $trades);
        }
        return true;
    }) ();
}
