Skip to content

Commit

Permalink
add min/max vol to orders modal
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Apr 1, 2024
1 parent 955a091 commit af650fd
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
20 changes: 20 additions & 0 deletions atomic_defi_design/Dex/Exchange/ProView/TradingInfo/OrderModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@ MultipageModal
label.font.pixelSize: 13
}

// Min Vol
TextEditWithTitle
{
Layout.fillWidth: true
title: qsTr("Min Volume")
text: details ? details.min_volume + " " + details.base_coin : ""
label.font.pixelSize: 13
visible: General.exists(details) && details.min_volume != ""
}

// Max Vol
TextEditWithTitle
{
Layout.fillWidth: true
title: qsTr("Max Volume")
text: details ? details.max_volume + " " + details.base_coin : ""
label.font.pixelSize: 13
visible: General.exists(details) && details.max_volume != ""
}

// Refund state
TextEditWithTitle
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/atomicdex/api/mm2/mm2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ namespace atomic_dex::mm2
.is_swap = false,
.is_cancellable = value.at("cancellable").get<bool>(),
.is_recoverable = false,
.min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get<std::string>()) : std::optional<QString>(std::nullopt),
.min_volume = is_maker ? QString::fromStdString(value.at("min_base_vol").get<std::string>()) : "",
.max_volume = is_maker ? QString::fromStdString(value.at("max_base_vol").get<std::string>()) : "",
.conf_settings = conf_settings};
if (action.empty() && contents.order_type == "maker")
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/atomicdex/data/dex/qt.orders.data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ namespace atomic_dex::mm2
bool is_swap_active{false};

//! Only available for maker order
std::optional<QString> min_volume{std::nullopt};
QString min_volume;
QString max_volume;
std::optional<nlohmann::json> conf_settings{std::nullopt};
};
} // namespace atomic_dex::mm2
Expand Down
12 changes: 12 additions & 0 deletions src/core/atomicdex/models/qt.orders.model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ namespace atomic_dex
case RelCoinAmountCurrentCurrencyRole:
item.rel_amount_fiat = value.toString();
break;
case MinVolumeRole:
item.min_volume = value.toString();
break;
case MaxVolumeRole:
item.max_volume = value.toString();
break;
case OrderTypeRole:
item.order_type = value.toString();
break;
Expand Down Expand Up @@ -166,6 +172,10 @@ namespace atomic_dex
return item.rel_amount;
case RelCoinAmountCurrentCurrencyRole:
return item.rel_amount_fiat;
case MinVolumeRole:
return item.min_volume;
case MaxVolumeRole:
return item.max_volume;
case OrderTypeRole:
return item.order_type;
case HumanDateRole:
Expand Down Expand Up @@ -233,6 +243,8 @@ namespace atomic_dex
{BaseCoinAmountCurrentCurrencyRole, "base_amount_current_currency"},
{RelCoinAmountRole, "rel_amount"},
{RelCoinAmountCurrentCurrencyRole, "rel_amount_current_currency"},
{MinVolumeRole, "min_volume"},
{MaxVolumeRole, "max_volume"},
{OrderTypeRole, "type"},
{IsMakerRole, "is_maker"},
{HumanDateRole, "date"},
Expand Down
2 changes: 2 additions & 0 deletions src/core/atomicdex/models/qt.orders.model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ namespace atomic_dex
RelCoinAmountRole,
RelCoinAmountCurrentCurrencyRole,
OrderTypeRole,
MinVolumeRole,
MaxVolumeRole,
IsMakerRole,
HumanDateRole,
UnixTimestampRole,
Expand Down
4 changes: 4 additions & 0 deletions src/core/atomicdex/models/qt.orders.proxy.model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ namespace atomic_dex
break;
case orders_model::RelCoinAmountCurrentCurrencyRole:
break;
case orders_model::MinVolumeRole:
break;
case orders_model::MaxVolumeRole:
break;
case orders_model::OrderTypeRole:
break;
case orders_model::IsMakerRole:
Expand Down

0 comments on commit af650fd

Please sign in to comment.