Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/knowm/XChange into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
  • Loading branch information
timmolter committed Dec 1, 2023
2 parents 9d22a6b + 9c0ba9e commit 6eb16c9
Show file tree
Hide file tree
Showing 76 changed files with 111 additions and 104 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@

<version.java>1.8</version.java>
<version.assertj>3.24.2</version.assertj>
<version.commons.lang3>3.12.0</version.commons.lang3>
<version.commons.lang3>3.13.0</version.commons.lang3>
<version.fasterxml>2.14.3</version.fasterxml>
<version.github.mmazi>3.0</version.github.mmazi>
<version.resilience4j>1.7.0</version.resilience4j>
<version.junit>5.9.3</version.junit>
<version.lombok>1.18.26</version.lombok>
<version.knowm.xchart>3.8.2</version.knowm.xchart>
<version.qos.logback>1.4.5</version.qos.logback>
<version.qos.logback>1.4.11</version.qos.logback>
<version.reflections>0.10.2</version.reflections>
<version.slf4j>2.0.6</version.slf4j>
<version.crypto>5.0.0</version.crypto>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static UserTrades adaptUserTrades(
ascendexOrderHistoryResponse.forEach(
order ->
userTrades.add(
new UserTrade.Builder()
UserTrade.builder()
.feeAmount(order.getCumFee())
.orderId(order.getOrderId())
.price(order.getPrice())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static List<UserTrade> adaptUserTrades(BankeraUserTrades userTrades) {
CurrencyPair pair = new CurrencyPair(currencies[0], currencies[1]);
Currency feeCurrency = new Currency(currencies[1]);
tradeList.add(
new UserTrade.Builder()
UserTrade.builder()
.type(trade.getSide().equalsIgnoreCase("buy") ? OrderType.BID : OrderType.ASK)
.originalAmount(new BigDecimal(trade.getAmount()))
.currencyPair(pair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static UserTrades adaptUserTrades(BiboxOrders biboxOrderHistory) {
}

private static UserTrade adaptUserTrade(BiboxOrder order) {
return new UserTrade.Builder()
return UserTrade.builder()
.orderId(order.getId())
.id(order.getId())
.currencyPair(new CurrencyPair(order.getCoinSymbol(), order.getCurrencySymbol()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public static UserTrades adaptUserTrades(List<BinanceTrade> binanceTrades, boole
binanceTrades.stream()
.map(
t ->
new UserTrade.Builder()
UserTrade.builder()
.type(BinanceAdapters.convertType(t.isBuyer))
.originalAmount(t.qty)
.instrument(adaptSymbol(t.symbol, isFuture))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static UserTrade createUserTrade(BitbayOrder bitbayOrder) {
throw new IllegalArgumentException(e);
}

return new UserTrade.Builder()
return UserTrade.builder()
.type(type)
.originalAmount(bitbayOrder.getAmount())
.currencyPair(currencyPair)
Expand Down Expand Up @@ -244,7 +244,7 @@ public static List<UserTrade> adaptTransactions(List<Map> response) {
String id = (type + "_" + date + "_" + market).replaceAll("\\s+", "");

trades.add(
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(amount)
.currencyPair(pair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static UserTrades adaptUserTrades(BitbayUserTrades response) {
new CurrencyPair(Currency.getInstance(parts[0]), Currency.getInstance(parts[1]));
Date timestamp = new Date(trade.getTime());
trades.add(
new UserTrade.Builder()
UserTrade.builder()
.id(trade.getId().toString())
.type(orderType)
.originalAmount(trade.getAmount())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public static UserTrades adaptTradeHistory(
: trade.getCreatedAt();

result.add(
new UserTrade.Builder()
UserTrade.builder()
.id(trade.getTradeId())
.timestamp(timestamp)
.currencyPair(trade.getTradingPair())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public static UserTrades adaptTradeHistory(BitfinexTradeResponse[] trades, Strin
Date timestamp = convertBigDecimalTimestampToDate(trade.getTimestamp());
final BigDecimal fee = trade.getFeeAmount() == null ? null : trade.getFeeAmount().negate();
pastTrades.add(
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(trade.getAmount())
.currencyPair(currencyPair)
Expand Down Expand Up @@ -611,7 +611,7 @@ public static UserTrades adaptTradeHistoryV2(
: trade.getExecAmount();
final BigDecimal fee = trade.getFee() != null ? trade.getFee().negate() : null;
pastTrades.add(
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(amount)
.currencyPair(adaptCurrencyPair(trade.getSymbol()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static UserTrades adaptUserTrades(
private static UserTrade adaptUserTrade(
BithumbUserTransaction bithumbTransaction, CurrencyPair currencyPair) {

return new UserTrade.Builder()
return UserTrade.builder()
.currencyPair(currencyPair)
.originalAmount(bithumbTransaction.getUnits())
.type(adaptTransactionSearch(bithumbTransaction.getSearch()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static UserTrade adoptUserTrade(BitmexPrivateExecution exec) {
OrderType orderType = convertType(exec.side);
return orderType == null
? null
: new UserTrade.Builder()
: UserTrade.builder()
.id(exec.execID)
.orderId(exec.orderID)
.currencyPair(pair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static UserTrades adaptTradeHistory(BitsoUserTransaction[] bitsoUserTrans
String feeCurrency =
sell ? currencyPair.counter.getCurrencyCode() : currencyPair.base.getCurrencyCode();
UserTrade trade =
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(originalAmount)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static UserTrades adaptTradeHistory(BitstampUserTransaction[] bitstampUse
final CurrencyPair pair =
new CurrencyPair(t.getBaseCurrency().toUpperCase(), t.getCounterCurrency().toUpperCase());
UserTrade trade =
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(t.getBaseAmount().abs())
.currencyPair(pair)
Expand Down Expand Up @@ -425,6 +425,7 @@ public static InstrumentMetaData adaptCurrencyPairInfo(BitstampPairInfo pairInfo
.counterMinimumAmount(minOrder)
.priceScale(pairInfo.getCounterDecimals())
.volumeScale(pairInfo.getBaseDecimals())
.marketOrderEnabled(pairInfo.isMarketOrdersEnabled())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ public class BitstampPairInfo {
@JsonProperty("description")
String description;

@JsonProperty("instant_and_market_orders")
String instantAndMarketOrders;

public boolean isMarketOrdersEnabled(){
return "Enabled".equals(instantAndMarketOrders);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static List<UserTrade> adaptUserTrades(List<BittrexOrder> bittrexUserTrad
return bittrexUserTrades.stream()
.map(
bittrexOrder ->
new UserTrade.Builder()
UserTrade.builder()
.type(
BittrexConstants.BUY.equalsIgnoreCase(bittrexOrder.getDirection())
? OrderType.BID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static UserTrade adaptTrade(BityOrder order) {
Date date = order.getTimestampCreated();
String orderId = order.getResourceUri();

return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(amount)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static List<UserTrade> adaptUserTransactionsToUserTrades(

for (Bl3pUserTransactions.Bl3pUserTransaction t : transactions) {
UserTrade ut =
new UserTrade.Builder()
UserTrade.builder()
.currencyPair(CurrencyPair.BTC_EUR)
.id(Integer.toString(t.id))
.orderId(Integer.toString(t.orderId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static ExchangeMetaData adaptToExchangeMetaData(
public static UserTrade adaptUserTrade(BluetradeExecutedTrade trade) {
OrderType orderType = trade.type.equalsIgnoreCase("sell") ? OrderType.ASK : OrderType.BID;
CurrencyPair currencyPair = BleutradeUtils.toCurrencyPair(trade.exchange);
return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(trade.quantity)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private static String generateClOrdId() {

public static UserTrades toUserTrades(List<BlockchainOrder> blockchainTrades) {
List<UserTrade> trades = blockchainTrades.stream()
.map(blockchainTrade -> new UserTrade.Builder()
.map(blockchainTrade -> UserTrade.builder()
.type(blockchainTrade.getOrderType())
.originalAmount(blockchainTrade.getCumQty())
.currencyPair(blockchainTrade.getSymbol())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static UserTrade adaptTrade(BTCMarketsUserTrade trade, CurrencyPair curre
final String tradeId = Long.toString(trade.getId());
final Long orderId = trade.getOrderId();
final String feeCurrency = currencyPair.counter.getCurrencyCode();
return new UserTrade.Builder()
return UserTrade.builder()
.type(type)
.originalAmount(trade.getVolume())
.currencyPair(currencyPair)
Expand All @@ -172,7 +172,7 @@ public static UserTrade adaptTradeHistory(BTCMarketsTradeHistoryResponse trade)
final String orderId = trade.orderId;
final String feeCurrency = currencyPair.counter.getCurrencyCode();
try {
return new UserTrade.Builder()
return UserTrade.builder()
.type(type)
.originalAmount(trade.amount)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected static LimitOrder[] expectedOrders() {

protected static UserTrade[] expectedUserTrades() {
return new UserTrade[] {
new UserTrade.Builder()
UserTrade.builder()
.type(Order.OrderType.ASK)
.originalAmount(new BigDecimal("20.00000000"))
.currencyPair(CurrencyPair.BTC_AUD)
Expand All @@ -167,7 +167,7 @@ protected static UserTrade[] expectedUserTrades() {
.feeAmount(BigDecimal.ONE)
.feeCurrency(Currency.AUD)
.build(),
new UserTrade.Builder()
UserTrade.builder()
.type(Order.OrderType.ASK)
.originalAmount(new BigDecimal("40.00000000"))
.currencyPair(CurrencyPair.BTC_AUD)
Expand All @@ -177,7 +177,7 @@ protected static UserTrade[] expectedUserTrades() {
.feeAmount(BigDecimal.valueOf(2))
.feeCurrency(Currency.AUD)
.build(),
new UserTrade.Builder()
UserTrade.builder()
.type(Order.OrderType.BID)
.originalAmount(new BigDecimal("60.00000000"))
.currencyPair(CurrencyPair.BTC_AUD)
Expand All @@ -187,7 +187,7 @@ protected static UserTrade[] expectedUserTrades() {
.feeAmount(BigDecimal.valueOf(3))
.feeCurrency(Currency.AUD)
.build(),
new UserTrade.Builder()
UserTrade.builder()
.type(Order.OrderType.BID)
.originalAmount(new BigDecimal("80.00000000"))
.currencyPair(CurrencyPair.BTC_AUD)
Expand All @@ -197,7 +197,7 @@ protected static UserTrade[] expectedUserTrades() {
.feeAmount(BigDecimal.valueOf(4))
.feeCurrency(Currency.AUD)
.build(),
new UserTrade.Builder()
UserTrade.builder()
.type(Order.OrderType.BID)
.originalAmount(BigDecimal.ZERO)
.currencyPair(CurrencyPair.BTC_AUD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException
for (BTCTurkUserTransactions transaction : transactions) {
if (transaction.getOperation().equals(BTCTurkOperations.trade))
trades.add(
new UserTrade.Builder()
UserTrade.builder()
.type(
((transaction.getAmount().compareTo(BigDecimal.ZERO) > 0)
? OrderType.ASK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public static UserTrade adaptUserTrade(CCEXOrderhistory trade) {
price = trade.getLimit();
}

return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(amount)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static UserTrade adaptArchivedOrder(CexIOArchivedOrder cexIOArchivedOrder
: Currency.getInstance(cexIOArchivedOrder.feeCcy);
BigDecimal fee = cexIOArchivedOrder.feeValue;

return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(originalAmount)
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static UserTrades adaptTrades(List<CoinbaseBuySell> transactions, OrderTy
}

private static UserTrade adaptTrade(CoinbaseBuySell transaction, OrderType orderType) {
return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(transaction.getAmount().getAmount())
.currencyPair(
Expand Down Expand Up @@ -101,7 +101,7 @@ public static UserTrade adaptTrade(CoinbaseTransfer transfer) {
final BigDecimal feeAmount = transfer.getCoinbaseFee().getAmount();
final String feeCurrency = transfer.getCoinbaseFee().getCurrency();

return new UserTrade.Builder()
return UserTrade.builder()
.type(orderType)
.originalAmount(originalAmount)
.currencyPair(new CurrencyPair(tradableIdentifier, transactionCurrency))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testAdaptTrades() throws IOException {
BigDecimal price = new BigDecimal("905.10").divide(originalAmount, RoundingMode.HALF_EVEN);

UserTrade expectedTrade =
new UserTrade.Builder()
UserTrade.builder()
.type(OrderType.BID)
.originalAmount(originalAmount)
.currencyPair(CurrencyPair.BTC_USD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static UserTrades adaptTradeHistory(List<CoinbaseProFill> coinbaseExFills
CurrencyPair currencyPair = new CurrencyPair(fill.getProductId().replace('-', '/'));

trades.add(
new UserTrade.Builder()
UserTrade.builder()
.type("buy".equals(fill.getSide()) ? OrderType.BID : OrderType.ASK)
.originalAmount(fill.getSize())
.currencyPair(currencyPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static UserTrades adaptToUserTrades(List<CoindealTradeHistory> coindealTr
CurrencyPair currencyPair =
CurrencyPairDeserializer.getCurrencyPairFromString(coindealTradeHistory.getSymbol());
userTrades.add(
new UserTrade.Builder()
UserTrade.builder()
.type(
(coindealTradeHistory.getSide().equals("BUY"))
? Order.OrderType.BID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException
if (t.executedAmount == null || t.executedAmount.signum() == 0) {
return null;
}
return new UserTrade.Builder()
return UserTrade.builder()
.type(CoindirectAdapters.convert(t.side))
.originalAmount(t.executedAmount)
.currencyPair(CoindirectAdapters.toCurrencyPair(t.symbol))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static UserTrades adaptTradeHistory(CoinEggTradeView coinEggTradeView) {
.timestamp(coinEggTradeView.getDateTime())
.build();

trades.add((UserTrade) UserTrade.Builder.from(trade).build());
trades.add((UserTrade) UserTrade.builder().from(trade).build());

return new UserTrades(trades, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static UserTrades adaptTradeHistory(Collection<CoinfloorUserTransaction>
final BigDecimal feeAmount = transaction.getFee();

UserTrade trade =
new UserTrade.Builder()
UserTrade.builder()
.type(transaction.getSide())
.originalAmount(transaction.getAmount().abs())
.currencyPair(transaction.getCurrencyPair())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static UserTrades adaptTradeHistory(CoingiOrdersList ordersList) {
o.getCurrencyPair().get("counter").toUpperCase());

UserTrade trade =
new UserTrade.Builder()
UserTrade.builder()
.type(orderType)
.originalAmount(o.getOriginalBaseAmount())
.currencyPair(pair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static LimitOrder adaptOrderToLimitOrder(CoinjarOrder coinjarOrder) {
}

public static UserTrade adaptOrderToUserTrade(CoinjarOrder order) {
return new UserTrade.Builder()
return UserTrade.builder()
.id(order.oid.toString())
.orderId(order.oid.toString())
.currencyPair(productToCurrencyPair(order.productId))
Expand Down Expand Up @@ -165,7 +165,7 @@ public static OrderBook adaptOrderbook(CoinjarOrderBook orderBook, CurrencyPair
}

public static UserTrade adaptFillToUserTrade(CoinjarFill coinjarFill) {
return new UserTrade.Builder()
return UserTrade.builder()
.id(coinjarFill.tid.toString())
.orderId(coinjarFill.oid.toString())
.currencyPair(productToCurrencyPair(coinjarFill.productId))
Expand Down
Loading

0 comments on commit 6eb16c9

Please sign in to comment.