Skip to content

Commit

Permalink
implement ReceiveVolumeIsLowerThanTheMinimum error
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Nov 29, 2022
1 parent cbe2f98 commit d6c52d2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions atomic_defi_design/Dex/Exchange/Trade/SimpleView/Trade.qml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ ClipRRect // Trade Card
anchors.verticalCenter: _fromTitle.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 17
text: qsTr("%1").arg(Constants.API.app.trading_pg.max_volume)
text: qsTr("%1").arg(Constants.API.app.trading_pg.max_volume) // This is slow to appear
font.pixelSize: Constants.Style.textSizeSmall2
elide: Text.ElideRight
color: DexTheme.foregroundColorLightColor1
Expand Down Expand Up @@ -716,9 +716,9 @@ ClipRRect // Trade Card
var fee_info = Constants.API.app.trading_pg.fees

if (_fromValue.text === "" || parseFloat(_fromValue.text) === 0)
return qsTr("Entered amount must be superior than 0.")
return qsTr("Entered amount must be higher than 0.")
if (typeof selectedOrder === 'undefined')
return qsTr("You must select an order.")
return qsTr("Select an order.")
return Constants.General.getTradingError(last_trading_error, fee_info, base_ticker, rel_ticker, left_ticker, right_ticker)
}

Expand Down
1 change: 0 additions & 1 deletion src/core/atomicdex/models/qt.orderbook.model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ namespace atomic_dex
{
taker_vol_std = "0";
}
// t_float_50 mm2_min_trade_vol = safe_float(trading_pg.get_mm2_min_trade_vol().toStdString());
t_float_50 taker_vol = safe_float(taker_vol_std);
i_have_enough_funds = min_volume_f > 0 && taker_vol > min_volume_f;
return i_have_enough_funds;
Expand Down
11 changes: 10 additions & 1 deletion src/core/atomicdex/pages/qt.trading.page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ namespace atomic_dex
{
this->set_price("0");
this->set_max_volume("0");
m_minimal_trading_amount = "0";
m_minimal_trading_amount = "0.00777";
emit minTradeVolChanged();
this->set_volume("0");
}
Expand Down Expand Up @@ -1312,6 +1312,10 @@ namespace atomic_dex
{
current_trading_error = TradingError::VolumeIsLowerThanTheMinimum;
}
else if (safe_float(m_total_amount.toStdString()) < 0.00777)
{
current_trading_error = TradingError::ReceiveVolumeIsLowerThanTheMinimum;
}
else
{
if (!get_fees().empty())
Expand Down Expand Up @@ -1472,6 +1476,11 @@ namespace atomic_dex
// If not associated bugs appear as a result, we can delete this.
// min_trade_vol = get_orderbook_wrapper()->get_current_min_taker_vol();
}

if (safe_float(min_taker_vol) < 0.00777)
{
min_trade_vol = "0.00777";
}

if (min_trade_vol != m_minimal_trading_amount)
{
Expand Down
5 changes: 2 additions & 3 deletions src/core/atomicdex/pages/qt.trading.page.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ namespace atomic_dex
QString m_price{"0"};
QString m_volume{"0"};
QString m_max_volume{"0"};
QString m_total_amount{"0"};
QString m_total_amount{"0.00777"};
QString m_cex_price{"0"};
QString m_minimal_trading_amount{"0"};
QString m_minimal_trading_amount{"0.00777"};
std::optional<nlohmann::json> m_preferred_order;
boost::synchronized_value<QVariantMap> m_fees;
bool m_skip_taker{false};
Expand Down Expand Up @@ -183,7 +183,6 @@ namespace atomic_dex
[[nodiscard]] QString get_price_reversed() const;
[[nodiscard]] QString get_price() const;
void set_price(QString price);
//[[nodiscard]] QString get_mm2_min_trade_vol() const;
[[nodiscard]] QString get_min_trade_vol() const;
void set_min_trade_vol(QString min_trade_vol);
[[nodiscard]] QString get_volume() const;
Expand Down

0 comments on commit d6c52d2

Please sign in to comment.