2015-01-07 01:26:14 +08:00
|
|
|
|
/*
|
|
|
|
|
* BaseInfoDriver.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2012-8-14
|
|
|
|
|
* Author: fasiondog
|
|
|
|
|
*/
|
|
|
|
|
|
2019-08-03 21:53:24 +08:00
|
|
|
|
#pragma once
|
2015-01-07 01:26:14 +08:00
|
|
|
|
#ifndef BASEINFODRIVER_H_
|
|
|
|
|
#define BASEINFODRIVER_H_
|
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
|
#include "../utilities/Parameter.h"
|
2015-01-07 01:26:14 +08:00
|
|
|
|
#include "../MarketInfo.h"
|
|
|
|
|
#include "../StockTypeInfo.h"
|
|
|
|
|
#include "../Stock.h"
|
|
|
|
|
|
|
|
|
|
namespace hku {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 基本信息数据获取驱动基类
|
|
|
|
|
*/
|
2017-10-09 02:25:02 +08:00
|
|
|
|
class HKU_API BaseInfoDriver {
|
|
|
|
|
PARAMETER_SUPPORT
|
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
|
public:
|
2016-04-03 00:08:31 +08:00
|
|
|
|
typedef unordered_map<string, MarketInfo> MarketInfoMap;
|
|
|
|
|
typedef unordered_map<hku_uint32, StockTypeInfo> StockTypeInfoMap;
|
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
|
BaseInfoDriver(const string& name);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
virtual ~BaseInfoDriver() { }
|
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
|
const string& name() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 驱动初始化
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
bool init(const Parameter& params);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载基础信息
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
bool loadBaseInfo();
|
|
|
|
|
|
2019-04-07 22:55:47 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取当前财务信息
|
|
|
|
|
* @param market 市场标识
|
|
|
|
|
* @param code 证券代码
|
|
|
|
|
*/
|
|
|
|
|
virtual Parameter getFinanceInfo(const string& market, const string& code);
|
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* 驱动初始化,具体实现时应注意将之前打开的相关资源关闭。
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
virtual bool _init() = 0;
|
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
|
/**
|
|
|
|
|
* 加载市场信息
|
|
|
|
|
* @return true 成功 | false 失败
|
|
|
|
|
*/
|
2017-10-09 02:25:02 +08:00
|
|
|
|
virtual bool _loadMarketInfo() = 0;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载证券类型信息
|
|
|
|
|
* @return true 成功 | false 失败
|
|
|
|
|
*/
|
2017-10-09 02:25:02 +08:00
|
|
|
|
virtual bool _loadStockTypeInfo() = 0;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载股票信息
|
|
|
|
|
* @return true 成功 | false 失败
|
|
|
|
|
*/
|
2017-10-09 02:25:02 +08:00
|
|
|
|
virtual bool _loadStock() = 0;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool checkType();
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
2017-10-09 02:25:02 +08:00
|
|
|
|
string m_name;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef shared_ptr<BaseInfoDriver> BaseInfoDriverPtr;
|
|
|
|
|
|
2017-10-20 02:11:57 +08:00
|
|
|
|
HKU_API std::ostream & operator<<(std::ostream&, const BaseInfoDriver&);
|
|
|
|
|
HKU_API std::ostream & operator<<(std::ostream&, const BaseInfoDriverPtr&);
|
|
|
|
|
|
2017-10-09 02:25:02 +08:00
|
|
|
|
|
|
|
|
|
inline const string& BaseInfoDriver::name() const {
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
|
} /* namespace hku */
|
|
|
|
|
#endif /* BASEINFODRIVER_H_ */
|