Package org.knowm.xchange.utils
Class OrderValuesHelper
java.lang.Object
org.knowm.xchange.utils.OrderValuesHelper
Helps you to validate and / or adjust order values like price and amount to the restrictions
dictated by
InstrumentMetaData
- Author:
- walec51
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadjustAmount
(BigDecimal amount) Adjusts the given amount to the restrictions dictated byInstrumentMetaData
.adjustPrice
(BigDecimal price, RoundingMode roundingMode) Adjusts the given price to the restrictions dictated byInstrumentMetaData
.adjustPrice
(BigDecimal price, Order.OrderType orderType) Adjusts the given price to the restrictions dictated byInstrumentMetaData
.boolean
amountUnderMinimum
(BigDecimal amount)
-
Constructor Details
-
OrderValuesHelper
-
-
Method Details
-
amountUnderMinimum
- Returns:
- true if the minimum amount is specified in the currency pair and if the amount is under it
-
adjustAmount
Adjusts the given amount to the restrictions dictated byInstrumentMetaData
.This mainly does rounding based on
invalid @link
InstrumentMetaData#getVolumeScale()
invalid @link
InstrumentMetaData#getAmountStepSize()
invalid @link
()
- Parameters:
amount
- the amount your derived from your users input or your calculations- Returns:
- amount adjusted to the restrictions dictated by
InstrumentMetaData
-
adjustPrice
Adjusts the given price to the restrictions dictated byInstrumentMetaData
.Convenience method that chooses the adequate rounding mode for you order type. See
adjustPrice(java.math.BigDecimal, java.math.RoundingMode)
for more information. -
adjustPrice
Adjusts the given price to the restrictions dictated byInstrumentMetaData
.This mainly does rounding based on
invalid @link
InstrumentMetaData#getPriceScale()
- Parameters:
price
- the price your derived from your users input or your calculations- Returns:
- price adjusted to the restrictions dictated by
InstrumentMetaData
-