admin
2025-04-08 5c9991be21f57781573f04961ec511ac2938ea3d
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
/*
    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;
};
 
 
}
}