if (isset($data['firstCurrency'])) {
    $currentRate = $data;
} else {
    if (isset($_GET['Data'])) {
        $currentRate = $_GET['Data'];
    }
}
if (isset($currentRate['firstCurrency'])) {
    $rateInfo = api::rateInfo($currentRate['firstCurrency'], $currentRate['secondCurrency']);
    $maxPrice = $rateInfo['bid'];
    $minPrice = $rateInfo['ask'];
    $totalPrice = $rateInfo['total_price'];
    $totalVolume = $rateInfo['total_volume'];
    $user = usr::getCurrentUser(1);
    if ($user != null) {
        $userFunds = usr::getCurrentUsersPurses();
        $userFirstCurrFundsIndex = Core::array_search($userFunds, 'CurName', $currentRate['firstCurrency']);
        $userFirstCurrFunds = $userFirstCurrFundsIndex == -1 ? 0 : $userFunds[$userFirstCurrFundsIndex]['Value'];
        $userSecondCurrFundsIndex = Core::array_search($userFunds, 'CurName', $currentRate['secondCurrency']);
        $userSecondCurrFunds = $userSecondCurrFundsIndex == -1 ? 0 : $userFunds[$userSecondCurrFundsIndex]['Value'];
    } else {
        $userFirstCurrFunds = 0;
        $userSecondCurrFunds = 0;
    }
    if (isset($currentRate['limit'])) {
        $depth = api::depth($currentRate['firstCurrency'], $currentRate['secondCurrency'], $currentRate['limit']);
    } else {
        $depth = api::depth($currentRate['firstCurrency'], $currentRate['secondCurrency']);
    }
}
?>