Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascendex Apis #4531

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions xchange-ascendex/api-specification.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AscendEx api spec

url: https://ascendex.com/
url(backup): https://asdx.me/zh-cn
doc: https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation

You need an extra parameters:
exSpec.setExchangeSpecificParametersItem("account-group","account-group");

5 changes: 4 additions & 1 deletion xchange-ascendex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
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.balance.AscendexCashAccountBalanceDto;
import org.knowm.xchange.ascendex.dto.enums.AscendexOrderType;
import org.knowm.xchange.ascendex.dto.enums.AscendexSide;
import org.knowm.xchange.ascendex.dto.marketdata.AscendexAssetDto;
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.trade.AscendexFlags;
import org.knowm.xchange.ascendex.dto.enums.AscendexFlags;
import org.knowm.xchange.ascendex.dto.trade.AscendexOpenOrdersResponse;
import org.knowm.xchange.ascendex.dto.trade.AscendexPlaceOrderRequestPayload;
import org.knowm.xchange.currency.Currency;
Expand Down Expand Up @@ -98,10 +100,10 @@ public static AscendexPlaceOrderRequestPayload adaptLimitOrderToAscendexPlaceOrd
limitOrder.getInstrument().toString(),
Date.from(Instant.now()).toInstant().toEpochMilli(),
limitOrder.getOriginalAmount().toString(),
AscendexPlaceOrderRequestPayload.AscendexOrderType.limit,
AscendexOrderType.limit,
limitOrder.getType().equals(Order.OrderType.ASK)
? AscendexPlaceOrderRequestPayload.AscendexSide.sell
: AscendexPlaceOrderRequestPayload.AscendexSide.buy,
? AscendexSide.sell
: AscendexSide.buy,
null,
limitOrder.getLimitPrice().toString(),
null,
Expand Down Expand Up @@ -207,8 +209,8 @@ public static ExchangeMetaData adaptExchangeMetaData(
}

public static Order.OrderType adaptAscendexSideToOrderType(
AscendexPlaceOrderRequestPayload.AscendexSide ascendexSide) {
if (AscendexPlaceOrderRequestPayload.AscendexSide.buy.equals(ascendexSide)) {
AscendexSide ascendexSide) {
if (AscendexSide.buy.equals(ascendexSide)) {
return Order.OrderType.BID;
} else {
return Order.OrderType.ASK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,56 @@

import java.io.IOException;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
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.enums.AccountCategory;
import org.knowm.xchange.ascendex.dto.marketdata.*;

@Path("api/pro/v1")
@Path("api/pro")
@Produces(MediaType.APPLICATION_JSON)
public interface IAscendex {

/**=========================Market Data (Public)======================================**/
@GET
@Path("/assets")
@Path("/v1/assets")
@Deprecated
AscendexResponse<List<AscendexAssetDto>> getAllAssets() throws IOException;

@GET
@Path("/products")
@Path("/v2/assets")
AscendexResponse<List<AscendexAssetDto>> getAllAssetsV2() throws IOException;

@GET
@Path("/v1/products")
AscendexResponse<List<AscendexProductDto>> getAllProducts() throws IOException;

@GET
@Path("/depth")
AscendexResponse<AscendexOrderbookDto> getOrderbookDepth(@QueryParam("symbol") String symbol)
throws IOException;
@Path("/v1/{accountCategory}/products")
AscendexResponse<List<AscendexProductKindDto>> getAllProducts(@PathParam("accountCategory") AccountCategory accountCategory) throws IOException;

@GET
@Path("/trades")
AscendexResponse<AscendexMarketTradesDto> getTrades(@QueryParam("symbol") String symbol)
throws IOException;
@Path("/v1/spot/ticker")
AscendexResponse<AscendexTickerDto> getTicker( @QueryParam("symbol") String symbol) throws IOException;

@GET
@Path("/barhist")
@Path("/v1/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)
@QueryParam("symbol") String symbol,
@QueryParam("interval") String internal,
@QueryParam("to") Long to,
@QueryParam("from") Long from,
@QueryParam("n") Integer noOfBars)
throws IOException;

@GET
@Path("/v1/depth")
AscendexResponse<AscendexOrderbookDto> getOrderbookDepth(@QueryParam("symbol") String symbol)
throws IOException;

@GET
@Path("/v1/trades")
AscendexResponse<AscendexMarketTradesDto> getTrades(@QueryParam("symbol") String symbol,@QueryParam("n") Integer n)
throws IOException;


}
Loading