Administrator
1 days ago 665b1467f96b511a0d5cb8434ae634b65d961aa3
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
package com.xcong.excoin.modules.newPrice;
 
 
import com.xcong.excoin.common.exception.FebsException;
import com.xcong.excoin.modules.newPrice.impl.ExchangeLoginEventServiceImpl;
 
import java.util.HashMap;
import java.util.Map;
 
public class ExchangeLoginService {
    private final static Map<String, ExchangeLoginEventService> eventMap = new HashMap<>();
 
    static {
        for (ExchangeInfoEnum infoEnum : ExchangeInfoEnum.values()) {
            eventMap.put(infoEnum.name(), new ExchangeLoginEventServiceImpl(
                    infoEnum.getApiKey(),
                    infoEnum.getSecretKey(),
                    infoEnum.getPassphrase(),
                    infoEnum.isAccountType()));
        }
    }
 
    private ExchangeLoginService() {
    }
 
    public final static ExchangeLoginService INSTANCE = new ExchangeLoginService();
 
    public static ExchangeLoginEventService getInstance(String exchangeType) {
        ExchangeLoginEventService exchange = eventMap.get(exchangeType);
        if (exchange == null) {
            throw new FebsException("参数错误");
        }
 
        return exchange;
    }
}