| | |
| | | |
| | | 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) { |