mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-17 14:00:35 -04:00
put trade price into trade and contract
This commit is contained in:
parent
13a62b1342
commit
bc07df2d7a
29 changed files with 139 additions and 51 deletions
|
@ -93,14 +93,12 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
private TextField currencyTextField;
|
||||
private Label directionLabel, amountDescriptionLabel, addressLabel, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, amountBtcLabel, priceCurrencyLabel,
|
||||
volumeCurrencyLabel, minAmountBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, currencyTextFieldLabel,
|
||||
currencyComboBoxLabel, spinnerInfoLabel;
|
||||
currencyComboBoxLabel, spinnerInfoLabel, priceAsPercentageLabel;
|
||||
private TextFieldWithCopyIcon totalToPayTextField;
|
||||
private ComboBox<PaymentAccount> paymentAccountsComboBox;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private PopOver totalToPayInfoPopover;
|
||||
private Label priceAsPercentageLabel;
|
||||
private ToggleButton fixedPriceButton;
|
||||
private ToggleButton percentagePriceButton;
|
||||
private ToggleButton fixedPriceButton, percentagePriceButton;
|
||||
|
||||
private OfferView.CloseHandler closeHandler;
|
||||
|
||||
|
|
|
@ -576,8 +576,9 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
long shiftDivisor = checkedPow(10, priceAsFiat.smallestUnitExponent());
|
||||
double offerPrice = ((double) priceAsFiat.longValue()) / ((double) shiftDivisor);
|
||||
double percentage = Math.abs(1 - (offerPrice / marketPriceAsDouble));
|
||||
percentage = formatter.roundDouble(percentage, 2);
|
||||
if (marketPriceAsDouble != 0 && percentage > preferences.getMaxPriceDistanceInPercent()) {
|
||||
displayPriceOutofRangePopup();
|
||||
displayPriceOutOfRangePopup();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -587,7 +588,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
}
|
||||
}
|
||||
|
||||
private void displayPriceOutofRangePopup() {
|
||||
private void displayPriceOutOfRangePopup() {
|
||||
Popup popup = new Popup();
|
||||
popup.warning("The price you have entered is outside the max. allowed deviation from the market price.\n" +
|
||||
"The max. allowed deviation is " +
|
||||
|
|
|
@ -92,6 +92,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
|||
boolean useSavingsWallet;
|
||||
Coin totalAvailableBalance;
|
||||
private Notification walletFundedNotification;
|
||||
Fiat tradePrice;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -158,6 +159,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
|||
// called before activate
|
||||
void initWithData(Offer offer) {
|
||||
this.offer = offer;
|
||||
tradePrice = offer.getPrice();
|
||||
|
||||
addressEntry = walletService.getOrCreateAddressEntry(offer.getId(), AddressEntry.Context.OFFER_FUNDING);
|
||||
checkNotNull(addressEntry, "addressEntry must not be null");
|
||||
|
@ -227,6 +229,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
|||
// have it persisted as well.
|
||||
void onTakeOffer(TradeResultHandler tradeResultHandler) {
|
||||
tradeManager.onTakeOffer(amountAsCoin.get(),
|
||||
tradePrice.getValue(),
|
||||
totalToPayAsCoin.get().subtract(takerFeeAsCoin),
|
||||
offer,
|
||||
paymentAccount.getId(),
|
||||
|
@ -308,7 +311,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
|||
if (offer != null &&
|
||||
amountAsCoin.get() != null &&
|
||||
!amountAsCoin.get().isZero()) {
|
||||
volumeAsFiat.set(new ExchangeRate(offer.getPrice()).coinToFiat(amountAsCoin.get()));
|
||||
volumeAsFiat.set(new ExchangeRate(tradePrice).coinToFiat(amountAsCoin.get()));
|
||||
|
||||
updateBalance();
|
||||
}
|
||||
|
|
|
@ -90,9 +90,9 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
private TitledGroupBg payFundsPane;
|
||||
private Button nextButton, cancelButton1, cancelButton2, fundFromSavingsWalletButton, fundFromExternalWalletButton, takeOfferButton;
|
||||
private InputTextField amountTextField;
|
||||
private TextField paymentMethodTextField, currencyTextField, priceTextField, volumeTextField, amountRangeTextField;
|
||||
private TextField paymentMethodTextField, currencyTextField, priceTextField, priceAsPercentageTextField, volumeTextField, amountRangeTextField;
|
||||
private Label directionLabel, amountDescriptionLabel, addressLabel, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel,
|
||||
amountBtcLabel, priceCurrencyLabel,
|
||||
amountBtcLabel, priceCurrencyLabel, priceAsPercentageLabel,
|
||||
volumeCurrencyLabel, amountRangeBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, spinnerInfoLabel, offerAvailabilitySpinnerLabel;
|
||||
private TextFieldWithCopyIcon totalToPayTextField;
|
||||
private PopOver totalToPayInfoPopover;
|
||||
|
@ -228,6 +228,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
amountDescriptionLabel.setText(model.getAmountDescription());
|
||||
amountRangeTextField.setText(model.getAmountRange());
|
||||
priceTextField.setText(model.getPrice());
|
||||
priceAsPercentageTextField.setText(model.marketPriceMargin);
|
||||
addressTextField.setPaymentLabel(model.getPaymentLabel());
|
||||
addressTextField.setAddress(model.dataModel.getAddressEntry().getAddressString());
|
||||
}
|
||||
|
@ -269,7 +270,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
offerDetailsWindow.hide();
|
||||
offerDetailsWindowDisplayed = false;
|
||||
})
|
||||
).show(model.getOffer(), model.dataModel.amountAsCoin.get());
|
||||
).show(model.getOffer(), model.dataModel.amountAsCoin.get(), model.dataModel.tradePrice);
|
||||
offerDetailsWindowDisplayed = true;
|
||||
} else {
|
||||
new Popup().warning("You have no arbitrator selected.\n" +
|
||||
|
@ -285,6 +286,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
|
||||
amountTextField.setMouseTransparent(true);
|
||||
priceTextField.setMouseTransparent(true);
|
||||
priceAsPercentageTextField.setMouseTransparent(true);
|
||||
volumeTextField.setMouseTransparent(true);
|
||||
|
||||
balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get());
|
||||
|
@ -389,6 +391,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
addressTextField.amountAsCoinProperty().bind(model.dataModel.missingCoin);
|
||||
amountTextField.validationResultProperty().bind(model.amountValidationResult);
|
||||
priceCurrencyLabel.textProperty().bind(createStringBinding(() -> model.dataModel.getCurrencyCode() + "/" + model.btcCode.get(), model.btcCode));
|
||||
priceAsPercentageLabel.prefWidthProperty().bind(priceCurrencyLabel.widthProperty());
|
||||
amountRangeBtcLabel.textProperty().bind(model.btcCode);
|
||||
nextButton.disableProperty().bind(model.isNextButtonDisabled);
|
||||
|
||||
|
@ -414,6 +417,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
addressTextField.amountAsCoinProperty().unbind();
|
||||
amountTextField.validationResultProperty().unbind();
|
||||
priceCurrencyLabel.textProperty().unbind();
|
||||
priceAsPercentageLabel.prefWidthProperty().unbind();
|
||||
amountRangeBtcLabel.textProperty().unbind();
|
||||
nextButton.disableProperty().unbind();
|
||||
|
||||
|
@ -638,8 +642,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
gridPane.getChildren().add(imageVBox);
|
||||
|
||||
addAmountPriceFields();
|
||||
|
||||
addAmountRangeBox();
|
||||
addSecondRow();
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
|
@ -839,18 +842,42 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
|||
gridPane.getChildren().add(hBox);
|
||||
}
|
||||
|
||||
private void addAmountRangeBox() {
|
||||
private void addSecondRow() {
|
||||
Tuple3<HBox, TextField, Label> priceAsPercentageTuple = getValueCurrencyBox();
|
||||
HBox priceAsPercentageValueCurrencyBox = priceAsPercentageTuple.first;
|
||||
priceAsPercentageTextField = priceAsPercentageTuple.second;
|
||||
priceAsPercentageLabel = priceAsPercentageTuple.third;
|
||||
|
||||
Tuple2<Label, VBox> priceAsPercentageInputBoxTuple = getTradeInputBox(priceAsPercentageValueCurrencyBox, "Distance in % from market price");
|
||||
priceAsPercentageInputBoxTuple.first.setPrefWidth(200);
|
||||
VBox priceAsPercentageInputBox = priceAsPercentageInputBoxTuple.second;
|
||||
|
||||
priceAsPercentageTextField.setPromptText("Enter % value");
|
||||
priceAsPercentageLabel.setText("% dist.");
|
||||
priceAsPercentageLabel.setStyle("-fx-alignment: center;");
|
||||
|
||||
|
||||
Tuple3<HBox, TextField, Label> amountValueCurrencyBoxTuple = getValueCurrencyBox();
|
||||
HBox amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
|
||||
amountRangeTextField = amountValueCurrencyBoxTuple.second;
|
||||
amountRangeBtcLabel = amountValueCurrencyBoxTuple.third;
|
||||
|
||||
Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, BSResources.get("takeOffer.amountPriceBox.amountRangeDescription"));
|
||||
VBox box = amountInputBoxTuple.second;
|
||||
GridPane.setRowIndex(box, ++gridRow);
|
||||
GridPane.setColumnIndex(box, 1);
|
||||
GridPane.setMargin(box, new Insets(5, 10, 5, 0));
|
||||
gridPane.getChildren().add(box);
|
||||
|
||||
Label xLabel = new Label("x");
|
||||
xLabel.setFont(Font.font("Helvetica-Bold", 20));
|
||||
xLabel.setPadding(new Insets(14, 3, 0, 3));
|
||||
xLabel.setVisible(false); // we just use it to get the same layout as the upper row
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(5);
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
hBox.getChildren().addAll(amountInputBoxTuple.second, xLabel, priceAsPercentageInputBox);
|
||||
GridPane.setRowIndex(hBox, ++gridRow);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
GridPane.setMargin(hBox, new Insets(5, 10, 5, 0));
|
||||
GridPane.setColumnSpan(hBox, 2);
|
||||
gridPane.getChildren().add(hBox);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
private ConnectionListener connectionListener;
|
||||
// private Subscription isFeeSufficientSubscription;
|
||||
private Runnable takeOfferSucceededHandler;
|
||||
String marketPriceMargin;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -162,7 +163,8 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
}
|
||||
|
||||
amountRange = formatter.formatCoin(offer.getMinAmount()) + " - " + formatter.formatCoin(offer.getAmount());
|
||||
price = formatter.formatFiat(offer.getPrice());
|
||||
price = formatter.formatFiat(dataModel.tradePrice);
|
||||
marketPriceMargin = formatter.formatToPercentWithSymbol(offer.getMarketPriceMargin());
|
||||
paymentLabel = BSResources.get("takeOffer.fundsBox.paymentLabel", offer.getId());
|
||||
|
||||
checkNotNull(dataModel.getAddressEntry(), "dataModel.getAddressEntry() must not be null");
|
||||
|
|
|
@ -123,7 +123,7 @@ public class ContractWindow extends Overlay<ContractWindow> {
|
|||
addLabelTextField(gridPane, ++rowIndex, "Offer date:", formatter.formatDateTime(offer.getDate()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade date:", formatter.formatDateTime(dispute.getTradeDate()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade type:", formatter.getDirectionBothSides(offer.getDirection()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiat(offer.getPrice()) + " " + offer.getCurrencyCode());
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade price:", formatter.formatFiat(contract.getTradePrice()) + " " + offer.getCurrencyCode());
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade amount:", formatter.formatCoinWithCode(contract.getTradeAmount()));
|
||||
addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Buyer bitcoin address:",
|
||||
contract.getBuyerPayoutAddressString()).second.setMouseTransparent(false);
|
||||
|
|
|
@ -47,6 +47,7 @@ import javafx.scene.layout.HBox;
|
|||
import javafx.scene.layout.VBox;
|
||||
import org.bitcoinj.core.AddressFormatException;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.utils.ExchangeRate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -232,8 +233,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||
}
|
||||
addLabelTextField(gridPane, ++rowIndex, "Traders role:", role);
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade amount:", formatter.formatCoinWithCode(contract.getTradeAmount()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade volume:", formatter.formatFiatWithCode(contract.offer.getVolumeByAmount(contract.getTradeAmount())));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiatWithCode(contract.offer.getPrice()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade price:", formatter.formatFiatWithCode(contract.getTradePrice()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade volume:", formatter.formatFiatWithCode(new ExchangeRate(contract.getTradePrice()).coinToFiat(contract.getTradeAmount())));
|
||||
}
|
||||
|
||||
private void addCheckboxes() {
|
||||
|
|
|
@ -41,6 +41,7 @@ import javafx.geometry.Insets;
|
|||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.ImageView;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -61,6 +62,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
private final Navigation navigation;
|
||||
private Offer offer;
|
||||
private Coin tradeAmount;
|
||||
private Fiat tradePrice;
|
||||
private Optional<Runnable> placeOfferHandlerOptional = Optional.empty();
|
||||
private Optional<Runnable> takeOfferHandlerOptional = Optional.empty();
|
||||
private ProgressIndicator spinner;
|
||||
|
@ -80,9 +82,10 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
type = Type.Confirmation;
|
||||
}
|
||||
|
||||
public void show(Offer offer, Coin tradeAmount) {
|
||||
public void show(Offer offer, Coin tradeAmount, Fiat tradePrice) {
|
||||
this.offer = offer;
|
||||
this.tradeAmount = tradeAmount;
|
||||
this.tradePrice = tradePrice;
|
||||
|
||||
rowIndex = -1;
|
||||
width = 900;
|
||||
|
@ -172,7 +175,10 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
addLabelTextField(gridPane, ++rowIndex, CurrencyUtil.getNameByCode(offer.getCurrencyCode()) + " amount" + fiatDirectionInfo, formatter.formatFiatWithCode(offer.getVolumeByAmount(offer.getAmount())));
|
||||
}
|
||||
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiat(offer.getPrice()) + " " + offer.getCurrencyCode() + "/" + "BTC");
|
||||
if (takeOfferHandlerOptional.isPresent())
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiat(tradePrice) + " " + offer.getCurrencyCode() + "/" + "BTC");
|
||||
else
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiat(offer.getPrice()) + " " + offer.getCurrencyCode() + "/" + "BTC");
|
||||
|
||||
if (offer.isMyOffer(keyRing) && user.getPaymentAccount(offer.getOffererPaymentAccountId()) != null)
|
||||
addLabelTextField(gridPane, ++rowIndex, "Payment account:", user.getPaymentAccount(offer.getOffererPaymentAccountId()).getAccountName());
|
||||
|
|
|
@ -127,7 +127,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
|
|||
|
||||
addLabelTextField(gridPane, ++rowIndex, "Bitcoin amount" + btcDirectionInfo, formatter.formatCoinWithCode(trade.getTradeAmount()));
|
||||
addLabelTextField(gridPane, ++rowIndex, CurrencyUtil.getNameByCode(offer.getCurrencyCode()) + " amount" + fiatDirectionInfo, formatter.formatFiatWithCode(trade.getTradeVolume()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatPriceWithCode(offer.getPrice()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Trade price:", formatter.formatPriceWithCode(trade.getTradePrice()));
|
||||
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(offer.getPaymentMethod().getId()));
|
||||
|
||||
// second group
|
||||
|
|
|
@ -81,7 +81,13 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
tradeIdColumn.setComparator((o1, o2) -> o1.getTradable().getId().compareTo(o2.getTradable().getId()));
|
||||
dateColumn.setComparator((o1, o2) -> o1.getTradable().getDate().compareTo(o2.getTradable().getDate()));
|
||||
directionColumn.setComparator((o1, o2) -> o1.getTradable().getOffer().getDirection().compareTo(o2.getTradable().getOffer().getDirection()));
|
||||
priceColumn.setComparator((o1, o2) -> o1.getTradable().getOffer().getPrice().compareTo(o2.getTradable().getOffer().getPrice()));
|
||||
priceColumn.setComparator((o1, o2) -> {
|
||||
Tradable tradable = o1.getTradable();
|
||||
if (tradable instanceof Trade)
|
||||
return ((Trade) o1.getTradable()).getTradePrice().compareTo(((Trade) o2.getTradable()).getTradePrice());
|
||||
else
|
||||
return o1.getTradable().getOffer().getPrice().compareTo(o2.getTradable().getOffer().getPrice());
|
||||
});
|
||||
volumeColumn.setComparator((o1, o2) -> {
|
||||
if (o1.getTradable() instanceof Trade && o2.getTradable() instanceof Trade) {
|
||||
Fiat tradeVolume1 = ((Trade) o1.getTradable()).getTradeVolume();
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.google.inject.Inject;
|
|||
import io.bitsquare.gui.common.model.ActivatableWithDataModel;
|
||||
import io.bitsquare.gui.common.model.ViewModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.trade.Tradable;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.offer.OpenOffer;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -54,7 +55,13 @@ class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataMod
|
|||
}
|
||||
|
||||
String getPrice(ClosedTradableListItem item) {
|
||||
return (item != null) ? formatter.formatFiat(item.getTradable().getOffer().getPrice()) : "";
|
||||
if (item == null)
|
||||
return "";
|
||||
Tradable tradable = item.getTradable();
|
||||
if (tradable instanceof Trade)
|
||||
return formatter.formatFiat(((Trade) tradable).getTradePrice());
|
||||
else
|
||||
return formatter.formatFiat(tradable.getOffer().getPrice());
|
||||
}
|
||||
|
||||
String getVolume(ClosedTradableListItem item) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
|||
|
||||
tradeIdColumn.setComparator((o1, o2) -> o1.getTrade().getId().compareTo(o2.getTrade().getId()));
|
||||
dateColumn.setComparator((o1, o2) -> o1.getTrade().getDate().compareTo(o2.getTrade().getDate()));
|
||||
priceColumn.setComparator((o1, o2) -> o1.getTrade().getOffer().getPrice().compareTo(o2.getTrade().getOffer().getPrice()));
|
||||
priceColumn.setComparator((o1, o2) -> o1.getTrade().getTradePrice().compareTo(o2.getTrade().getTradePrice()));
|
||||
volumeColumn.setComparator((o1, o2) -> o1.getTrade().getTradeVolume().compareTo(o2.getTrade().getTradeVolume()));
|
||||
amountColumn.setComparator((o1, o2) -> o1.getTrade().getTradeAmount().compareTo(o2.getTrade().getTradeAmount()));
|
||||
stateColumn.setComparator((o1, o2) -> model.getState(o1).compareTo(model.getState(o2)));
|
||||
|
|
|
@ -51,7 +51,7 @@ class FailedTradesViewModel extends ActivatableWithDataModel<FailedTradesDataMod
|
|||
}
|
||||
|
||||
String getPrice(FailedTradesListItem item) {
|
||||
return (item != null) ? formatter.formatFiat(item.getTrade().getOffer().getPrice()) : "";
|
||||
return (item != null) ? formatter.formatFiat(item.getTrade().getTradePrice()) : "";
|
||||
}
|
||||
|
||||
String getVolume(FailedTradesListItem item) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PendingTradesListItem {
|
|||
}
|
||||
|
||||
public Fiat getPrice() {
|
||||
return trade.getOffer().getPrice();
|
||||
return trade.getTradePrice();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -380,7 +380,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
|||
public void updateItem(final PendingTradesListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty)
|
||||
setText(formatter.formatPriceWithCode(item.getTrade().getTradeVolume()));
|
||||
setText(formatter.formatFiatWithCode(item.getTrade().getTradeVolume()));
|
||||
else
|
||||
setText(null);
|
||||
}
|
||||
|
|
|
@ -372,7 +372,6 @@ public class BSFormatter {
|
|||
|
||||
public double roundDouble(double value, int places) {
|
||||
if (places < 0) throw new IllegalArgumentException();
|
||||
|
||||
long factor = (long) Math.pow(10, places);
|
||||
value = value * factor;
|
||||
long tmp = Math.round(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue