mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Add getPrice to TradeModel
This commit is contained in:
parent
d235daef01
commit
d9d054f2bd
@ -1,5 +1,6 @@
|
||||
package bisq.core.trade.model;
|
||||
|
||||
import bisq.core.monetary.Price;
|
||||
import bisq.core.monetary.Volume;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.trade.protocol.ProtocolModel;
|
||||
@ -75,6 +76,7 @@ public abstract class TradeModel implements Tradable, Model {
|
||||
@Nullable
|
||||
public abstract Volume getVolume();
|
||||
|
||||
public abstract Price getPrice();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Tradable implementation
|
||||
|
@ -761,6 +761,12 @@ public abstract class Trade extends TradeModel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Price getPrice() {
|
||||
return Price.valueOf(offer.getCurrencyCode(), priceAsLong);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Abstract
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -982,10 +988,6 @@ public abstract class Trade extends TradeModel {
|
||||
return volumeProperty;
|
||||
}
|
||||
|
||||
public Price getPrice() {
|
||||
return Price.valueOf(offer.getCurrencyCode(), priceAsLong);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public Transaction getPayoutTx() {
|
||||
|
@ -204,6 +204,12 @@ public abstract class BsqSwapTrade extends TradeModel {
|
||||
return volume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Price getPrice() {
|
||||
return Price.valueOf(offer.getCurrencyCode(), offer.getFixedPrice());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -237,11 +243,6 @@ public abstract class BsqSwapTrade extends TradeModel {
|
||||
return errorMessageProperty().get() != null;
|
||||
}
|
||||
|
||||
public Price getPrice() {
|
||||
return Price.valueOf(offer.getCurrencyCode(), offer.getFixedPrice());
|
||||
}
|
||||
|
||||
|
||||
public long getBsqTradeAmount() {
|
||||
return BsqSwapCalculation.getBsqTradeAmount(getVolume()).getValue();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user