Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/atomic.dex.app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,4 +1192,16 @@ namespace atomic_dex
}

application::~application() noexcept { export_swaps_json(); }

QString
application::get_price_amount(QString base_amount, QString rel_amount)
{
t_float_50 base_amount_f(base_amount.toStdString());
t_float_50 rel_amount_f(rel_amount.toStdString());
auto final = (rel_amount_f / base_amount_f);

std::stringstream ss;
ss << std::fixed << std::setprecision(50) << std::move(final);
return QString::fromStdString(ss.str());
}
} // namespace atomic_dex
1 change: 1 addition & 0 deletions src/atomic.dex.app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ namespace atomic_dex
Q_INVOKABLE bool create(const QString& password, const QString& seed, const QString& wallet_name);
Q_INVOKABLE bool enable_coins(const QStringList& coins);
Q_INVOKABLE QString get_balance(const QString& coin);
Q_INVOKABLE QString get_price_amount(QString base_amount, QString rel_amount);
Q_INVOKABLE bool place_buy_order(const QString& base, const QString& rel, const QString& price, const QString& volume);
Q_INVOKABLE bool place_sell_order(const QString& base, const QString& rel, const QString& price, const QString& volume);
Q_INVOKABLE void set_current_orderbook(const QString& base);
Expand Down
2 changes: 1 addition & 1 deletion src/atomic.dex.mm2.api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ namespace mm2::api
j.at("zcredits").get_to(contents.zcredits);

boost::trim_right_if(contents.price, boost::is_any_of("0"));
contents.price = adjust_precision(contents.price);
contents.price = contents.price;
contents.maxvolume = adjust_precision(contents.maxvolume);
}

Expand Down