#include "amount_format.h"

#include <algorithm>
#include <iomanip>
#include <locale>
#include <sstream>

namespace dragonx {
namespace util {

std::string formatAmountFixed(double amount, int decimals)
{
    std::ostringstream out;
    out.imbue(std::locale::classic());
    out << std::fixed << std::setprecision(std::max(0, decimals)) << amount;
    return out.str();
}

} // namespace util
} // namespace dragonx
