package com.xcong.excoin.modules.okxNewPrice.okxpi.trade.impl;
|
|
import com.alibaba.fastjson.JSON;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.OKXAccount;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.enums.HttpMethod;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.utils.OKXContants;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.utils.ParameterChecker;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.trade.TradeEventEnum;
|
import com.xcong.excoin.modules.okxNewPrice.okxpi.trade.TradeService;
|
import lombok.RequiredArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.util.LinkedHashMap;
|
|
@Slf4j
|
@RequiredArgsConstructor
|
public class TradeServiceBuy implements TradeService {
|
|
@Override
|
public String tradeEvent() {
|
return TradeEventEnum.TRADE_BUY.getEventPoint();
|
}
|
|
@Override
|
public String doTrade(LinkedHashMap<String, Object> tradeDto, OKXAccount okxAccount) {
|
ParameterChecker.checkParameter(tradeDto, "instId", String.class);
|
ParameterChecker.checkParameter(tradeDto, "tdMode", String.class);
|
ParameterChecker.checkParameter(tradeDto, "side", String.class);
|
ParameterChecker.checkParameter(tradeDto, "ordType", String.class);
|
ParameterChecker.checkParameter(tradeDto, "sz", Double.class);
|
String placeOrderRspOkxRestResponse = okxAccount.requestHandler.sendSignedRequest(okxAccount.baseUrl, OKXContants.ORDER, tradeDto, HttpMethod.POST, okxAccount.isSimluate());
|
log.info("开仓响应:{}",JSON.parseObject(placeOrderRspOkxRestResponse).get("data"));
|
/**
|
* todo 下单之后的日志处理
|
*/
|
return placeOrderRspOkxRestResponse;
|
}
|
}
|