Skip to content

Conversation

@292427558
Copy link

Fix known issues such as failed api calls

.currencyPair((CurrencyPair) marketOrder.getInstrument())
.side(marketOrder.getType())
.clientOrderId(marketOrder.getUserReference())
.clientOrderId("t-"+marketOrder.getUserReference())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you change the provided clientOrderId on the fly, then the library consumer can't find the order by original clientOrderId. IMHO it is a responsibility of a library consumer to generate the client ids in proper format

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, but if the client id is not specified, the order cannot be placed correctly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to api doc, field text in Order is optional: https://www.gate.io/docs/developers/apiv4/en/#create-an-order

I also just verified it manually

.currencyPair((CurrencyPair) limitOrder.getInstrument())
.side(limitOrder.getType())
.clientOrderId(limitOrder.getUserReference())
.clientOrderId("t-"+limitOrder.getUserReference())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you change the provided clientOrderId on the fly, then the library consumer can't find the order by original clientOrderId. IMHO it is a responsibility of a library consumer to generate the client ids in proper format

else if (orderType == OrderType.ASK) {
BigDecimal filledAssetAmount = gateioOrder.getFilledTotalQuote().divide(gateioOrder.getAvgDealPrice(), MathContext.DECIMAL32);
builder.cumulativeAmount(filledAssetAmount);
if(gateioOrder.getAvgDealPrice()==null||gateioOrder.getFilledTotalQuote()==null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please format with spaces

private StreamingMarketDataService streamingMarketDataService;
private StreamingTradeService streamingTradeService;
private StreamingAccountService streamingAccountService;
public static final String WS_CHANNEL_URI = "wss://api.gateio.ws/ws/v4/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why moving the url from config?

public final class Config {

public static final String V4_URL = "wss://api.gateio.ws/ws/v4/";
public static final String V4_URL = "https://api.gateio.ws/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this url is used for rest calls

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest api cannot be called normally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to do REST calls from xchange-stream-gateio module, all rest calls are done in xchange-gateio-v4 or xchange-gateio modules

.map(priceSizeEntry -> new LimitOrder(OrderType.ASK, priceSizeEntry.getSize(), orderBookPayload.getCurrencyPair(), null, null, priceSizeEntry.getPrice()));

Stream<LimitOrder> bids = orderBookPayload.getAsks().stream()
Stream<LimitOrder> bids = orderBookPayload.getBids().stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good catch 👍 I'll change the test to check it and fix it in PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it is #4854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants