-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathHistoryCollector.h
83 lines (70 loc) · 2.71 KB
/
HistoryCollector.h
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
/************************************************************************
* Copyright(c) 2009, One Unified. All rights reserved. *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
#pragma once
#include <string>
#include "LibCommon/FastDelegate.h"
using namespace fastdelegate;
//#include "IQFeedRetrieveHistory.h"
//
// CHistoryCollector: base class for Daily Bars HD, Trades/Quotes HT
//
class CHistoryCollector {
public:
CHistoryCollector( IQFeedProvider *pProvider, const char *szSymbol, unsigned long nCount );
virtual ~CHistoryCollector( void );
virtual void Start( void );
std::string &Symbol( void ) { return m_sSymbol; };
typedef FastDelegate1<CHistoryCollector *> OnRetrievalCompleteHandler;
void SetOnRetrievalComplete( OnRetrievalCompleteHandler function ) {
OnRetrievalComplete = function;
}
virtual void WriteData( void ) = 0;
protected:
std::string m_sSymbol;
unsigned long m_nCount; // number of items to retrieve
IQFeedHistory *m_phistory;
OnRetrievalCompleteHandler OnRetrievalComplete;
void OnCompletion( IQFeedHistory *pHistory );
void FinalizeCreation( void ) {
m_phistory->SetOnRequestComplete( MakeDelegate( this, &CHistoryCollector::OnCompletion ) );
}
IQFeedProvider *m_pProvider;
private:
};
//
// CHistoryCollectorDaily:
//
class CHistoryCollectorDaily: public CHistoryCollector {
public:
CHistoryCollectorDaily( IQFeedProvider *pProvider, const char *szSymbol, unsigned long nCount );
virtual ~CHistoryCollectorDaily( void );
virtual void Start( void );
virtual void WriteData( void );
protected:
CBars m_bars;
private:
};
//
// CHistoryCollectorTicks:
//
class CHistoryCollectorTicks: public CHistoryCollector {
public:
CHistoryCollectorTicks( IQFeedProvider *pProvider, const char *szSymbol, unsigned long nCount );
virtual ~CHistoryCollectorTicks( void );
virtual void Start( void );
virtual void WriteData( void );
protected:
CTrades m_trades;
CQuotes m_quotes;
private:
};