<?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

// -----------------------------------------------------------------------------
include_once PATH_TO_CCXT . '/test/exchange/base/test_last_price.php';

function test_fetch_last_prices($exchange, $skipped_properties, $symbol) {
    $method = 'fetchLastprices';
    // log ('fetching all tickers at once...')
    $response = null;
    $checked_symbol = null;
    try {
        $response = $exchange->fetch_last_prices();
    } catch(\Throwable $e) {
        $response = $exchange->fetch_last_prices([$symbol]);
        $checked_symbol = $symbol;
    }
    assert(is_array($response), $exchange->id . ' ' . $method . ' ' . $checked_symbol . ' must return an object. ' . $exchange->json($response));
    $values = is_array($response) ? array_values($response) : array();
    assert_non_emtpy_array($exchange, $skipped_properties, $method, $values, $checked_symbol);
    $at_least_one_passed = false;
    for ($i = 0; $i < count($values); $i++) {
        // todo: symbol check here
        test_last_price($exchange, $skipped_properties, $method, $values[$i], $checked_symbol);
        $at_least_one_passed = $at_least_one_passed || ($exchange->safe_number($values[$i], 'price') > 0);
    }
    assert($at_least_one_passed, $exchange->id . ' ' . $method . ' ' . $checked_symbol . ' at least one symbol should pass the test');
    return true;
}
