| | |
| | | // CappDlg 对话框 |
| | | |
| | | RecognitionManager* CappDlg::recognitionManager; |
| | | RecognitionManager* CappDlg::recognitionManager_L2Code; |
| | | |
| | | set<Authority> CappDlg::authoritySet; |
| | | //客户端编号 |
| | | int CappDlg::clientNum; |
| | |
| | | |
| | | capture = new L2DataCapture(); |
| | | recognitionManager = new RecognitionManager(); |
| | | recognitionManager_L2Code = new RecognitionManager(); |
| | | |
| | | limitUpCapture = new LimitUpCapture(); |
| | | tradeListCapture = new TradeListCapture(); |
| | | industryCapture = new IndustryCapture(); |
| | |
| | | DDX_Control(pDX, IDC_CHECK6, autoL2Check); |
| | | DDX_Control(pDX, IDC_CURRENT_PRICE, currentPriceBtn); |
| | | DDX_Control(pDX, IDC_STATIC_AUTO_MSG, autoMsgStatic); |
| | | DDX_Control(pDX, IDC_CHECK_PRICE_TIME_LIMIT, priceTimeLimitCheck); |
| | | DDX_Control(pDX, IDC_CHECK_TRADE_TIME_TRADE_SUCCESS, tradeSuccessTimeCheck); |
| | | DDX_Control(pDX, IDC_CHECK_TRADE_TIME_DELEGATE, delegateTimeCheck); |
| | | DDX_Control(pDX, IDC_CHECK_TRADE_TIME_LIMIT_UP, limitUpTimeCheck); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CappDlg, CDialogEx) |
| | |
| | | ON_BN_CLICKED(IDC_LOGOUT_BTN, &CappDlg::OnBnClickedLogoutBtn) |
| | | ON_BN_CLICKED(IDC_CHECK6, &CappDlg::OnBnClickedCheck6) |
| | | ON_BN_CLICKED(IDC_CURRENT_PRICE, &CappDlg::OnBnClickedCurrentPrice) |
| | | ON_BN_CLICKED(IDC_BUTTON_THS, &CappDlg::OnBnClickedButtonThs) |
| | | ON_BN_CLICKED(IDC_CHECK_TRADE_TIME_LIMIT_UP, &CappDlg::OnBnClickedCheckTradeTimeLimitUp) |
| | | ON_BN_CLICKED(IDC_CHECK_TRADE_TIME_TRADE_SUCCESS, &CappDlg::OnBnClickedCheckTradeTimeTradeSuccess) |
| | | ON_BN_CLICKED(IDC_CHECK_TRADE_TIME_DELEGATE, &CappDlg::OnBnClickedCheckTradeTimeDelegate) |
| | | ON_BN_CLICKED(IDC_CHECK_PRICE_TIME_LIMIT, &CappDlg::OnBnClickedCheckPriceTimeLimit) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | ((CButton*)GetDlgItem(IDC_CHECK4))->SetCheck(TRUE); |
| | | tradeTimeCaptureCheck.SetCheck(TRUE); |
| | | L2DataCapture::setTradeTimeCapture(true); |
| | | |
| | | limitUpTimeCheck.SetCheck(TRUE); |
| | | tradeSuccessTimeCheck.SetCheck(TRUE); |
| | | delegateTimeCheck.SetCheck(TRUE); |
| | | priceTimeLimitCheck.SetCheck(TRUE); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | //暂停采集 |
| | | app->capture->stop(index); |
| | | //暂停涨停识别 |
| | | LimitUpCapture::pause = TRUE; |
| | | |
| | | bool result = THSActionUtil::setGP(quickCode, codeList, recognitionManager); |
| | | if (!result) { |
| | | throw string("设置版块监控的GP失败"); |
| | | } |
| | | //刷新句柄 |
| | | //刷新L2数据 |
| | | THSActionUtil::setListenL2GP(index, code, recognitionManager); |
| | | //打开Level2监控屏幕 |
| | | THSActionUtil::openL2Screen(); |
| | |
| | | string value = (*ele).second; |
| | | app->capture->setGPCode(key, value); |
| | | } |
| | | Sleep(500); |
| | | } |
| | | catch (string e) { |
| | | throw e; |
| | |
| | | |
| | | //恢复采集 |
| | | app->capture->start(index); |
| | | //恢复涨停识别 |
| | | LimitUpCapture::pause = FALSE; |
| | | } |
| | | else if (action == "repairL2Data") { |
| | | //修正代码与L2行情代码不对应 或者 L2行情无数据的情况 |
| | |
| | | double max_price = root["data"]["max_price"].asDouble(); |
| | | cout << index << ":" << code << ":" << min_price << ":" << max_price << endl; |
| | | app->thsL2RepairTool->repairL2Data(recognitionManager, index, code, min_price, max_price); |
| | | }catch (string st) { |
| | | } |
| | | catch (string st) { |
| | | throw st; |
| | | } |
| | | |
| | | |
| | | } |
| | | else if (action == "getEnvState") { |
| | | |
| | |
| | | } |
| | | THSActionUtil::addTargetCodes(codeList, app->recognitionManager); |
| | | } |
| | | else if (action == "getIndustryCodes") { |
| | | //获取行业代码 |
| | | if (!app->industryCapture->isInited()) { |
| | | app->industryCapture->init(OnIndustryDataCallback, app); |
| | | } |
| | | try { |
| | | app->industryCapture->refreshHWND(); |
| | | } |
| | | catch (string st) { |
| | | cout << "初始化行业代码出错" << endl; |
| | | } |
| | | //识别行业代码 |
| | | CappDlg::runCaptureIndustryCodes(app); |
| | | } |
| | | else if (action == "getL2Codes") { |
| | | //获取正在监听的L2数据 |
| | | std::list<GPCodeArea> resultList = THSActionUtil::getListenL2GPAreaAndCode(recognitionManager_L2Code); |
| | | Json::Value root; |
| | | Json::Value data; |
| | | int index = 0; |
| | | for (std::list<GPCodeArea>::iterator ele = resultList.begin();ele != resultList.end();++ele) { |
| | | Json::Value item; |
| | | item["index"] = (*ele).cateIndex; |
| | | item["code"] = (*ele).code; |
| | | data[index++] = item; |
| | | } |
| | | root["data"] = data; |
| | | root["client"] = clientNum; |
| | | return JsonUtil::toJsonStr(root); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | |
| | | |
| | | string ownMemory = to_string(memoryUsage_M); |
| | | ownMemory.append("MB"); |
| | | |
| | | |
| | | //获取是否卡死 |
| | | bool thsDead; |
| | | string deadMsg = ""; |
| | | try { |
| | | string msg = JsonUtil::loadHeartbeatData(clientNum, to_string(mer), ownMemory); |
| | | bool result = THSActionUtil::thsIsDead(); |
| | | if (result) { |
| | | thsDead = true; |
| | | } |
| | | else { |
| | | thsDead = false; |
| | | } |
| | | } |
| | | catch (string e) { |
| | | thsDead = true; |
| | | deadMsg = e; |
| | | } |
| | | |
| | | |
| | | try { |
| | | string msg = JsonUtil::loadHeartbeatData(clientNum, to_string(mer), ownMemory, thsDead, deadMsg); |
| | | SocketManager::sendMsg(msg.c_str()); |
| | | //cout << "心跳信号" << endl; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | void CappDlg::checkTHSEnv(CappDlg *app) |
| | | void CappDlg::checkTHSEnv(CappDlg* app) |
| | | { |
| | | |
| | | try { |
| | |
| | | } |
| | | |
| | | |
| | | HWND l2 = THSActionUtil::getL2Win(); |
| | | if (l2 > 0) |
| | | { |
| | | Win32Util::showWindow(l2); |
| | | //初始化l2的各个窗口句柄 |
| | | app->capture->refreshHWND(); |
| | | } |
| | | HWND l2 = THSActionUtil::getL2Win(); |
| | | if (l2 > 0) |
| | | { |
| | | Win32Util::showWindow(l2); |
| | | //初始化l2的各个窗口句柄 |
| | | app->capture->refreshHWND(); |
| | | } |
| | | |
| | | HWND second = THSActionUtil::getSecondWindow(); |
| | | if (second <= 0) { |
| | | throw string("同花顺副屏1未打开"); |
| | | } |
| | | HWND second = THSActionUtil::getSecondWindow(); |
| | | if (second <= 0) { |
| | | throw string("同花顺副屏1未打开"); |
| | | } |
| | | |
| | | Win32Util::showWindow(second); |
| | | Win32Util::showWindow(second); |
| | | |
| | | |
| | | HWND third = THSActionUtil::getThirdWindow(); |
| | | if (third <= 0) { |
| | | throw string("同花顺副屏2未打开"); |
| | | } |
| | | HWND third = THSActionUtil::getThirdWindow(); |
| | | if (third <= 0) { |
| | | throw string("同花顺副屏2未打开"); |
| | | } |
| | | |
| | | Win32Util::showWindow(third); |
| | | Win32Util::showWindow(third); |
| | | |
| | | |
| | | //设置 |
| | | DEVMODE device = Win32Util::getL2ScreenInfo(); |
| | | int device_width = device.dmPelsWidth; |
| | | int device_height = device.dmPelsHeight; |
| | | POINTL device_pos = device.dmPosition; |
| | | //最大化L2 |
| | | Win32Util::moveWin(l2, device_pos.x, device_pos.y, device_width, device_height); |
| | | //将副屏1与副屏2缩小为屏幕的一半 |
| | | Win32Util::moveWin(second, device_pos.x, device_pos.y + device_height / 2, device_width / 2 - 50, device_height / 2); |
| | | Win32Util::moveWin(third, device_pos.x + device_width / 2 + 30, device_pos.y + device_height / 2, device_width / 2 - 50, device_height / 2); |
| | | //设置 |
| | | DEVMODE device = Win32Util::getL2ScreenInfo(); |
| | | int device_width = device.dmPelsWidth; |
| | | int device_height = device.dmPelsHeight; |
| | | POINTL device_pos = device.dmPosition; |
| | | //最大化L2 |
| | | Win32Util::moveWin(l2, device_pos.x, device_pos.y, device_width, device_height); |
| | | //将副屏1与副屏2缩小为屏幕的一半 |
| | | Win32Util::moveWin(second, device_pos.x, device_pos.y + device_height / 2, device_width / 2 - 50, device_height / 2); |
| | | Win32Util::moveWin(third, device_pos.x + device_width / 2 + 30, device_pos.y + device_height / 2, device_width / 2 - 50, device_height / 2); |
| | | } |
| | | |
| | | void CappDlg::autoStartL2(void* context) |
| | |
| | | clock_t time = clock(); |
| | | |
| | | CString path = GUITool::selectImage(); |
| | | std:string p = Tool::cstring2String(path); |
| | | std:string p = Tool::cstring2String(path); |
| | | if (p.length() <= 0) { |
| | | return; |
| | | } |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnBnClickedButtonThs() |
| | | { |
| | | try { |
| | | bool result = THSActionUtil::thsIsDead(); |
| | | if (result) { |
| | | AfxMessageBox(_T("卡死")); |
| | | } |
| | | else { |
| | | AfxMessageBox(_T("正常")); |
| | | } |
| | | } |
| | | catch (string e) { |
| | | CString msg(e.c_str()); |
| | | AfxMessageBox(msg); |
| | | } |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnBnClickedCheckTradeTimeLimitUp() |
| | | { |
| | | //涨停交易时段识别 |
| | | LimitUpCapture::setTradeTimeCapture(limitUpTimeCheck.GetCheck()); |
| | | } |
| | | |
| | | |
| | | |
| | | void CappDlg::OnBnClickedCheckTradeTimeTradeSuccess() |
| | | { |
| | | // 成交任务交易时段识别 |
| | | TradeListCapture::setTradeTimeCapture_success(tradeSuccessTimeCheck.GetCheck()); |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnBnClickedCheckTradeTimeDelegate() |
| | | { |
| | | // 委托交易时段识别 |
| | | TradeListCapture::setTradeTimeCapture_delegate(delegateTimeCheck.GetCheck()); |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnBnClickedCheckPriceTimeLimit() |
| | | { |
| | | // 现价识别时段限制 |
| | | CurrentPriceCapture::setTradeTimeCapture(priceTimeLimitCheck.GetCheck()); |
| | | } |