forked from QuantBox/QuantBox_XAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMdUserApi.cpp
601 lines (502 loc) · 17.2 KB
/
MdUserApi.cpp
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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
#include "stdafx.h"
#include "MdUserApi.h"
#include "../include/QueueEnum.h"
#include "../include/QueueHeader.h"
#include "../include/ApiHeader.h"
#include "../include/ApiStruct.h"
#include "../include/toolkit.h"
#include "../include/ApiProcess.h"
#include "../QuantBox_Queue/MsgQueue.h"
#include "../QuantBox_XSpeed_Trade/TypeConvert.h"
#include <string.h>
#include <cfloat>
#include <mutex>
#include <vector>
#include <assert.h>
using namespace std;
void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3)
{
// 由内部调用,不用检查是否为空
CMdUserApi* pApi = (CMdUserApi*)pApi2;
pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3);
return nullptr;
}
void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3)
{
int iRet = 0;
switch (type)
{
case E_Init:
iRet = _Init();
break;
case E_UserLoginField:
iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3);
break;
case E_TradingDayField:
iRet = _ReqTradingDay(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3);
default:
break;
}
if (0 == iRet)
{
//返回成功,填加到已发送池
m_nSleep = 1;
}
else
{
m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3);
//失败,按4的幂进行延时,但不超过1s
m_nSleep *= 4;
m_nSleep %= 1023;
}
this_thread::sleep_for(chrono::milliseconds(m_nSleep));
}
CMdUserApi::CMdUserApi(void)
{
m_pApi = nullptr;
m_lRequestID = 0;
m_nSleep = 1;
// 自己维护两个消息队列
m_msgQueue = new CMsgQueue();
m_msgQueue_Query = new CMsgQueue();
m_msgQueue_Query->Register((void*)Query,this);
m_msgQueue_Query->StartThread();
}
CMdUserApi::~CMdUserApi(void)
{
Disconnect();
}
void CMdUserApi::Register(void* pCallback, void* pClass)
{
m_pClass = pClass;
if (m_msgQueue == nullptr)
return;
m_msgQueue_Query->Register((void*)Query,this);
m_msgQueue->Register(pCallback,this);
if (pCallback)
{
m_msgQueue_Query->StartThread();
m_msgQueue->StartThread();
}
else
{
m_msgQueue_Query->StopThread();
m_msgQueue->StopThread();
}
}
ConfigInfoField* CMdUserApi::Config(ConfigInfoField* pConfigInfo)
{
return nullptr;
}
bool CMdUserApi::IsErrorRspInfo_Output(struct DFITCErrorRtnField *pRspInfo)
{
bool bRet = ((pRspInfo) && (pRspInfo->nErrorID != 0));
if (bRet)
{
ErrorField* pField = (ErrorField*)m_msgQueue->new_block(sizeof(ErrorField));
pField->ErrorID = pRspInfo->nErrorID;
strcpy(pField->ErrorMsg, pRspInfo->errorMsg);
m_msgQueue->Input_NoCopy(ResponeType::OnRtnError, m_msgQueue, m_pClass, true, 0, pField, sizeof(ErrorField), nullptr, 0, nullptr, 0);
}
return bRet;
}
bool CMdUserApi::IsErrorRspInfo(struct DFITCErrorRtnField *pRspInfo)
{
bool bRet = ((pRspInfo) && (pRspInfo->nErrorID != 0));
return bRet;
}
void CMdUserApi::Connect(const string& szPath,
ServerInfoField* pServerInfo,
UserInfoField* pUserInfo)
{
m_szPath = szPath;
memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField));
memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField));
m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0,
nullptr, 0, nullptr, 0, nullptr, 0);
}
int CMdUserApi::_Init()
{
m_pApi = DFITCMdApi::CreateDFITCMdApi();
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0);
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0);
//初始化连接
int iRet = m_pApi->Init(m_ServerInfo.Address, this);
if (0 == iRet)
{
}
else
{
RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField));
pField->ErrorID = iRet;
strcpy(pField->ErrorMsg, "连接超时");
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
}
return iRet;
}
void CMdUserApi::ReqUserLogin()
{
DFITCUserLoginField* pBody = (DFITCUserLoginField*)m_msgQueue_Query->new_block(sizeof(DFITCUserLoginField));
strncpy(pBody->accountID, m_UserInfo.UserID, sizeof(DFITCAccountIDType));
strncpy(pBody->passwd, m_UserInfo.Password, sizeof(DFITCPasswdType));
pBody->companyID = atoi(m_ServerInfo.BrokerID);
m_msgQueue_Query->Input_NoCopy(RequestType::E_UserLoginField, m_msgQueue_Query, this, 0, 0,
pBody, sizeof(DFITCUserLoginField), nullptr, 0, nullptr, 0);
}
int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3)
{
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0);
DFITCUserLoginField* pBody = (DFITCUserLoginField*)ptr1;
pBody->lRequestID = ++m_lRequestID;
return m_pApi->ReqUserLogin(pBody);
}
void CMdUserApi::ReqTradingDay()
{
DFITCTradingDayField* pBody = (DFITCTradingDayField*)m_msgQueue_Query->new_block(sizeof(DFITCTradingDayField));
m_msgQueue_Query->Input_NoCopy(RequestType::E_TradingDayField, m_msgQueue_Query, this, 0, 0,
pBody, sizeof(DFITCTradingDayField), nullptr, 0, nullptr, 0);
}
int CMdUserApi::_ReqTradingDay(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3)
{
DFITCTradingDayField* pBody = (DFITCTradingDayField*)ptr1;
pBody->lRequestID = ++m_lRequestID;
return m_pApi->ReqTradingDay(pBody);
}
void CMdUserApi::OnRspTradingDay(struct DFITCTradingDayRtnField * pTradingDayRtnData)
{
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Done, 0, nullptr, 0, nullptr, 0, nullptr, 0);
m_TradingDay = GetDate(pTradingDayRtnData->date);
//有可能断线了,本处是断线重连后重新订阅
set<string> mapOld = m_setInstrumentIDs;//记下上次订阅的合约
//Unsubscribe(mapOld);//由于已经断线了,没有必要再取消订阅
Subscribe(mapOld, "");//订阅
////有可能断线了,本处是断线重连后重新订阅
//mapOld = m_setQuoteInstrumentIDs;//记下上次订阅的合约
//SubscribeQuote(mapOld, "");//订阅
}
void CMdUserApi::Disconnect()
{
// 清理查询队列
if (m_msgQueue_Query)
{
m_msgQueue_Query->StopThread();
m_msgQueue_Query->Register(nullptr,nullptr);
m_msgQueue_Query->Clear();
delete m_msgQueue_Query;
m_msgQueue_Query = nullptr;
}
if (m_pApi)
{
//m_pApi->RegisterSpi(NULL);
m_pApi->Release();
m_pApi = NULL;
// 全清理,只留最后一个
m_msgQueue->Clear();
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0);
// 主动触发
m_msgQueue->Process();
}
// 清理响应队列
if (m_msgQueue)
{
m_msgQueue->StopThread();
m_msgQueue->Register(nullptr,nullptr);
m_msgQueue->Clear();
delete m_msgQueue;
m_msgQueue = nullptr;
}
m_lRequestID = 0;
}
void CMdUserApi::Subscribe(const string& szInstrumentIDs, const string& szExchageID)
{
if(NULL == m_pApi)
return;
vector<char*> vct;
set<char*> st;
lock_guard<mutex> cl(m_csMapInstrumentIDs);
char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, 1, m_setInstrumentIDs);
if(vct.size()>0)
{
//转成字符串数组
char** pArray = new char*[vct.size()];
for (size_t j = 0; j<vct.size(); ++j)
{
pArray[j] = vct[j];
}
//订阅
m_pApi->SubscribeMarketData(pArray, (int)vct.size(), ++m_lRequestID);
delete[] pArray;
}
delete[] pBuf;
}
void CMdUserApi::Subscribe(const set<string>& instrumentIDs, const string& szExchageID)
{
if(NULL == m_pApi)
return;
string szInstrumentIDs;
for(set<string>::iterator i=instrumentIDs.begin();i!=instrumentIDs.end();++i)
{
szInstrumentIDs.append(*i);
szInstrumentIDs.append(";");
}
if (szInstrumentIDs.length()>1)
{
Subscribe(szInstrumentIDs, szExchageID);
}
}
void CMdUserApi::Unsubscribe(const string& szInstrumentIDs, const string& szExchageID)
{
if(NULL == m_pApi)
return;
vector<char*> vct;
set<char*> st;
lock_guard<mutex> cl(m_csMapInstrumentIDs);
char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, -1, m_setInstrumentIDs);
if(vct.size()>0)
{
//转成字符串数组
char** pArray = new char*[vct.size()];
for (size_t j = 0; j<vct.size(); ++j)
{
pArray[j] = vct[j];
}
//订阅
m_pApi->UnSubscribeMarketData(pArray, (int)vct.size(), ++m_lRequestID);
delete[] pArray;
}
delete[] pBuf;
}
//void CMdUserApi::SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID)
//{
// if (NULL == m_pApi)
// return;
//
// vector<char*> vct;
// set<char*> st;
//
// lock_guard<mutex> cl(m_csMapQuoteInstrumentIDs);
// char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, 1, m_setQuoteInstrumentIDs);
//
// if (vct.size()>0)
// {
// //转成字符串数组
// char** pArray = new char*[vct.size()];
// for (size_t j = 0; j<vct.size(); ++j)
// {
// pArray[j] = vct[j];
// }
//
// //订阅
// m_pApi->SubscribeForQuoteRsp(pArray, (int)vct.size());
//
// delete[] pArray;
// }
// delete[] pBuf;
//}
//
//void CMdUserApi::SubscribeQuote(const set<string>& instrumentIDs, const string& szExchageID)
//{
// if (NULL == m_pApi)
// return;
//
// string szInstrumentIDs;
// for (set<string>::iterator i = instrumentIDs.begin(); i != instrumentIDs.end(); ++i)
// {
// szInstrumentIDs.append(*i);
// szInstrumentIDs.append(";");
// }
//
// if (szInstrumentIDs.length()>1)
// {
// SubscribeQuote(szInstrumentIDs, szExchageID);
// }
//}
//
//void CMdUserApi::UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID)
//{
// if (NULL == m_pApi)
// return;
//
// vector<char*> vct;
// set<char*> st;
//
// lock_guard<mutex> cl(m_csMapQuoteInstrumentIDs);
// char* pBuf = GetSetFromString(szInstrumentIDs.c_str(), _QUANTBOX_SEPS_, vct, st, -1, m_setQuoteInstrumentIDs);
//
// if (vct.size()>0)
// {
// //转成字符串数组
// char** pArray = new char*[vct.size()];
// for (size_t j = 0; j<vct.size(); ++j)
// {
// pArray[j] = vct[j];
// }
//
// //订阅
// m_pApi->UnSubscribeForQuoteRsp(pArray, (int)vct.size());
//
// delete[] pArray;
// }
// delete[] pBuf;
//}
void CMdUserApi::OnFrontConnected()
{
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0);
//连接成功后自动请求登录
ReqUserLogin();
}
void CMdUserApi::OnFrontDisconnected(int nReason)
{
RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField));
//连接失败返回的信息是拼接而成,主要是为了统一输出
pField->ErrorID = nReason;
GetOnFrontDisconnectedMsg(nReason, pField->ErrorMsg);
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
}
void CMdUserApi::OnRspUserLogin(struct DFITCUserLoginInfoRtnField * pRspUserLogin, struct DFITCErrorRtnField * pRspInfo)
{
RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField));
if (!IsErrorRspInfo(pRspInfo)
&&pRspUserLogin)
{
//pField->TradingDay = pRspUserLogin->TradingDay;
//strncpy(field.LoginTime, pRspUserLogin->LoginTime, sizeof(TimeType));
//GetExchangeTime(pRspUserLogin->TradingDay, nullptr, pRspUserLogin->LoginTime,
// &field.TradingDay, nullptr, &field.LoginTime, nullptr);
sprintf(pField->SessionID, "%d", pRspUserLogin->sessionID);
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
}
else
{
pField->ErrorID = pRspInfo->nErrorID;
strncpy(pField->ErrorMsg, pRspInfo->errorMsg, sizeof(ErrorMsgType));
m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0);
}
}
void CMdUserApi::OnRspError(struct DFITCErrorRtnField *pRspInfo)
{
IsErrorRspInfo_Output(pRspInfo);
}
void CMdUserApi::OnRspSubMarketData(struct DFITCSpecificInstrumentField * pSpecificInstrument, struct DFITCErrorRtnField * pRspInfo)
{
//在模拟平台可能这个函数不会触发,所以要自己维护一张已经订阅的合约列表
if(!IsErrorRspInfo(pRspInfo)
&&pSpecificInstrument)
{
lock_guard<mutex> cl(m_csMapInstrumentIDs);
m_setInstrumentIDs.insert(pSpecificInstrument->InstrumentID);
}
}
void CMdUserApi::OnRspUnSubMarketData(struct DFITCSpecificInstrumentField * pSpecificInstrument, struct DFITCErrorRtnField * pRspInfo)
{
//模拟平台可能这个函数不会触发
if(!IsErrorRspInfo(pRspInfo)
&&pSpecificInstrument)
{
lock_guard<mutex> cl(m_csMapInstrumentIDs);
m_setInstrumentIDs.erase(pSpecificInstrument->InstrumentID);
}
}
//行情回调,得保证此函数尽快返回
void CMdUserApi::OnMarketData(struct DFITCDepthMarketDataField *pMarketDataField)
{
DepthMarketDataNField* pField = (DepthMarketDataNField*)m_msgQueue->new_block(sizeof(DepthMarketDataNField)+sizeof(DepthField)* 10);
strcpy(pField->InstrumentID, pMarketDataField->instrumentID);
pField->Exchange = DFITCExchangeIDType_2_ExchangeType(pMarketDataField->exchangeID);
sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pMarketDataField->exchangeID);
switch (pField->Exchange)
{
case ExchangeType::CZCE:
GetExchangeTime_CZCE(m_TradingDay, pMarketDataField->tradingDay, nullptr, pMarketDataField->UpdateTime
, &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec);
break;
default:
GetExchangeTime(pMarketDataField->tradingDay, nullptr, pMarketDataField->UpdateTime
, &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec);
break;
}
pField->UpdateMillisec = pMarketDataField->UpdateMillisec;
pField->LastPrice = pMarketDataField->lastPrice;
pField->Volume = pMarketDataField->Volume;
pField->Turnover = pMarketDataField->turnover;
pField->OpenInterest = pMarketDataField->openInterest;
pField->AveragePrice = pMarketDataField->AveragePrice;
pField->OpenPrice = pMarketDataField->openPrice;
pField->HighestPrice = pMarketDataField->highestPrice;
pField->LowestPrice = pMarketDataField->lowestPrice;
pField->ClosePrice = pMarketDataField->closePrice;
pField->SettlementPrice = pMarketDataField->settlementPrice;
pField->UpperLimitPrice = pMarketDataField->upperLimitPrice;
pField->LowerLimitPrice = pMarketDataField->lowerLimitPrice;
pField->PreClosePrice = pMarketDataField->preClosePrice;
pField->PreSettlementPrice = pMarketDataField->preSettlementPrice;
pField->PreOpenInterest = pMarketDataField->preOpenInterest;
InitBidAsk(pField);
do
{
if (pMarketDataField->BidVolume1 == 0)
break;
AddBid(pField, pMarketDataField->BidPrice1, pMarketDataField->BidVolume1, 0);
if (pMarketDataField->BidVolume2 == 0)
break;
AddBid(pField, pMarketDataField->BidPrice2, pMarketDataField->BidVolume2, 0);
if (pMarketDataField->BidVolume3 == 0)
break;
AddBid(pField, pMarketDataField->BidPrice3, pMarketDataField->BidVolume3, 0);
if (pMarketDataField->BidVolume4 == 0)
break;
AddBid(pField, pMarketDataField->BidPrice4, pMarketDataField->BidVolume4, 0);
if (pMarketDataField->BidVolume5 == 0)
break;
AddBid(pField, pMarketDataField->BidPrice5, pMarketDataField->BidVolume5, 0);
} while (false);
do
{
if (pMarketDataField->AskVolume1 == 0)
break;
AddAsk(pField, pMarketDataField->AskPrice1, pMarketDataField->AskVolume1, 0);
if (pMarketDataField->AskVolume2 == 0)
break;
AddAsk(pField, pMarketDataField->AskPrice2, pMarketDataField->AskVolume2, 0);
if (pMarketDataField->AskVolume3 == 0)
break;
AddAsk(pField, pMarketDataField->AskPrice3, pMarketDataField->AskVolume3, 0);
if (pMarketDataField->AskVolume4 == 0)
break;
AddAsk(pField, pMarketDataField->AskPrice4, pMarketDataField->AskVolume4, 0);
if (pMarketDataField->AskVolume5 == 0)
break;
AddAsk(pField, pMarketDataField->AskPrice5, pMarketDataField->AskVolume5, 0);
} while (false);
m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, DepthLevelType::FULL, 0, pField, pField->Size, nullptr, 0, nullptr, 0);
}
//void CMdUserApi::OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
//{
// if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)
// && pSpecificInstrument)
// {
// lock_guard<mutex> cl(m_csMapQuoteInstrumentIDs);
//
// m_setQuoteInstrumentIDs.insert(pSpecificInstrument->InstrumentID);
// }
//}
//
//void CMdUserApi::OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
//{
// if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)
// && pSpecificInstrument)
// {
// lock_guard<mutex> cl(m_csMapQuoteInstrumentIDs);
//
// m_setQuoteInstrumentIDs.erase(pSpecificInstrument->InstrumentID);
// }
//}
//
//void CMdUserApi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp)
//{
// //if (m_msgQueue)
// // m_msgQueue->Input_OnRtnForQuoteRsp(this, pForQuoteRsp);
//
//
// //XCall(m_msgQueue, ResponeType::OnConnectionStatus, 0, 0, 0, this, &field, nullptr);
//}