package com.xcong.excoin.modules.okxNewPrice.okxpi.query;
|
|
import lombok.Data;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.stereotype.Component;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* 查询委托工厂类
|
* 该类用于根据不同的交易平台(如OKX、BINANCE)获取相应的查询委托服务实例
|
*/
|
@Component
|
@Data
|
public class QueryOrderFactory {
|
// OKX的查询委托服务实现
|
@Qualifier("oKXQueryOrderServiceImpl")
|
private final IQueryOrderService oKXQueryOrderServiceImpl;
|
|
// 存储不同交易平台查询委托服务的映射
|
private Map<String, IQueryOrderService> accountMap = new HashMap<>();
|
|
/**
|
* 构造方法,初始化查询委托服务映射
|
* @param oKXQueryOrderServiceImpl OKX的查询委托服务实现
|
*/
|
public QueryOrderFactory(IQueryOrderService oKXQueryOrderServiceImpl) {
|
this.oKXQueryOrderServiceImpl = oKXQueryOrderServiceImpl;
|
accountMap.put("OKX", oKXQueryOrderServiceImpl);
|
}
|
|
/**
|
* 根据平台名称获取查询委托服务实例
|
* @param key 平台名称,如"OKX"、"BINANCE"
|
* @return 对应平台的查询委托服务实例
|
*/
|
public IQueryOrderService get(String key) {
|
return accountMap.get(key);
|
}
|
}
|