Administrator
14 hours ago 635199d881d45a8c92abea57e89b69634ab4b366
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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<String, Object> parameters) {
        return OKXAccount.requestHandler.sendPublicRequest(OKXAccount.baseUrl, OKXContants.INSTRUMENTS,parameters, HttpMethod.GET, OKXAccount.isSimluate());
    }
 
    @Override
    public String lineHistory(LinkedHashMap<String, Object> parameters) {
        return OKXAccount.requestHandler.sendPublicRequest(OKXAccount.baseUrl, OKXContants.K_LINE_HISTORY,parameters, HttpMethod.GET, OKXAccount.isSimluate());
    }
 
}