| | |
| | | |
| | | if (showCodeDesc && doc[_T("data")].HasMember(L"code_info")) |
| | | { |
| | | wstring c = doc[_T("data")][_T("code_info")].GetArray()[0].GetString(); |
| | | auto data = doc[_T("data")].GetObjectW(); |
| | | wstring c = data[_T("code_info")].GetArray()[0].GetString(); |
| | | wstring name = L""; |
| | | if (!doc[_T("data")][_T("code_info")].GetArray()[1].IsNull()) { |
| | | name = doc[_T("data")][_T("code_info")].GetArray()[1].GetString(); |
| | | if (!data[_T("code_info")].GetArray()[1].IsNull()) { |
| | | name = data[_T("code_info")].GetArray()[1].GetString(); |
| | | } |
| | | wstring desc = doc[_T("data")][_T("desc")].GetString(); |
| | | if (data.HasMember(L"desc")) { |
| | | wstring desc = data[_T("desc")].GetString(); |
| | | wstring fresult; |
| | | fresult.append(c).append(L" ").append(name).append(L" ").append(desc); |
| | | CString resultC(fresult.c_str()); |
| | | context->setMsg(resultC, MSG_TYPE_INFO, FALSE); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | Sleep(delayMs); |
| | | } |
| | | try { |
| | | // 测试 |
| | | string result = NetworkApi::get_sell_result(order_ref); |
| | | //string result = string(StringUtil::cstring2String(L"{\"code\":0,\"data\":{\"msg\":\"成交\"}}")); |
| | | |
| | | auto doc = JsonUtil::parseUTF16(result); |
| | | if (doc.IsObject()) { |
| | | if (doc[L"code"] == 0) { |
| | |
| | | |
| | | void CFloatTradeDlg::OnClickedBtnAlreadyCanceled() |
| | | { |
| | | //CString st("测试123123"); |
| | | //showTips(st); |
| | | //list<HWND> hwnds = Win32Util::searchWindow("副屏1"); |
| | | //HWND hwnd = *(hwnds.begin()); |
| | | //::SetWindowPos(hwnd, HWND_TOPMOST,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); |
| | | //return; |
| | | |
| | | // 撤单 |
| | |
| | | |
| | | void CFloatTradeDlg::OnClickedBtnSell() |
| | | { |
| | | |
| | | if (codePosition.total <= 0) { |
| | | setMsg(L"无持仓", MSG_TYPE_FAIL); |
| | | return; |
| | |
| | | setMsg(L"请选择卖价类型", MSG_TYPE_FAIL); |
| | | return; |
| | | } |
| | | |
| | | // 卖 |
| | | try { |
| | | string code = getCode(); |
| | | string result = NetworkApi::sell(code, sell_volume_int, sellPriceType, true); |
| | | //string result = string( StringUtil::cstring2String( L"{\"code\":0,\"data\":{\"orderRef\":123123}}")); |
| | | CString msg(code.c_str()); |
| | | msg.Append(L":"); |
| | | auto doc = JsonUtil::parseUTF16(result); |
| | | if (doc.IsObject() && doc.HasMember(L"code")) { |
| | | if (doc[L"code"] == 0) { |
| | | if (doc[L"data"].HasMember(L"orderRef")) { |
| | | msg.Append(_T("提交卖成功")); |
| | | setMsg(msg, MSG_TYPE_SUCCESS); |
| | | string orderRef = StringUtil::cstring2String(doc[L"data"][L"orderRef"].GetString()); |
| | | string orderRef = std::to_string(doc[L"data"][L"orderRef"].GetInt()); |
| | | std::thread t1(requestSellResult, orderRef, this, 2000); |
| | | t1.detach(); |
| | | } |
| | |
| | | msg.Append(doc[L"data"][L"orderStatusMsg"].GetString()); |
| | | setMsg(msg, MSG_TYPE_FAIL); |
| | | } |
| | | } |
| | | else { |
| | | msg.Append(doc[L"msg"].GetString()); |
| | | setMsg(msg, MSG_TYPE_FAIL); |
| | | } |
| | | } |
| | | else { |
| | | msg.Append(L"解析结果出错"); |
| | | setMsg(msg, MSG_TYPE_FAIL); |
| | | } |
| | | |
| | | |
| | | } |
| | | catch (wstring st) { |
| | |
| | | editBuy1Volume.SetWindowTextW(L""); |
| | | editCode.SetWindowTextW(L""); |
| | | editSellVolume.SetWindowTextW(L""); |
| | | editEndTime.SetWindowTextW(L"14:50:00"); |
| | | editEndTime.SetWindowTextW(L"14:56:55"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | listRules.InsertColumn(0, _T("代码"), LVCFMT_LEFT, 50, 0); |
| | | listRules.InsertColumn(1, _T("买1量(手)"), LVCFMT_LEFT, 80, 1); |
| | | listRules.InsertColumn(2, _T("买1价"), LVCFMT_LEFT, 80, 2); |
| | | listRules.InsertColumn(2, _T("买1价"), LVCFMT_LEFT, 50, 2); |
| | | listRules.InsertColumn(3, _T("卖量(股)"), LVCFMT_LEFT,60, 3); |
| | | listRules.InsertColumn(4, _T("卖价类型"), LVCFMT_LEFT, 60, 4); |
| | | listRules.InsertColumn(5, _T("结束时间"), LVCFMT_LEFT, 60, 5); |
| | | listRules.InsertColumn(6, _T("状态"), LVCFMT_LEFT, 50, 6); |
| | | listRules.InsertColumn(7, _T("ID"), LVCFMT_LEFT, 50, 7); |
| | | listRules.InsertColumn(8, _T("创建时间"), LVCFMT_LEFT, 50, 8); |
| | | // listRules.InsertColumn(7, _T("ID"), LVCFMT_LEFT, 50, 7); |
| | | // listRules.InsertColumn(8, _T("创建时间"), LVCFMT_LEFT, 50, 8); |
| | | listRules.AutoColumn(); |
| | | |
| | | list<string> types = get_price_types(); |
| | |
| | | app->listRules.SetItemText(index, 4, CString(price_type.c_str())); |
| | | app->listRules.SetItemText(index, 5, rule.end_time); |
| | | app->listRules.SetItemText(index, 6, rule.excuted ? L"已执行" : L"未执行"); |
| | | app->listRules.SetItemText(index, 7, rule.id_); |
| | | app->listRules.SetItemText(index, 8, rule.create_time); |
| | | //app->listRules.SetItemText(index, 7, rule.id_); |
| | | //app->listRules.SetItemText(index, 8, rule.create_time); |
| | | if (rule.excuted) { |
| | | app->listRules.SetItemData(index, COLOR_RED); |
| | | } |
| | |
| | | writer.Int(buy1Volume_int * 100); |
| | | |
| | | writer.Key("buy1_price"); |
| | | writer.Int(buy1Volume_int * 100); |
| | | writer.String(StringUtil::cstring2String(buy1Price).c_str()); |
| | | |
| | | writer.Key("sell_volume"); |
| | | writer.Int(stoi(StringUtil::cstring2String(sellVolume))); |
| | |
| | | trade_refresh = 1; |
| | | group_refresh = 0; |
| | | trade_quick_key = 1; |
| | | window_pos = "[-1004,456]"; |
| | | window_pos = "[-598,406]"; |
| | | ths_auto_click_positions = "[\n [\n 50,\n 150\n ],\n [\n 50,\n 100\n ],\n [\n 50,\n 300\n ]\n]"; |
| | | ths_auto_click_time_space = 500; |
| | | ths_auto_refresh_time_space = 200; |
| | |
| | | CString st = L""; |
| | | auto doc = JsonUtil::parseUTF16(result); |
| | | if (doc.IsObject()) { |
| | | if (doc[L"code"] == 0&& doc[L"data"].IsArray()) { |
| | | if (doc[L"code"] == 0&& doc[L"data"].IsObject()) { |
| | | |
| | | auto array = doc[L"data"].GetArray(); |
| | | for (int i = 0; i < array.Size(); i++) { |
| | | st.Append(std::to_wstring(i + 1).c_str()); |
| | | st.Append(L"-"); |
| | | if (array[i][1].GetBool()) { |
| | | st.Append(L"已锁"); |
| | | } |
| | | else { |
| | | st.Append(L"未锁"); |
| | | } |
| | | st.Append(L"("); |
| | | st.Append(array[i][2].GetString()); |
| | | st.Append(L")"); |
| | | auto data = doc[L"data"].GetObject(); |
| | | if (data.HasMember(L"common")) { |
| | | st.Append(L"一般通道:"); |
| | | st.Append(L"总数-"); |
| | | st.Append(std::to_wstring( data[L"common"][0].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"可用数-"); |
| | | st.Append(std::to_wstring(data[L"common"][1].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"活跃数-"); |
| | | st.Append(std::to_wstring(data[L"common"][2].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"\r\n"); |
| | | } |
| | | |
| | | if (data.HasMember(L"trade")) { |
| | | st.Append(L"交易通道:"); |
| | | st.Append(L"总数-"); |
| | | st.Append(std::to_wstring(data[L"trade"][0].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"可用数-"); |
| | | st.Append(std::to_wstring(data[L"trade"][1].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"活跃数-"); |
| | | st.Append(std::to_wstring(data[L"trade"][2].GetInt()).c_str()); |
| | | st.Append(L" "); |
| | | st.Append(L"\r\n"); |
| | | } |
| | | } |
| | | dlg->labelHXTradeChannel.SetWindowTextW(st); |