From dee239c1588abdd89bfc84518a3c6e97fc4bb4c8 Mon Sep 17 00:00:00 2001 From: makarid Date: Thu, 19 Oct 2023 15:12:03 +0300 Subject: [PATCH] [CoinbasePro] Fix FundingRecord amount value to never be negative --- .../knowm/xchange/dto/account/FundingRecord.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xchange-core/src/main/java/org/knowm/xchange/dto/account/FundingRecord.java b/xchange-core/src/main/java/org/knowm/xchange/dto/account/FundingRecord.java index 991999b86c7..0cc502fdc14 100644 --- a/xchange-core/src/main/java/org/knowm/xchange/dto/account/FundingRecord.java +++ b/xchange-core/src/main/java/org/knowm/xchange/dto/account/FundingRecord.java @@ -68,6 +68,19 @@ public class FundingRecord implements Serializable { private final String toSubAccount; + /** + * Customizing amount method to always be positive. Rest of the builder code will be auto generated by Lombok. + * + */ + public abstract static class FundingRecordBuilder< + C extends FundingRecord, B extends FundingRecordBuilder> { + + public B amount(BigDecimal amount) { + this.amount = amount == null ? null : amount.abs(); + return self(); + } + } + @Deprecated // for backward compatibility. Will be removed public String getExternalId() { return blockchainTransactionHash;