forked from jiaminzou888/cppvnpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataEngine.h
More file actions
90 lines (74 loc) · 1.74 KB
/
DataEngine.h
File metadata and controls
90 lines (74 loc) · 1.74 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
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
#pragma once
#include <QMap>
#include <QStringList>
#include "Model/PublicStruct.h"
#include "Model/PositionBuffer.h"
struct user_trade_info
{
// 登录帐号信息
TThostFtdcBrokerIDType brokerid;
TThostFtdcUserIDType userid;
TThostFtdcPasswordType password;
// 交易日
TThostFtdcDateType trading_day;
//请求编号
int requestID{ 0 };
//本地的最大报单引用
int maxOrderRef{ 0 };
// 会话标记
int front_id{ 0 };
int session_id{ 0 };
user_trade_info()
{
memset(trading_day, 0x00, sizeof(trading_day));
}
};
struct orderCommonRequest
{
char instrument[31];
double price;
int volume;
char direction;
char offset;
orderCommonRequest()
{
memset(this, 0x00, sizeof(orderCommonRequest));
}
};
struct cancelCommonRequest
{
char instrument[31];
char exchange[9];
// CTP, LTS相关
char order_ref[13];
int session_id;
int front_id;
cancelCommonRequest()
{
memset(this, 0x00, sizeof(cancelCommonRequest));
}
};
// 存储模块公共数据
class DataEngine: public QObject
{
public:
bool de_get_contract(QString vtSymbol, InstrumentInfo& contract);
bool de_get_order(QString ordID, OrderInfo& ordInfo);
public:
/***MD Interface***/
// Tick回调(tick需要提炼一下)
QMap <QString, CThostFtdcDepthMarketDataField> lastMarketDataSet;
/***TD Interface***/
// 账户信息
AccountInfo accountInfo;
// 持仓查询缓存(区分昨仓和今仓)<key: vtSymbol.持仓方向>,本地所维护的真正持仓数据
QMap<QString, CPositionBuffer> allPosition_buffer;
// 持仓查询 <key: vtSymbol.持仓方向>,仅用于用户持仓列表展示的持仓备份
QMap<QString, PositionInfo> allPosition;
// 存放所有合约信息,供UI界面展示
QMap <QString, InstrumentInfo> allInstruments;
// 交易开启后的所有委托
QMap<QString, OrderInfo> allOrderDict;
// 交易活动委托
QMap<QString, OrderInfo> workingOrderDict;
};