forked from jasonweiyi/XAPI2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSubscribeManager.h
More file actions
53 lines (38 loc) · 1.4 KB
/
CSubscribeManager.h
File metadata and controls
53 lines (38 loc) · 1.4 KB
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
#pragma once
#include <set>
#include <string>
#include <vector>
#include <map>
class CSubscribeManager1;
class CSubscribeManager2;
class CSyntheticConfig;
class CSyntheticManager;
class CSyntheticCalculateFactory;
using namespace std;
class CSubscribeManager
{
public:
CSubscribeManager(CSyntheticConfig* pConfig, CSyntheticManager* pManager, CSyntheticCalculateFactory* pCalculateFactory);
~CSubscribeManager();
// 订阅,返回需要API订阅的合约
set<string> Subscribe(set<string> instruments, string exchange);
// 取消订阅,返回需要API取消的合约
set<string> Unsubscribe(set<string> instruments, string exchange);
// set转成字符串,用于发送请求
string Set2String(set<string> instruments, const char* seps = ";");
// 将字符串转成api可用的格式
char* String2Buf(const char* str, vector<char*>& vct, const char* seps = ";");
// 字符串转成set,用于后面的订阅计数
set<string> String2Set(const char* str, const char* seps = ";", int before = 1, const char* prefix = "");
set<string> GetParentInstruments(string exchange);
void Clear();
CSubscribeManager1* GetManager1(string exchange);
CSubscribeManager2* GetManager2(string exchange);
set<string> GetExchanges();
private:
map<string, CSubscribeManager1*> m_map_pSubscribeManager1;
map<string, CSubscribeManager2*> m_map_pSubscribeManager2;
CSyntheticConfig* m_pConfig;
CSyntheticManager* m_pManager;
CSyntheticCalculateFactory* m_pCalculateFactory;
};