Skip to content

Commit

Permalink
format and organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Molter committed Jan 24, 2022
1 parent fcd2463 commit 723a38d
Show file tree
Hide file tree
Showing 318 changed files with 5,000 additions and 3,225 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package org.knowm.xchange.ascendex;

import java.time.Instant;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.knowm.xchange.ascendex.dto.account.AscendexCashAccountBalanceDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexAssetDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexMarketTradesDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import javax.ws.rs.core.MediaType;
import org.knowm.xchange.ascendex.dto.AscendexResponse;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexAssetDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexBarHistDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexMarketTradesDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexOrderbookDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexProductDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexBarHistDto;

@Path("api/pro/v1")
@Produces(MediaType.APPLICATION_JSON)
Expand All @@ -38,9 +38,11 @@ AscendexResponse<AscendexMarketTradesDto> getTrades(@QueryParam("symbol") String

@GET
@Path("/barhist")
AscendexResponse<List<AscendexBarHistDto>> getHistoricalBarData(@QueryParam("symbol") String symbol,
@QueryParam("interval") String internal,
@QueryParam("to") Long to,
@QueryParam("from") Long from,
@QueryParam("n") Integer noOfBars) throws IOException;
AscendexResponse<List<AscendexBarHistDto>> getHistoricalBarData(
@QueryParam("symbol") String symbol,
@QueryParam("interval") String internal,
@QueryParam("to") Long to,
@QueryParam("from") Long from,
@QueryParam("n") Integer noOfBars)
throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

import java.io.IOException;
import java.util.List;
import javax.ws.rs.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.knowm.xchange.ascendex.dto.AscendexResponse;
import org.knowm.xchange.ascendex.dto.account.AscendexCashAccountBalanceDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,81 @@
import com.fasterxml.jackson.annotation.JsonProperty;

public class AscendexBarDto {
private final Long timestamp;
private final String interval;
private final String openPrice;
private final String closePrice;
private final String highPrice;
private final String lowPrice;
private final String volume;
private final Long timestamp;
private final String interval;
private final String openPrice;
private final String closePrice;
private final String highPrice;
private final String lowPrice;
private final String volume;

public AscendexBarDto(
@JsonProperty("ts") Long timestamp,
@JsonProperty("i") String interval,
@JsonProperty("o") String openPrice,
@JsonProperty("c") String closePrice,
@JsonProperty("h") String highPrice,
@JsonProperty("l") String lowPrice,
@JsonProperty("v") String volume) {
this.timestamp = timestamp;
this.interval = interval;
this.openPrice = openPrice;
this.closePrice = closePrice;
this.highPrice = highPrice;
this.lowPrice = lowPrice;
this.volume = volume;
}
public AscendexBarDto(
@JsonProperty("ts") Long timestamp,
@JsonProperty("i") String interval,
@JsonProperty("o") String openPrice,
@JsonProperty("c") String closePrice,
@JsonProperty("h") String highPrice,
@JsonProperty("l") String lowPrice,
@JsonProperty("v") String volume) {
this.timestamp = timestamp;
this.interval = interval;
this.openPrice = openPrice;
this.closePrice = closePrice;
this.highPrice = highPrice;
this.lowPrice = lowPrice;
this.volume = volume;
}

public Long getTimestamp() {
return timestamp;
}
public Long getTimestamp() {
return timestamp;
}

public String getInterval() {
return interval;
}
public String getInterval() {
return interval;
}

public String getOpenPrice() {
return openPrice;
}
public String getOpenPrice() {
return openPrice;
}

public String getClosePrice() {
return closePrice;
}
public String getClosePrice() {
return closePrice;
}

public String getHighPrice() {
return highPrice;
}
public String getHighPrice() {
return highPrice;
}

public String getLowPrice() {
return lowPrice;
}
public String getLowPrice() {
return lowPrice;
}

public String getVolume() {
return volume;
}
public String getVolume() {
return volume;
}

@Override
public String toString() {
return "AscendexBarDto{" +
"timestamp=" + timestamp +
", interval='" + interval + '\'' +
", openPrice='" + openPrice + '\'' +
", closePrice=" + closePrice +
", highPrice='" + highPrice + '\'' +
", lowPrice='" + lowPrice + '\'' +
", volume='" + volume + '\'' +
'}';
}
@Override
public String toString() {
return "AscendexBarDto{"
+ "timestamp="
+ timestamp
+ ", interval='"
+ interval
+ '\''
+ ", openPrice='"
+ openPrice
+ '\''
+ ", closePrice="
+ closePrice
+ ", highPrice='"
+ highPrice
+ '\''
+ ", lowPrice='"
+ lowPrice
+ '\''
+ ", volume='"
+ volume
+ '\''
+ '}';
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
package org.knowm.xchange.ascendex.dto.marketdata;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

public class AscendexBarHistDto implements Serializable {

private final String m;
private final String symbol;
private final AscendexBarDto bar;

public AscendexBarHistDto(
@JsonProperty("m") String m,
@JsonProperty("s") String symbol,
@JsonProperty("data") AscendexBarDto bar) {
this.m = m;
this.symbol = symbol;
this.bar = bar;
}

public String getM() {
return m;
}

public String getSymbol() {
return symbol;
}

public AscendexBarDto getBar() {
return bar;
}

@Override
public String toString() {
return "AscendexBarHistDto{" +
"m='" + m + '\'' +
", symbol='" + symbol + '\'' +
", bar=" + bar +
'}';
}
private final String m;
private final String symbol;
private final AscendexBarDto bar;

public AscendexBarHistDto(
@JsonProperty("m") String m,
@JsonProperty("s") String symbol,
@JsonProperty("data") AscendexBarDto bar) {
this.m = m;
this.symbol = symbol;
this.bar = bar;
}

public String getM() {
return m;
}

public String getSymbol() {
return symbol;
}

public AscendexBarDto getBar() {
return bar;
}

@Override
public String toString() {
return "AscendexBarHistDto{"
+ "m='"
+ m
+ '\''
+ ", symbol='"
+ symbol
+ '\''
+ ", bar="
+ bar
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import java.util.List;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ascendex.AscendexException;
import org.knowm.xchange.ascendex.dto.marketdata.*;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexAssetDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexBarHistDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexMarketTradesDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexOrderbookDto;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexProductDto;

public class AscendexMarketDataServiceRaw extends AscendexBaseService {

Expand All @@ -30,7 +34,9 @@ public AscendexMarketTradesDto getAscendexTrades(String symbol)
return checkResult(ascendex.getTrades(symbol));
}

public List<AscendexBarHistDto> getBarHistoryData(String symbol,String interval,Long to,Long from,Integer noOfBars) throws AscendexException,IOException {
return checkResult(ascendex.getHistoricalBarData(symbol,interval,to,from,noOfBars));
public List<AscendexBarHistDto> getBarHistoryData(
String symbol, String interval, Long to, Long from, Integer noOfBars)
throws AscendexException, IOException {
return checkResult(ascendex.getHistoricalBarData(symbol, interval, to, from, noOfBars));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import org.knowm.xchange.dto.trade.OpenOrders;
import org.knowm.xchange.dto.trade.UserTrades;
import org.knowm.xchange.service.trade.TradeService;
import org.knowm.xchange.service.trade.params.*;
import org.knowm.xchange.service.trade.params.CancelOrderByCurrencyPair;
import org.knowm.xchange.service.trade.params.CancelOrderParams;
import org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair;
import org.knowm.xchange.service.trade.params.TradeHistoryParams;
import org.knowm.xchange.service.trade.params.TradeHistoryParamsAll;
import org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamInstrument;
import org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair;
import org.knowm.xchange.service.trade.params.orders.OpenOrdersParamInstrument;
Expand All @@ -33,7 +37,7 @@ public String placeLimitOrder(LimitOrder limitOrder) throws IOException {
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
if (orderParams instanceof CancelOrderByCurrencyPair) {
cancelAllAscendexOrdersBySymbol(
((CancelOrderByCurrencyPair) orderParams).getCurrencyPair().toString());
((CancelOrderByCurrencyPair) orderParams).getCurrencyPair().toString());
return true;
} else {
throw new IOException(
Expand All @@ -43,7 +47,7 @@ public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {

@Override
public Class[] getRequiredCancelOrderParamClasses() {
return new Class[]{CancelOrderByCurrencyPair.class};
return new Class[] {CancelOrderByCurrencyPair.class};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package org.knowm.xchange.ascendex;

import java.io.IOException;
import java.util.List;
import java.util.Objects;
import org.junit.Assert;
import org.junit.Test;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexBarHistDto;
import org.knowm.xchange.ascendex.service.AscendexMarketDataService;

import java.io.IOException;
import java.util.List;
import java.util.Objects;

public class AscendexMarketDataIntegrationTest {

@Test
public void testBarHist() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(AscendexExchange.class.getCanonicalName());
exchange.remoteInit();
@Test
public void testBarHist() throws IOException {
Exchange exchange =
ExchangeFactory.INSTANCE.createExchange(AscendexExchange.class.getCanonicalName());
exchange.remoteInit();

List<AscendexBarHistDto> barHistDtos = ((AscendexMarketDataService)exchange.getMarketDataService()).getBarHistoryData("BTC/USDT", "15", null, null, 100);
Assert.assertTrue(Objects.nonNull(barHistDtos) && !barHistDtos.isEmpty());
}
List<AscendexBarHistDto> barHistDtos =
((AscendexMarketDataService) exchange.getMarketDataService())
.getBarHistoryData("BTC/USDT", "15", null, null, 100);
Assert.assertTrue(Objects.nonNull(barHistDtos) && !barHistDtos.isEmpty());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package org.knowm.xchange.bankera;

import java.io.IOException;
import javax.ws.rs.*;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.knowm.xchange.bankera.dto.BankeraException;
import org.knowm.xchange.bankera.dto.BankeraToken;
Expand Down
Loading

0 comments on commit 723a38d

Please sign in to comment.