/*
|
Copyright (c) 2018 jones
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
¿ªÔ´ÏîÄ¿ https://github.com/jones2000/HQChart
|
|
jones_2000@163.com
|
|
¹ÉƱÊý¾ÝÀ༰¶ÔÍâ½Ó¿ÚÀà (c++)
|
*/
|
|
#pragma once
|
#include "zwldef.h"
|
#include <vector>
|
#include <map>
|
#include <string>
|
#include <set>
|
|
#ifdef _WIN32
|
#define REGISTER_HISTORYDATA(__class__)\
|
HQChart::Complier::IHistoryData* Create##__class__(const std::wstring& strSymbol, long lPeriod, long lRight)\
|
{\
|
return new __class__(strSymbol, lPeriod, lRight);\
|
}\
|
void Delete##__class__(HQChart::Complier::IHistoryData*& pHistoryData)\
|
{\
|
if (pHistoryData) { delete pHistoryData; pHistoryData = NULL; }\
|
}\
|
const bool bRegisteredCreate##__class__ = HQChart::Complier::DataCreateFactory::GetInstance().RegisterHistoryData(L#__class__, Create##__class__, Delete##__class__);\
|
|
|
#else
|
#define REGISTER_HISTORYDATA(__class__)\
|
HQChart::Complier::IHistoryData* Create__class__(const std::wstring& strSymbol, long lPeriod, long lRight)\
|
{\
|
return new __class__(strSymbol, lPeriod, lRight);\
|
}\
|
void Delete__class__(HQChart::Complier::IHistoryData*& pHistoryData)\
|
{\
|
if (pHistoryData) { delete pHistoryData; pHistoryData = NULL; }\
|
}\
|
const bool bRegisteredCreate__class__ = HQChart::Complier::DataCreateFactory::GetInstance().RegisterHistoryData(L"_class__", Create__class__, Delete__class__);\
|
|
#endif
|
|
namespace HQChart { namespace Complier {
|
|
#pragma pack(push,1)
|
|
struct HISTORY_ITEM
|
{
|
int _nDate=0; //ÈÕÆÚ yyyymmdd
|
int _nTime=0; //ʱ¼ä hhmmss
|
double _dYClose=0; //Ë㸴ȨÓÃ
|
double _dOpen=0;
|
double _dHigh=0;
|
double _dLow=0;
|
double _dClose=0;
|
double _dVol=0;
|
double _dAmount=0;
|
int _nAdvance = 0; //ÖÜÆÚÉÏÕǼÒÊý. ·Ö±Ê B/S
|
int _nDecline = 0; //ÖÜÆÚϵø¼ÒÊý.
|
};
|
|
//KÏßÐÅÏ¢
|
struct KDATA_INFO
|
{
|
long _lPeriod; //ÖÜÆÚ
|
long _lRight; //¸´È¨
|
|
//ÆðʼÈÕÆÚ
|
long _lStartDate;
|
long _lStartTime;
|
|
//½áÊøÈÕÆÚ
|
long _lEndDate;
|
long _lEndTime;
|
|
long _lCount; //KÏ߸öÊý
|
};
|
|
#pragma pack(pop)
|
|
//ÖÜÆÚ
|
enum PERIOD_TYPE_ID
|
{
|
PERIOD_DAY_ID=0,
|
PERIOD_WEEK_ID=1,
|
PERIOD_MONTH_ID=2,
|
PERIOD_YEAR_ID=3,
|
PERIOD_QUARTER_ID=9, //¼¾
|
PERIOD_TWO_WEEK_ID=21, //Ë«ÖÜ
|
|
PERIOD_MIN1_ID=4,
|
PERIOD_MIN5_ID=5,
|
PERIOD_MIN15_ID=6,
|
PERIOD_MIN30_ID=7,
|
PERIOD_MIN60_ID=8,
|
|
PERIOD_TICK_ID=10, //·Ö±Ê
|
};
|
|
//¸´È¨
|
enum RIGHT_TYPE_ID
|
{
|
RIGHT_NONE_ID = 0, //²»¸´È¨
|
RIGHT_BEFORE_ID = 1,//ǰ¸´È¨
|
RIGHT_AFTER_ID= 2, //ºó¸´È¨
|
};
|
|
class Variant;
|
class Node;
|
struct FIT_DATETIME_ITEM;
|
|
class VariantCacheManage;
|
class ScriptIndex;
|
class IHistoryData
|
{
|
public:
|
IHistoryData();
|
virtual ~IHistoryData();
|
|
typedef std::vector<Variant*> ARRAY_VARIANT;
|
typedef std::vector<Variant* > ARRAY_CALL_ARGUMENT;
|
typedef std::vector<HISTORY_ITEM> ARRAY_KDATA;
|
typedef std::vector<FIT_DATETIME_ITEM> ARRAY_FIT_DATETIME_DATA;
|
|
virtual void Initialization(void* pData) = 0; //³õʼ»¯
|
virtual bool LoadKData() = 0; //¼ÓÔØKÏß
|
virtual bool LoadKData(const std::wstring& strSymbol, long lPeriod, long lRight, Node* pNode, const std::wstring& strCallInfo) =0; //KÏßÏÂÔØ
|
|
virtual Variant* GetClose() const =0; //ÊÕÅ̼Û
|
virtual Variant* GetOpen() const =0; //¿ªÅÌ
|
virtual Variant* GetHigh() const =0; //×î¸ß
|
virtual Variant* GetLow() const =0; //×îµÍ
|
virtual Variant* GetVol() const =0; //Á¿
|
virtual Variant* GetAmount() const =0; //½ð¶î
|
virtual Variant* GetDate() const = 0; //ÈÕÆÚ
|
virtual Variant* GetTime() const =0; //ʱ¼ä
|
virtual Variant* GetMonth() const=0; //ÔÂ
|
virtual Variant* GetDay() const = 0; //Ìì
|
virtual Variant* GetYear() const=0; //Äê
|
virtual Variant* GetWeekDay() const=0; //ÐÇÆÚ¼¸
|
virtual Variant* GetHour() const=0; //Сʱ
|
virtual Variant* GetMinute() const=0; //·ÖÖÓ
|
virtual Variant* GetCurrBarsCount() const = 0; //µ½×îºó½»Ò×ÈÕµÄÖÜÆÚÊý
|
virtual Variant* GetTotalBarsCount() const = 0;
|
virtual Variant* GetFromOpen(Node* pNode) const = 0;
|
virtual Variant* GetAdvance() const = 0;
|
virtual Variant* GetDecline() const = 0;
|
virtual const ARRAY_KDATA* GetKData(const std::wstring& strSymbol, long lPeriod, long lRight) const = 0;
|
virtual Variant* GetKDataItem(const ARRAY_KDATA& aryData, const std::wstring& strVarName) const = 0;
|
|
virtual Variant* GetCustomValue(const std::wstring& strName, Node* pNode) const = 0;
|
virtual Variant* CallCustomFunction(const std::wstring& strName, const std::vector<double>& args, Node* pNode) const = 0;
|
|
virtual const HISTORY_ITEM* GetKItem(int nIndex) const = 0; //»ñÈ¡Ë÷Òý¶ÔÓ¦µÄKÏßÊý¾Ý
|
virtual long GetKCount() const = 0;
|
virtual const bool GetKMaxMin(double& dMax, double& dMin) const = 0; // »ñÈ¡KÏß×î´ó£¬×îСֵ
|
virtual const bool GetKMaxMin(long lStart, long lEnd, double& dMax, double& dMin) const = 0;
|
|
virtual long FindByDate(long lDate) const { return -1; } //²éÕÒijһÌìKÏßÈÕÆÚµÄË÷Òý
|
|
virtual Variant* GetBlockMemberCount(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const = 0; //°å¿é¹ÉƱ¸öÊý
|
virtual Variant* GetBlockCalculate(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const =0 ; //¶à¹Éͳ¼Æ
|
|
//ÆäËûÐÐÇéÊý¾Ý
|
virtual Variant* GetFinance(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const = 0; //²ÆÎñÊý¾Ý
|
virtual Variant* GetCapital(Node* pNode) const = 0; //CAPITAL µ±Ç°Á÷ͨ¹É±¾ ÊÖ
|
virtual Variant* GetTotalCaptialAll(Node* pNode) const = 0; //TOTALCAPITAL µ±Ç°×ܹɱ¾ ÊÖ
|
virtual Variant* GetHisCapital(Node* pNode) const = 0; //ÀúÊ·Á÷ͨ¹É±¾ ¹É
|
virtual Variant* GetExchange(Node* pNode) const = 0; //»»ÊÖÂÊ
|
virtual Variant* GetDynaInfo(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const = 0; //¸ö¹É×îÐÂÊý¾Ý
|
virtual Variant* GetIndexData(const std::wstring& strName, Node* pNode) const = 0; //»ñÈ¡´óÅÌÊý¾Ý
|
|
virtual Variant* GetName() const = 0; //¹ÉƱÃû³Æ
|
virtual Variant* GetSymbol(long lType) const = 0; //¹ÉƱ´úÂë
|
virtual const std::wstring& GetSymbolString() const = 0;//¹ÉƱ´úÂë
|
virtual Variant* GetCategroyName(long lType) const = 0; //°å¿éÃû³Æ
|
virtual Variant* IsInCategroy(long lType, const std::wstring& strName) const = 0; //ÊÇ·ñ°å¿é³ÉÔ±
|
virtual Variant* GetMarketName() const = 0; //Êг¡´úÂë
|
virtual Variant* GetMarketCNName() const = 0; //Êг¡Ãû³Æ
|
virtual Variant* GetPeriodID() const = 0; //·ÖʱÏß=1,·Ö±Ê³É½»=2,1·ÖÖÓÏß=3,5·ÖÖÓÏß=4,15·ÖÖÓÏß=5,30·ÖÖÓÏß=6,60·ÖÖÓÏß=7,ÈÕÏß=8,ÖÜÏß=9,ÔÂÏß=10,¶àÈÕÏß=11,ÄêÏß=12,¼¾Ïß=13,°ëÄêÏß=14¡£
|
virtual Variant* GetSymbolTypeID() const = 0;
|
virtual Variant* GetDrawNULL() const = 0;
|
|
virtual bool GetIndexScript(const std::wstring& strName, const std::wstring& strCallInfo, ScriptIndex& script, Node* pNode) const = 0; //»ñȡϵͳָ±ê½Å±¾
|
|
virtual long GetPeriod() const = 0;
|
virtual long GetRight() const = 0;
|
|
virtual ARRAY_KDATA& GetData() = 0;
|
virtual const ARRAY_KDATA& GetData() const = 0;
|
|
virtual bool IsMinutePeriod() const=0;
|
virtual bool IsDayPeriod() const=0;
|
virtual bool IsTickPeriod() const = 0;
|
|
virtual bool ConvertToDayPeriod(const ARRAY_KDATA& aryDay, ARRAY_KDATA& dest, long lPeriod) const;
|
virtual bool ConvertToMinutePeriod(const ARRAY_KDATA& aryOneMinute, ARRAY_KDATA& dest, long lPeriod) const;
|
virtual bool ConvertToRight(ARRAY_KDATA& aryData, long lRight) const; //¸´È¨¼ÆËã
|
|
inline const std::wstring& GetClassName() const { return m_strClassName; }
|
|
void ClearCache();
|
void SetCacheManage(VariantCacheManage* pVariantCacheManage);
|
|
static void FitDateTime(const IHistoryData* pDestHistoryData, const IHistoryData* pHistoryData, ARRAY_FIT_DATETIME_DATA& aryDateTime); //ÈÕÆÚÄâºÏ (pDestHistoryData ÐèҪת»»µÄK
|
static bool IsMinutePeriod(long lPeriod);
|
static bool IsDayPeriod(long lPeriod);
|
static bool IsTickPeriod(long lPeriod);
|
static bool IsSZSHStock(const std::wstring& strSymbol); //ÊÇ·ñΪÉϺ£/ÉîÖ¤¹ÉƱ
|
protected:
|
Variant* Create() const;
|
|
static long GetFriday(long lDate);
|
|
mutable ARRAY_VARIANT m_VariantCache; //±£´æËùÓд´½¨µÄ±äÁ¿Êý¾Ý
|
VariantCacheManage* m_pVariantCacheManage = NULL;
|
std::wstring m_strClassName = L"IHistoryData";
|
};
|
|
class VariantCacheManage
|
{
|
public:
|
typedef std::vector<Variant*> ARRAY_VARIANT;
|
|
VariantCacheManage();
|
~VariantCacheManage();
|
|
Variant* Create();
|
|
void FreeVariant();
|
void Clear();
|
|
private:
|
ARRAY_VARIANT m_aryUsedVariant;
|
ARRAY_VARIANT m_aryFreeVariant;
|
};
|
|
|
#pragma pack(push,1)
|
|
struct FINANCE_ITEM
|
{
|
int _nDate; //ÈÕÆÚ
|
double _dValue; //ijһ¸ö²ÆÎñÖ¸±ê
|
};
|
|
enum FINANCE_ID //²ÆÎñÊý¾ÝID
|
{
|
TOTAL_EQUITY_ID = 0, //×ܹɱ¾
|
FLOW_EQUITY_ID=7, //Á÷ͨ¹É±¾
|
SHAREHOLDER_ID=8, //¹É¶«ÈËÊý
|
AL_RATIO=9, //×ʲú¸ºÕ®ÂÊ(asset-liability ratio)
|
};
|
|
struct HISTORY_EXTEND_ITEM
|
{
|
int _nDate; //KÏßÈÕÆÚ
|
int _nTime = 0; //KÏßʱ¼ä
|
double _dValue; //Êý¾Ý
|
|
int _nExDate; //¶ÔÓ¦À©Õ¹Êý¾ÝµÄÈÕÆÚʱ¼ä £¨µ÷ÊÔÓÃ)
|
int _nExTime;
|
};
|
|
struct OVERLAY_HISTORY_ITEM
|
{
|
int _nDate;
|
int _nTime = 0;
|
double _dYClose=0; //ĿǰûÓõ½
|
double _dOpen;
|
double _dHigh;
|
double _dLow;
|
double _dClose;
|
double _dVol;
|
double _dAmount;
|
|
int _nAdvance = 0; //ÖÜÆÚÉÏÕǼÒÊý.
|
int _nDecline = 0; //ÖÜÆÚϵø¼ÒÊý.
|
|
int _nExDate; //¶ÔÓ¦À©Õ¹Êý¾ÝµÄÈÕÆÚʱ¼ä £¨µ÷ÊÔÓÃ)
|
int _nExTime;
|
};
|
|
enum DYNAINFO_ID
|
{
|
DYNAINFO_YCLOSE_ID=3, //ǰÊÕÅ̼Û
|
DYNAINFO_OPEN_ID=4, //¿ªÅ̼Û
|
DYNAINFO_HIGH_ID=5, //×î¸ß¼Û
|
DYNAINFO_LOW_ID=6, //×îµÍ¼Û
|
DYNAINFO_PRICE_ID=7, //ÏÖ¼Û
|
DYNAINFO_VOL_ID=8, //×ÜÁ¿
|
DYNAINFO_CVOL_ID=9, //ÏÖÁ¿
|
DYNAINFO_AMOUNT_ID=10, //½ð¶î
|
DYNAINFO_APRICE_ID=11, //¾ù¼Û
|
};
|
|
|
#pragma pack(pop)
|
|
//ÐÐÒµ·ÖÀà
|
struct CATEGROY_ITEM
|
{
|
long _lType; //ÐÐÒµÀàÐÍ
|
std::wstring _strName; //ÐÐÒµÃû³Æ
|
std::wstring _strSymbol;//ÐÐÒµ´úÂë
|
};
|
|
struct FIT_DATETIME_ITEM
|
{
|
long _lDate[2];
|
long _lTime[2];
|
long _lIndex = -1;
|
|
FIT_DATETIME_ITEM()
|
:_lIndex(-1)
|
{
|
_lDate[0] = _lDate[1] = 0;
|
_lTime[0] = _lTime[1] = 0;
|
}
|
};
|
|
|
class HistoryDataCache : public IHistoryData
|
{
|
public:
|
typedef std::vector<HISTORY_ITEM> ARRAY_KDATA;
|
typedef std::vector<FINANCE_ITEM> ARRAY_FINANCE_DATA;
|
typedef std::vector<HISTORY_EXTEND_ITEM> ARRAY_EXTEND_DATA;
|
typedef std::map<long, double> MAP_DYNAINFO_DATA;
|
typedef std::vector<OVERLAY_HISTORY_ITEM> ARRAY_OVERLAY_DATA; //µþ¼ÓÊý¾Ý
|
typedef std::vector<CATEGROY_ITEM> ARRAY_CATEGORY_DATA; //ÐÐÒµÊý¾Ý
|
|
HistoryDataCache(const std::wstring& strSymbol, long lPeriod, long lRight);
|
virtual ~HistoryDataCache();
|
|
virtual void Initialization(void* pData);
|
virtual bool LoadKData(); //¼ÓÔØKÏß
|
virtual bool LoadKData(const std::wstring& strSymbol, long lPeriod, long lRight, Node* pNode, const std::wstring& strCallInfo);
|
|
ARRAY_KDATA& GetData() { return m_aryData; };
|
const ARRAY_KDATA& GetData() const { return m_aryData; }
|
|
void SetName(const std::wstring& strName) { m_strName = strName; } //ÉèÖÃ¹ÉÆ±Ãû³Æ
|
|
virtual const HISTORY_ITEM* GetKItem(int nIndex) const;
|
virtual long GetKCount() const;
|
virtual const bool GetKMaxMin(double& dMax, double& dMin) const;
|
virtual const bool GetKMaxMin(long lStart, long lEnd, double& dMax, double& dMin) const;
|
virtual long FindByDate(long lDate) const;
|
|
virtual Variant* GetClose() const;
|
virtual Variant* GetOpen() const;
|
virtual Variant* GetHigh() const;
|
virtual Variant* GetLow() const;
|
virtual Variant* GetVol() const;
|
virtual Variant* GetAmount() const;
|
virtual Variant* GetDate() const;
|
virtual Variant* GetTime() const;
|
virtual Variant* GetMonth() const;
|
virtual Variant* GetYear() const;
|
virtual Variant* GetDay() const;
|
virtual Variant* GetWeekDay() const;
|
virtual Variant* GetHour() const;
|
virtual Variant* GetMinute() const;
|
virtual Variant* GetCurrBarsCount() const;
|
virtual Variant* GetTotalBarsCount() const;
|
virtual Variant* GetFromOpen(Node* pNode) const;
|
virtual Variant* GetAdvance() const;
|
virtual Variant* GetDecline() const;
|
virtual Variant* GetCustomValue(const std::wstring& strName, Node* pNode) const;
|
virtual Variant* CallCustomFunction(const std::wstring& strName, const std::vector<double>& args, Node* pNode) const;
|
virtual const ARRAY_KDATA* GetKData(const std::wstring& strSymbol, long lPeriod, long lRight) const;
|
virtual Variant* GetKDataItem(const ARRAY_KDATA& aryData, const std::wstring& strVarName) const;
|
|
virtual Variant* GetFinance(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const;
|
virtual Variant* GetExchange(Node* pNode) const; //»»ÊÖÂÊ
|
virtual Variant* GetCapital(Node* pNode) const; //»ñÈ¡µ±Ç°µÄÁ÷ͨ¹É±¾ µ¥Î»ÊÖ
|
virtual Variant* GetTotalCaptialAll(Node* pNode) const; //TOTALCAPITAL µ±Ç°×ܹɱ¾ ÊÖ
|
virtual Variant* GetHisCapital(Node* pNode) const; //»ñÈ¡ÀúÊ·ËùÓеÄÁ÷ͨ¹É±¾ µ¥Î»¹É
|
virtual Variant* GetDynaInfo(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const;
|
virtual Variant* GetIndexData(const std::wstring& strName, Node* pNode) const;
|
|
virtual Variant* GetBlockMemberCount(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const; //°å¿é¹ÉƱ¸öÊý
|
virtual Variant* GetBlockCalculate(const ARRAY_CALL_ARGUMENT& args, Node* pNode) const; //¶à¹Éͳ¼Æ
|
|
virtual Variant* GetName() const; //¹ÉƱÃû³Æ
|
virtual Variant* GetSymbol(long lType) const; //¹ÉƱ´úÂë
|
virtual Variant* GetCategroyName(long lType) const; //°å¿éÃû³Æ lType=-1 È¡ËùÓÐÐÐÒµ
|
virtual Variant* IsInCategroy(long lType, const std::wstring& strName) const;
|
virtual Variant* GetMarketName() const;
|
virtual Variant* GetMarketCNName() const;
|
virtual Variant* GetPeriodID() const; //·ÖʱÏß=1,·Ö±Ê³É½»=2,1·ÖÖÓÏß=3,5·ÖÖÓÏß=4,15·ÖÖÓÏß=5,30·ÖÖÓÏß=6,60·ÖÖÓÏß=7,ÈÕÏß=8,ÖÜÏß=9,ÔÂÏß=10,¶àÈÕÏß=11,ÄêÏß=12,¼¾Ïß=13,°ëÄêÏß=14¡£
|
virtual Variant* GetSymbolTypeID() const;
|
virtual Variant* GetDrawNULL() const;
|
|
virtual bool GetIndexScript(const std::wstring& strName, const std::wstring& strCallInfo, ScriptIndex& script, Node* pNode) const; //»ñȡϵͳָ±ê½Å±¾
|
|
virtual long GetPeriod() const { return m_lPeriod; }
|
virtual long GetRight() const { return m_lRight; }
|
virtual bool IsMinutePeriod() const;
|
virtual bool IsDayPeriod() const;
|
virtual bool IsTickPeriod() const;
|
|
bool IsSH() const; //ÉϺ£½»Ò×ËùÆ·ÖÖ
|
bool IsSZ() const; //ÉîÛÚ½»Ò×ËùÆ·ÖÖ
|
bool IsSHSZA() const; //ÉϺ£,ÉîÛÚA¹É
|
bool IsSHSZIndex() const; //ÉϺ£,ÉîÛÚÖ¸Êý
|
|
virtual const std::wstring& GetSymbolString() const { return m_strSymbol; }
|
|
|
|
protected:
|
virtual bool LoadFinance(long lType) const; //¼ÓÔØ²ÆÎñÊý¾Ý (Óõ½²Å¼ÓÔØ£©
|
virtual bool LoadDynainfo(long lType) const; //¼ÓÔØ¼´Ê±ÐÐÇéÊý¾Ý (Óõ½²Å¼ÓÔØ£©
|
virtual bool LoadIndexData(const std::wstring& strName, Node* pNode) const; //¼ÓÔØ´óÅÌÊý¾Ý (Óõ½²Å¼ÓÔØ)
|
virtual bool LoadCategoryData() const; //¼ÓÔØÐÐÒµ·ÖÀàÊý¾Ý(Óõ½²Å¼ÓÔØ)
|
|
Variant* GetIsPriceDown() const;
|
Variant* GetIsPriceUp() const;
|
Variant* GetIsPriceEqual() const;
|
|
static void FitExtendData(ARRAY_EXTEND_DATA& dest, const ARRAY_KDATA& kData, const ARRAY_FINANCE_DATA& fData); //²ÆÎñÊý¾ÝKÏßÊý¾ÝÄâºÏ
|
static void FitExtendData(ARRAY_EXTEND_DATA& dest, const ARRAY_KDATA& kData, long lPeriod, const ARRAY_FINANCE_DATA& fData, double dNUll, bool bExactMatch=true); ///Êý¾ÝºÍKÏßÊý¾ÝÄâºÏ,²»×öƽ»¬´¦Àí bExactMatch ¾«È·Æ¥Åä
|
|
static void FitOveralyDayData(ARRAY_OVERLAY_DATA& dest, const ARRAY_KDATA& kData, const ARRAY_KDATA& overalyData); //KÏßµþ¼ÓÄâºÏ
|
static void FitOveralyMinuteData(ARRAY_OVERLAY_DATA& dest, const ARRAY_KDATA& kData, const ARRAY_KDATA& overalyData); //KÏßµþ¼ÓÄâºÏ
|
static int GetWeek(int nDate);
|
|
mutable ARRAY_FINANCE_DATA m_aryFinance; //²ÆÎñÊý¾Ý¶ÁÈ¡»º´æ
|
mutable MAP_DYNAINFO_DATA m_mapDynainfo; //¼´Ê±ÐÐÇéÊý¾Ý
|
mutable ARRAY_OVERLAY_DATA m_aryIndex; //´óÅÌÊý¾Ý
|
mutable ARRAY_CATEGORY_DATA m_aryCategory; //ÐÐÒµ·ÖÀàÊý¾Ý
|
|
std::wstring m_strSymbol; //¹ÉƱ´úÂë
|
std::wstring m_strName; //¹ÉƱÃû³Æ
|
|
long m_lPeriod = 0; //ÖÜÆÚ 0=ÈÕÏß 1=ÖÜÏß 2=ÔÂÏß 3=ÄêÏß 4=1·ÖÖÓ 5=5·ÖÖÓ 6=15·ÖÖÓ 7=30·ÖÖÓ 8=60·ÖÖÓ 9=¼¾Ïß 10=·Ö±Ê
|
long m_lRight = 0; //¸´È¨ 0=²»¸´È¨ 1=ǰ¸´È¨ 2=ºó¸´È¨
|
ARRAY_KDATA m_aryData; //KÏßÊý¾Ý
|
KDATA_INFO m_KDataInfo; //KÏßÐÅÏ¢
|
std::map<std::wstring, ARRAY_KDATA> m_mapKData; //ÆäËûµÄKÏßÊý¾Ý
|
XINT64 m_lUpdateTime=0; //×îºó¸üÐÂʱ¼ä
|
};
|
|
|
|
typedef IHistoryData* (*pCreateHistoryData)(const std::wstring& strSymbol, long lPeriod, long lRight); //lPeriod=ÖÜÆÚ lRight=¸´È¨
|
typedef void(*pDeleteHistoryData)(IHistoryData*& pHistoryData);
|
|
struct CREATE_ITEM
|
{
|
std::wstring _strName;
|
pCreateHistoryData _pProcCreate = NULL;
|
pDeleteHistoryData _pProcDelete = NULL;
|
};
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
// Êý¾ÝÀ๤³§
|
//
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
class DataCreateFactory
|
{
|
public:
|
static DataCreateFactory& GetInstance();
|
|
bool RegisterHistoryData(const std::wstring& strClassName, pCreateHistoryData pProcCreate, pDeleteHistoryData pProcDelete);
|
|
IHistoryData* CreateHistoryData(const std::wstring& strClassName, const std::wstring& strSymbol, long lPeriod, long lRight);
|
bool DeleteHistoryData(const std::wstring& strClassName, IHistoryData*& pHistoryData);
|
|
private:
|
DataCreateFactory();
|
~DataCreateFactory();
|
|
typedef std::map<std::wstring, CREATE_ITEM> MAP_CREATE_DATA;
|
|
MAP_CREATE_DATA m_mapCreateData;
|
|
};
|
|
class AutoPtrHistoryData
|
{
|
public:
|
AutoPtrHistoryData(const std::wstring& strClassName);
|
~AutoPtrHistoryData();
|
|
IHistoryData* Create(const std::wstring& strSymbol, long lPeriod, long lRight);
|
void Release();
|
|
private:
|
std::wstring m_strClassName;
|
IHistoryData* m_pHistoryData=NULL;
|
};
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
// ×Ô¶¨Òå±äÁ¿,º¯Êý½Ó¿Ú
|
//
|
//
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
struct CUSTOM_FUNCTION_ITEM
|
{
|
std::wstring _strName; //²ÎÊýÃû
|
int _nArgCount; //²ÎÊý¸öÊý
|
};
|
|
class CustomFunction
|
{
|
public:
|
static CustomFunction& GetInstance();
|
|
bool Get(const std::wstring& strName, CUSTOM_FUNCTION_ITEM& item);
|
void Add(const std::wstring& strName, long lArgCount);
|
|
private:
|
CustomFunction();
|
~CustomFunction();
|
|
std::map<std::wstring, CUSTOM_FUNCTION_ITEM> m_aryCustomFunc; //×Ô¶¨Ò庯Êý
|
|
|
};
|
|
class CustomVariant
|
{
|
public:
|
static CustomVariant& GetInstance();
|
|
void Add(const std::wstring& strName);
|
bool IsExist(const std::wstring& strName) const;
|
|
private:
|
CustomVariant();
|
~CustomVariant();
|
|
std::set<std::wstring> m_setVariant;
|
};
|
|
|
}
|
}
|