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;
|
}
|
}
|