Skip to content

Commit

Permalink
remove some random, reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
timmolter committed Apr 4, 2018
1 parent 91be3b3 commit d0cbb39
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 37 deletions.
2 changes: 0 additions & 2 deletions etc/util/mass-checkin-refactor.sh

This file was deleted.

4 changes: 0 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<version.slf4j>1.7.25</version.slf4j>

<skipIntegrationTests>true</skipIntegrationTests>
<reformat.skip>true</reformat.skip>
</properties>


Expand Down Expand Up @@ -351,9 +350,6 @@

</plugins>
</build>
<properties>
<reformat.skip>false</reformat.skip>
</properties>
</profile>
<profile>
<id>disable-java8-doclint</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static void generic(TradeService tradeService) throws IOException, Inter
String orderId = tradeService.placeLimitOrder(limitOrder);
System.out.println(
orderId); // Returned order id is currently broken for Gateio, rely on open orders instead//
// for demo :(
// for demo :(

Thread.sleep(2000); // wait for Gateio's back-end to propagate the order

Expand Down
8 changes: 2 additions & 6 deletions xchange-gdax/src/main/java/org/knowm/xchange/gdax/GDAX.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.knowm.xchange.gdax;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
Expand All @@ -15,7 +16,6 @@
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.knowm.xchange.gdax.dto.GDAXException;
import org.knowm.xchange.gdax.dto.GdaxTransfers;
import org.knowm.xchange.gdax.dto.account.GDAXAccount;
Expand All @@ -36,10 +36,6 @@
import org.knowm.xchange.gdax.dto.trade.GDAXPlaceOrder;
import org.knowm.xchange.gdax.dto.trade.GDAXSendMoneyResponse;
import org.knowm.xchange.utils.DateUtils;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;

import si.mazi.rescu.HttpStatusIOException;
import si.mazi.rescu.ParamsDigest;
import si.mazi.rescu.SynchronizedValueFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import si.mazi.rescu.HttpResponseAware;

