Skip to content

Commit

Permalink
UI: metadex pricing to 8 decimal places
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed May 13, 2015
1 parent cfdae0d commit 040ddb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/mastercore_mdex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ static MatchReturnType x_Trade(CMPMetaDEx* newo)
return NewReturn;
}

// Used for display of unit prices at UI layer
std::string CMPMetaDEx::displayUnitPrice() const
{
XDOUBLE tmpUnitPrice = unitPrice();
Expand All @@ -247,10 +248,11 @@ std::string CMPMetaDEx::displayUnitPrice() const
if (!isPropertyDivisible(desired_property)) divByCoin = true;
}
if (divByCoin) tmpUnitPrice = tmpUnitPrice / COIN;
std::string displayValue = tmpUnitPrice.str(DISPLAY_PRECISION_LEN, std::ios_base::fixed);
std::string displayValue = tmpUnitPrice.str(8, std::ios_base::fixed);
return displayValue;
}

// Used for display of unit prices at UI layer
std::string CMPMetaDEx::displayInversePrice() const
{
XDOUBLE tmpInversePrice = inversePrice();
Expand All @@ -261,7 +263,7 @@ std::string CMPMetaDEx::displayInversePrice() const
if (!isPropertyDivisible(desired_property)) divByCoin = true;
}
if (divByCoin) tmpInversePrice = tmpInversePrice / COIN;
std::string displayValue = tmpInversePrice.str(DISPLAY_PRECISION_LEN, std::ios_base::fixed);
std::string displayValue = tmpInversePrice.str(8, std::ios_base::fixed);
return displayValue;
}

Expand Down
6 changes: 4 additions & 2 deletions src/qt/metadexdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ void MetaDExDialog::UpdateOffers()
md_Set & indexes = (it->second);
for (md_Set::iterator it = indexes.begin(); it != indexes.end(); ++it) { // multiple sell offers can exist at the same price, sum them for the UI
CMPMetaDEx obj = *it;
if (!useBuyList && obj.displayUnitPrice() == "0.00000000") continue;
if (useBuyList && obj.displayInversePrice() == "0.00000000") continue; // hide trades that have a lower than 0.00000001 MSC unit price
unitPriceStr = obj.displayUnitPrice();
inversePriceStr = obj.displayInversePrice();
if (useBuyList) {
if (obj.getDesProperty()==global_metadex_market) {
available += obj.getAmountDesired();
Expand All @@ -329,8 +333,6 @@ void MetaDExDialog::UpdateOffers()
if(IsMyAddress(obj.getAddr())) includesMe = true;
}
}
unitPriceStr = obj.displayUnitPrice();
inversePriceStr = obj.displayInversePrice();
}
if ((available > 0) && (total > 0)) { // if there are any available at this price, add to the sell list
string strAvail;
Expand Down

0 comments on commit 040ddb6

Please sign in to comment.