package com.xcong.excoin.modules.newPrice.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.xcong.excoin.modules.newPrice.ExchangeLoginEventService; import com.xcong.excoin.modules.newPrice.OKXAccount; import com.xcong.excoin.modules.newPrice.enums.DefaultUrls; import com.xcong.excoin.modules.newPrice.enums.HttpMethod; import com.xcong.excoin.modules.newPrice.utils.OKXContants; import lombok.extern.slf4j.Slf4j; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; @Slf4j public class ExchangeLoginEventServiceImpl implements ExchangeLoginEventService { private final com.xcong.excoin.modules.newPrice.OKXAccount OKXAccount; private final String apiKey; private final String secretKey; private final String passphrase; private final boolean accountType; public ExchangeLoginEventServiceImpl(String apiKey, String secretKey, String passphrase, boolean accountType) { this.apiKey = apiKey; this.secretKey = secretKey; this.passphrase = passphrase; this.accountType = accountType; OKXAccount = new OKXAccount( accountType ? DefaultUrls.USDM_PROD_URL : DefaultUrls.USDM_UAT_URL, apiKey, secretKey, passphrase, !accountType); } @Override public String exchangeInfo(LinkedHashMap parameters) { return OKXAccount.requestHandler.sendPublicRequest(OKXAccount.baseUrl, OKXContants.INSTRUMENTS,parameters, HttpMethod.GET, OKXAccount.isSimluate()); } @Override public String lineHistory(LinkedHashMap parameters) { return OKXAccount.requestHandler.sendPublicRequest(OKXAccount.baseUrl, OKXContants.K_LINE_HISTORY,parameters, HttpMethod.GET, OKXAccount.isSimluate()); } }