public class GdaxTransfers extends ArrayList<GdaxTransfer> implements HttpResponseAware {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.knowm.xchange.gdax.service;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.dto.account.AccountInfo;
Expand All @@ -20,11 +24,6 @@
import org.knowm.xchange.service.trade.params.TradeHistoryParams;
import org.knowm.xchange.service.trade.params.WithdrawFundsParams;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class GDAXAccountService extends GDAXAccountServiceRaw implements AccountService {

public GDAXAccountService(Exchange exchange) {
Expand Down Expand Up @@ -126,7 +125,7 @@ public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws I

String accountId = gdaxAccount.getId();
String profileId = gdaxAccount.getProfile_id();
String createdAt = null;//use to get next page
String createdAt = null; // use to get next page

while (true) {
GdaxTransfers transfers = transfers(accountId, profileId, maxPageSize, createdAt);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.knowm.xchange.gdax.service;

import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.gdax.GDAX;
import org.knowm.xchange.gdax.dto.GDAXException;
import org.knowm.xchange.gdax.dto.GdaxTransfer;
import org.knowm.xchange.gdax.dto.GdaxTransfers;
import org.knowm.xchange.gdax.dto.account.GDAXAccount;
import org.knowm.xchange.gdax.dto.account.GDAXSendMoneyRequest;
Expand All @@ -17,11 +20,6 @@
import org.knowm.xchange.gdax.dto.trade.GDAXSendMoneyResponse;
import si.mazi.rescu.SynchronizedValueFactory;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public class GDAXAccountServiceRaw extends GDAXBaseService {

private final SynchronizedValueFactory<Long> nonceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public static UserTrades adaptTradeHistory(ItBitTradeHistory history) {
for (ItBitUserTrade trade :
tradesByOrderId.get(
orderId)) { // can have multiple trades for same order, so add them all up here to
// get// the average price and total fee
// get// the average price and total fee
totalValue = totalValue.add(trade.getCurrency1Amount().multiply(trade.getRate()));
totalQuantity = totalQuantity.add(trade.getCurrency1Amount());
totalFee = totalFee.add(trade.getCommissionPaid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ public class KrakenDepositAddress {
private final Long expiretm;
private final boolean newAddress;

public KrakenDepositAddress(@JsonProperty("address") String address, @JsonProperty("tag") String tag, @JsonProperty("expiretm") Long expiretm,
public KrakenDepositAddress(
@JsonProperty("address") String address,
@JsonProperty("tag") String tag,
@JsonProperty("expiretm") Long expiretm,
@JsonProperty("new") boolean newAddress) {
super();
this.address = address;
Expand All @@ -36,6 +39,14 @@ public boolean isNewAddress() {

@Override
public String toString() {
return "KrakenDepositAddress [address=" + address + ", tag=" + tag + ", expiretm=" + expiretm + ", newAddress=" + newAddress + "]";
return "KrakenDepositAddress [address="
+ address
+ ", tag="
+ tag
+ ", expiretm="
+ expiretm
+ ", newAddress="
+ newAddress
+ "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,17 @@ public static UserTrades adaptTradeHistory(
return new UserTrades(trades, TradeSortType.SortByTimestamp);
}

public static UserTrade adaptTrade(CurrencyPair currencyPair, QuadrigaCxUserTransaction quadrigacxUserTransaction) {
Order.OrderType orderType = quadrigacxUserTransaction.getCurrencyAmount(currencyPair.counter.getCurrencyCode()).doubleValue() > 0.0
? Order.OrderType.ASK : Order.OrderType.BID;
BigDecimal originalAmount = quadrigacxUserTransaction.getCurrencyAmount(currencyPair.base.getCurrencyCode());
public static UserTrade adaptTrade(
CurrencyPair currencyPair, QuadrigaCxUserTransaction quadrigacxUserTransaction) {
Order.OrderType orderType =
quadrigacxUserTransaction
.getCurrencyAmount(currencyPair.counter.getCurrencyCode())
.doubleValue()
> 0.0
? Order.OrderType.ASK
: Order.OrderType.BID;
BigDecimal originalAmount =
quadrigacxUserTransaction.getCurrencyAmount(currencyPair.base.getCurrencyCode());
BigDecimal price = quadrigacxUserTransaction.getPrice().abs();
Date timestamp = QuadrigaCxUtils.parseDate(quadrigacxUserTransaction.getDatetime());
long transactionId = quadrigacxUserTransaction.getId();
Expand All @@ -172,7 +179,19 @@ public static UserTrade adaptTrade(CurrencyPair currencyPair, QuadrigaCxUserTran
String orderId = String.valueOf(quadrigacxUserTransaction.getOrderId());
BigDecimal feeAmount = quadrigacxUserTransaction.getFee();

String feeCurrency = orderType.equals(Order.OrderType.ASK) ? currencyPair.counter.getCurrencyCode() : currencyPair.base.getCurrencyCode();
return new UserTrade(orderType, originalAmount.abs(), currencyPair, price, timestamp, tradeId, orderId, feeAmount, Currency.getInstance(feeCurrency));
String feeCurrency =
orderType.equals(Order.OrderType.ASK)
? currencyPair.counter.getCurrencyCode()
: currencyPair.base.getCurrencyCode();
return new UserTrade(
orderType,
originalAmount.abs(),
currencyPair,
price,
timestamp,
tradeId,
orderId,
feeAmount,
Currency.getInstance(feeCurrency));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public List<IRippleTradeTransaction> getTradesForAccount(
final List<RippleAmount> balanceChanges = trade.getBalanceChanges();
if (balanceChanges.size() < 2 || balanceChanges.size() > 3) {
continue; // this is not a trade - a trade will change 2 or 3 (including XRP fee) currency//
// balances
// balances
}

if (currencyFilter.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static LimitOrder adaptOrder(String orderId, Map map) {
String status =
map.get("status")
.toString(); // status: 0 - active, 1 - fulfilled and closed, 2 - cancelled, 3 -//
// cancelled after partially fulfilled.
// cancelled after partially fulfilled.

Date time = DateUtils.fromUnixTime(Long.valueOf(timestamp));

Expand Down

0 comments on commit d0cbb39

Please sign in to comment.