From abc5b592843b5482ddbeb576ee7fba46f2fc5e39 Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期四, 11 九月 2025 23:14:11 +0800 Subject: [PATCH] 250911 --- analysisbyrediscache.h | 26 ++ clientmainwindow.h | 3 analysisbyrediscache.ui | 28 ++ positionmanagement.cpp | 32 ++ analysisbyrediscache.cpp | 511 +++++++++++++++++++++++++++++++++++++++ clientmainwindow.cpp | 5 getstocklist.cpp | 4 getstocklist.h | 1 positionmanagement.h | 27 ++ stock_plan.pro | 9 customitem.h | 2 positionmanagement.ui | 89 ++++++ 12 files changed, 727 insertions(+), 10 deletions(-) diff --git a/analysisbyrediscache.cpp b/analysisbyrediscache.cpp index b74eed5..88841fd 100644 --- a/analysisbyrediscache.cpp +++ b/analysisbyrediscache.cpp @@ -3,6 +3,11 @@ #include <QDateTime> #include <QDebug> #include <QElapsedTimer> +#include <QFile> +#include <QJsonArray> +#include <QJsonDocument> +#include <QJsonObject> +#include <QNetworkReply> AnalysisByRedisCache::AnalysisByRedisCache(QWidget *parent) : QMainWindow(parent), @@ -10,7 +15,8 @@ { ui->setupUi(this); - ui->dateEdit->setDate(QDate::currentDate().addMonths(-1)); + ui->dateEdit->setDate(QDate::currentDate().addMonths(-1)); // 鍒濆鍖栧紑濮嬫煡璇㈡椂闂� + ui->dateEdit_end->setDate(QDate::currentDate()); // 鍒濆鍖栫粨鏉熸椂闂� if(m_dbCache.initMySQL("127.0.0.1",3306,"root","root","stock_plan")){ qDebug()<<"mysql conn ok"; @@ -31,9 +37,16 @@ ui->tableView_2->setModel(m_modelResult); QStringList labels; - labels<<"鑲$エ鍚嶅瓧"<<"甯傚��"<<"鏀剁洏浠�"<<"娑ㄨ穼骞�"<<"鎺掑悕"<<"浜ゆ槗鏃堕棿"<<"鎺掑悕鍙樺寲"<<"搴曢儴鍙嶈浆鏃堕棿"<<"涓�闃崇┛鍥涚嚎鏃堕棿"; + labels<<"鑲$エ鍚嶅瓧"<<"甯傚��"<<"鏀剁洏浠�"<<"娑ㄨ穼骞�"<<"鎺� 鍚�"<<"浜ゆ槗鏃堕棿"<<"鎺掑悕鍙樺寲"<<"浜ゆ槗棰�"<<"搴曢儴鍙嶈浆鏃堕棿"<<"涓�闃崇┛鍥涚嚎鏃堕棿"; m_model->setHorizontalHeaderLabels(labels); m_modelResult->setHorizontalHeaderLabels(labels); + + //ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + //ui->tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); + ui->tableView->resizeColumnToContents(0); + ui->tableView->resizeColumnToContents(4); + // 鍒濆鍖栫埇铏浉鍏崇殑Http + loadHttpInit(QUrl("https://xueqiu.com/S/SZ002466")); } AnalysisByRedisCache::~AnalysisByRedisCache() @@ -45,8 +58,9 @@ { ui->label_load->setText("缂撳瓨鍔犺浇涓�..."); QString begin_date = ui->dateEdit->text(); + QString end_date = ui->dateEdit_end->text(); QString limit_str = ui->comboBox->currentText(); - QString sql = QString("select * from stock_day_info where time_trade > '%1' limit %2;").arg(begin_date).arg(limit_str); + QString sql = QString("select * from stock_day_info where time_trade > '%1' and time_trade <= '%3' limit %2;").arg(begin_date).arg(limit_str).arg(end_date); qDebug()<<"sql:"<<sql; QElapsedTimer timer; timer.start(); @@ -99,6 +113,469 @@ } } + +void AnalysisByRedisCache::loadHttpInit(QUrl url) +{ + // 澶勭悊鏁版嵁鐖彇鐨勬搷浣� + // 妯℃嫙娴忚鍣ㄧ殑鍙傛暟 + QString userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"; + m_cookie = "__utma=1.731742638.1647403301.1699341909.1700229030.32; device_id=196eef62baf016c7d95a22752d9bdbab; smidV2=20240414233939e95389ecf7ecd2f4d08524ce770aacd500753aa68e9640320; s=c611de27gr; cookiesu=651726298794778; xq_a_token=220b0abef0fac476d076c9f7a3938b7edac35f48; xqat=220b0abef0fac476d076c9f7a3938b7edac35f48; xq_r_token=1d46f0ed628506486164e5055a4993f9b54b2f4c; xq_id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOi0xLCJpc3MiOiJ1YyIsImV4cCI6MTcyOTIxMjc4NCwiY3RtIjoxNzI3NDkwOTU3MjA0LCJjaWQiOiJkOWQwbjRBWnVwIn0.C_GmKEhTaaioDMLWkgZyMXDl4duYEVmsdJHsTi7gbcNz0Tohc-uxHsaw0yBT5k-qmbrJ_RaLMCSxy06v14-R3dwL-MsiKRHxHa5qvQZN4BjEgvPRkqqvPgE_fkPLte8qQOEgd5iVkhr-4mjip0-9WCeXYiH7DygxFOBXGlgoPtpPzAtOTm5TWJmXh0ipDsIZxfNOl8jipXYaIdkv_kqLul5gqiBi5qqnwONDa24Zx-Kvpm8ySWiPFBLzZBqTuRBs4oKAMpSdOiYGLVL7dcSDDZyWqAexmrN4f19hkmd6gBHL4dCczRMDGYc1e98sQtlbZ5lgeEuuM24jjcuwCxsxXQ; u=651726298794778; Hm_lvt_1db88642e346389874251b5a1eded6e3=1727099939,1727251802,1727488707,1727491020; HMACCOUNT=1628106D67895387; acw_tc=2760828017275244258732552e9880f861be6db0c40facbdd5f223490decc2; acw_sc__v2=66f7ee8290dc3f63112948801ef331b8c97ccb35; Hm_lpvt_1db88642e346389874251b5a1eded6e3=1727524485; .thumbcache_f24b8bbe5a5934237bbc0eda20c1b6e7=t00N841S/BEpxTGOoJrbm0blWik12om0ew/whcq/V2DNtyEA8um7J+yzeGOli+6iP/TrvrH0YKH2kHlsmDb5EQ%3D%3D; ssxmod_itna=YqAOBKYve+x0ODfxBcDB4DKM7RtAA4454DkDIEC+GAqGNK3DZDiqAPGhDC8RzeL4Ko7+e2aeQvSeopd5pYDk0Ge5TB0PIjaIDB3DEx06TCCQxiiSDCeDIDWeDiDG4Gm4qGtDpxG=DjDytZ9TtDm4GWGqDmDGYBWqDgDYQDGwIXD7QDIqtW07tQDDNQKpAKDiYeHlL5uMRMtOrK7DtDjdTD/3+kZCbCcPwVFeFO=nPcDB6wxBjZRq00Un+g4mNqLYf4IDAxQuYKtgheYYoAfDhTKhhLSGx4tGY4+GDKSiMS2DDAIvdKeD; ssxmod_itna2=YqAOBKYve+x0ODfxBcDB4DKM7RtAA4454DkDIEC+GDA69mqD/YttDFhxMltFKApT7bCMH+bytp7GQQyCbBWukeAF3+jxeN2wLjbQAFcdwbeNeoohjQ4qtEnLg4TKyX2LqVL=CGaV=GqZZqbDby8DFnFbgWiZEH8zoBzBCbzqWeqwoPq7/TpL=gIRY8sVhEpnWWHQU8sz+S8=+8oRerHq0wtQnSzyQDK7Dmvr3a+VY7fezRmxKF=bDeqexYUbuuzw2eR3In9evW6tzHbQY6vp=AIOUc9l6vc0vOl9plD6D07zGGQ41uxpii2Y5s7KvYQDWGYExD7=DYKKeD=="; + QByteArray cookieByte = m_cookie.toUtf8(); + QList<QNetworkCookie> list; + list.push_back(QNetworkCookie(cookieByte)); + + QVariant var; + var.setValue(list); + // 璁剧疆瑕佽闂殑缃戝潃 + //m_request.setUrl(QUrl("https://xueqiu.com/S/SZ002466")); + m_request.setUrl(url); + // 璁剧疆璇锋眰澶达紝鐢ㄦ埛浠g悊锛岀敤鏉ユā鎷熸祻瑙堝櫒 + m_request.setHeader(QNetworkRequest::UserAgentHeader,userAgent); + // 璁剧疆cookie + //m_request.setHeader(QNetworkRequest::CookieHeader, var); + + // 鏌ョ湅manager閮芥敮鎸佸摢浜涘崗璁� + qDebug()<<"缂撳瓨鍒嗘瀽---鏀寔鐨勫崗璁�:"<<m_manager.supportedSchemes(); + // 鍏宠仈淇″彿妲斤紝褰撹姹傜鐞嗗璞″畬鍏ㄦ墦寮�缃戦〉涔嬪悗锛屼細灏嗘暟鎹粰妲藉嚱鏁板鐞� + connect(&m_manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(showAplyData(QNetworkReply*))); + +} + +void AnalysisByRedisCache::showAplyData(QNetworkReply *reply) +{ + qDebug()<<"缂撳瓨鍒嗘瀽--鏀跺埌鍝嶅簲"; + // 灏嗗搷搴旂殑鏁版嵁锛屼竴鎶婅鍙栧畬锛屾斁鍒板瓧鑺傛暟缁勯噷闈㈡潵澶勭悊 + QByteArray buffer = reply->readAll(); + + // 灏嗘暟鎹啓鍒版枃浠朵腑锛屾柟渚胯瀵熸暟鎹唴瀹� +// QFile file("data.txt"); +// file.open(QIODevice::ReadWrite | QIODevice::Text); +// QTextStream out(&file); +// out << buffer << endl; +// file.close(); + + // 涓嬮潰浣跨敤JSON杩涜鏁版嵁澶勭悊 + if(reply->url() == QUrl("https://xueqiu.com/")){ + qDebug()<<"鍙戠幇棣栭〉url"; + qDebug()<<buffer; + + }else if(reply->url().toString().indexOf("https://stock.xueqiu.com/v5/stock/chart/kline.json") != -1){ + qDebug()<<"鏌ョ湅涓偂鎯呭喌:"; + getStockOne(buffer); + + }else if(reply->url().toString().indexOf("https://stock.xueqiu.com/v5/stock/screener/quote/list.json?page=1&size=100&order=desc&order_by=percent&market=CN&ind_code") != -1){ + qDebug()<<"鏍规嵁琛屼笟鑾峰彇鑲$エ淇℃伅"<<reply->url(); + QString industryCode = reply->url().toString().split("=").back(); + qDebug()<<"琛屼笟淇℃伅:"<<industryCode; + //getStockByIndustry(buffer,industryCode); + + }else if(reply->url().toString().indexOf("https://stock.xueqiu.com/v5/stock/screener/quote/list.json") != -1){ + qDebug()<<"鑾峰彇鎵�鏈夋勃娣辫偂绁� 鍙互骞叉椿浜�"; + //getStockAllCode(buffer); + }else if(reply->url().toString().indexOf("https://stock.xueqiu.com/v5/stock/screener/industries.json") != -1){ + qDebug()<<"鑾峰彇琛屼笟淇℃伅"; + //getIndustryInfo(buffer); + } + + reply->deleteLater(); +} + +void AnalysisByRedisCache::buttomToUpPolicySlot(QString symbol) +{ + /* + 澶嶇洏涔嬪墠鐨勬湀绾跨獊鐮存儏鍐碉紝鏀鹃噺涓婃定锛�5鍊嶅乏鍙筹紝骞朵笖鍦�60鏃ュ潎绾夸笂鍐查珮锛屼笉鍥炶惤锛屽ぇ姒傜巼鍙互缁х画鍐� + 鍏虫敞濂藉啿鐨勫舰鎬侊紝鍔犱笂寰堝ソ鐨勬崲鎵嬬巼80%+锛岀敋鑷�100%+锛岃鏄庡厖鍒嗘崲鎵嬩簡锛岀獊鐮翠細鏇村ソ锛屾湁灏变細璧氬鍊� + 骞朵笖澶氭棩鏌ョ湅锛屾瘮渚嬪�间竴鐩村湪鏀惧ぇ锛岃鏄庡緢闈犺氨锛屽氨鏄湁涓�涓暟鍊兼瘮渚嬬殑鐖崌杩囩▼锛岄偅灏卞彲浠ラ噸浠撲拱鍏ョ瓑鏀剁泭浜嗭紝鍙互缁樺埗涓�鏉℃洸绾挎潵瑙傚療鎯呭喌 + */ + + qDebug()<<"鎵ц搴曢儴鍙嶈浆绛栫暐"; + //emit sendInfoMess("<font size=12 color=pink>鎵ц搴曢儴鍙嶈浆绛栫暐 </font>"); + int curRow = ui->tableView->currentIndex().row(); +// QString symbol = m_model->item(curRow,1)->text(); + + //QString symbol = m_customModel->data(m_customModel->index(curRow,1)).toString(); + qint64 begin = QDateTime::currentMSecsSinceEpoch(); // 鍙栧綋鍓嶆椂闂存埑 + int numsCnt = 300; + QString urlStr = QString("https://stock.xueqiu.com/v5/stock/chart/kline.json?symbol=%1&begin=%2&period=%4&type=before&count=-%3&indicator=kline,macd").arg(symbol).arg(begin).arg(numsCnt).arg(m_dateType); + qDebug()<<urlStr; + //qDebug()<<"褰撳墠鑲$エ:"<<symbol<<m_customModel->data(m_customModel->index(curRow,0)).toString(); + // 涓嬩竴姝ュ氨鏄牴鎹畊rl璇锋眰鍒扮殑鏁版嵁锛岃繘琛屽垎鏋� + m_menuIndex = 4; // 绗簲涓彍鍗曢」 + m_request.setUrl(QUrl(urlStr)); + m_manager.get(m_request); +} + +void AnalysisByRedisCache::oneUpCrossFourSlot(QString symbol) +{ + /* 涓�闃崇┛鍥涚嚎 + K绾垮嚭鐜颁簡澶ч槼绾垮苟涓旇疮绌�4鏉″潎绾匡紝璇存槑鍦ㄧ寷娑ㄤ簡锛屽苟涓旈噺鑳戒篃璺熶笂鐨勮瘽锛屽氨璇存槑寮哄姴 + + 鏃銆佸懆K銆佹湀K灏卞緢鏄庢樉銆� + 澶ц秼鍔夸互鍛ㄣ�佹湀涓轰富锛岄�傚悎涓暱绾垮鐞� + --------------------------- + 涔熼潪甯搁�傚悎瓒呯煭绾跨殑澶勭悊锛�30鍒嗐��60鍒嗐��120鍒嗙殑澶х┛闃崇嚎涔熷緢鏄庢樉 + --------------------------- + 灏辨槸寮�鐩樹环鍜屾敹鐩樹环鍖呭惈浜嗕竴涓尯闂达紝杩欎釜鍖洪棿鍐呴兘鎶奙a5 Ma10 Ma20 Ma30缁欏寘浣忎簡锛岃鏄庤Е鍙戜簡涓�闃崇┛鍥涚嚎 + */ + qDebug()<<"涓�闃崇┛鍥涚嚎绛栫暐"; + //emit sendInfoMess("<font size=12 color=pink>鎵ц涓�闃崇┛鍥涚嚎绛栫暐 </font>"); + int curRow = ui->tableView->currentIndex().row(); +// QString symbol = m_model->item(curRow,1)->text(); + + //QString symbol = m_customModel->data(m_customModel->index(curRow,1)).toString(); + qint64 begin = QDateTime::currentMSecsSinceEpoch(); // 鍙栧綋鍓嶆椂闂存埑 + int numsCnt = 200; + QString urlStr = QString("https://stock.xueqiu.com/v5/stock/chart/kline.json?symbol=%1&begin=%2&period=%4&type=before&count=-%3&indicator=kline,macd,ma,boll,market_capital").arg(symbol).arg(begin).arg(numsCnt).arg(m_dateType); + qDebug()<<urlStr; + //qDebug()<<"褰撳墠鑲$エ:"<<symbol<<m_customModel->data(m_customModel->index(curRow,0)).toString(); + // 涓嬩竴姝ュ氨鏄牴鎹畊rl璇锋眰鍒扮殑鏁版嵁锛岃繘琛屽垎鏋� + m_menuIndex = 6; // 绗竷涓彍鍗曢」 + m_request.setUrl(QUrl(urlStr)); + m_manager.get(m_request); + +} + +void AnalysisByRedisCache::updateAllFindTimeSlot() +{ + qDebug()<<"瑙﹀彂浜嗘洿鏂扮瓥鐣ユ椂闂存搷浣�"; + for(auto kv:m_codes.keys()){ + qDebug()<<"code:"<<kv<<m_codes[kv]; + //buttomToUpPolicySlot(kv); + oneUpCrossFourSlot(kv); + } +} + +// 鍗曚釜鑲$エ鐨� JSON鏍煎紡澶勭悊 +void AnalysisByRedisCache::getStockOne(QByteArray &buffer) +{ + QJsonDocument jd = QJsonDocument::fromJson(buffer); + if(jd.isObject()){ + QJsonObject jObject = jd.object(); + QJsonArray jArr = jObject.value("data").toObject().value("item").toArray(); // 閫氳繃閿�煎鍙栧�� + int cnt = jArr.count(); + qDebug()<<"鏁扮粍size:"<<cnt; + QString symbol = jObject.value("data").toObject().value("symbol").toString(); + QString code = symbol; // 鑲$エ浠e彿 +// QLineSeries *series = new QLineSeries; // QLineSeries 鎶樼嚎鐨勭被锛孮SplineSeries 涓哄渾婊戞洸绾跨被 +// series->setName(symbol); // 璁剧疆鎶樼嚎鍚嶅瓧 +// //series->setColor(QColor(255,0,0)); // 璁剧疆棰滆壊 r,g,b 绾㈢豢钃濅笁鍘熻壊锛岄殢鎰忕粍鍚� +// QSplineSeries *sp = new QSplineSeries; +// sp->setName(symbol); +// QSplineSeries *spVolume = new QSplineSeries; +// spVolume->setName(symbol.append("--volume")); +// QSplineSeries *spAmount = new QSplineSeries; +// spVolume->setName(symbol.append("--amount")); + + int ma10_20_flag = 0; // 鏍囪MA閲戝弶銆佹鍙夌殑鎯呭喌 0:鍒濆鍊硷紝1锛氶噾鍙夛紝-1锛氭鍙� + long long oldVolume = 0; // MACD: 鑰佺殑鎴愪氦閲� + int macd_buy = 0; // 涔板叆鏍囧織 + double buy_price = 0; // 涔板叆浠锋牸 + double rate_all = 0; // 鏀剁泭鐧惧垎姣� + for(int i=0;i<cnt;++i){ + qint64 timestamp = jArr.at(i).toArray().at(0).toVariant().toLongLong(); + double close = jArr.at(i).toArray().at(5).toVariant().toDouble(); + long long volume = jArr.at(i).toArray().at(1).toVariant().toLongLong()/100; + + long long amount = jArr.at(i).toArray().at(9).toVariant().toLongLong()/100000000; + QString curDateTime = QDateTime::fromMSecsSinceEpoch(timestamp).toString("yyyy-MM-dd"); + //qDebug()<<curDateTime<<close<<volume<<amount; +// series->append(timestamp,close); // 鎶樼嚎鏁版嵁娣诲姞 +// sp->append(timestamp,close); // 鏇茬嚎鏁版嵁娣诲姞 +// spVolume->append(timestamp,volume); +// spAmount->append(timestamp,amount); + if(m_menuIndex == 2){ + // MA ma10浜a20 閲戝弶锛宮a10浜a60 姝诲弶 + double ma5 = jArr.at(i).toArray().at(12).toVariant().toDouble(); + double ma10 = jArr.at(i).toArray().at(13).toVariant().toDouble(); + double ma20 = jArr.at(i).toArray().at(14).toVariant().toDouble(); + double ma30 = jArr.at(i).toArray().at(15).toVariant().toDouble(); + //qDebug()<<"MA5-10-20-30"<<ma5<<ma10<<ma20<<ma30; + if(i>0){ + double ma5_old = jArr.at(i-1).toArray().at(12).toVariant().toDouble(); + double ma10_old = jArr.at(i-1).toArray().at(13).toVariant().toDouble(); + double ma20_old = jArr.at(i-1).toArray().at(14).toVariant().toDouble(); + double ma30_old = jArr.at(i-1).toArray().at(15).toVariant().toDouble(); + +// if(ma5_old > ma20_old && ma5 <= ma20){ +// // 姝诲弶 +// qDebug()<<"MA5-20姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close; +// }else if(ma5_old < ma20_old && ma5 >= ma20){ +// // 閲戝弶 +// qDebug()<<"MA5-20閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close; +// } + + if(ma10_old > ma20_old && ma10 <= ma20){ + // 姝诲弶 + qDebug()<<"MA10-20姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close; + if(buy_price == 0) buy_price = close; + double tmp_rate = (close-buy_price)/buy_price; + rate_all += tmp_rate; + +// QString info = QString("<font size=8 color=green> %3 %6 MA10-20姝诲弶:%1 浠锋牸:%2 鐩堝埄姣�:%4 鎬荤泩鍒�:%5</font>").arg(curDateTime).arg(close).arg(code) +// .arg(QString::number(tmp_rate*100)).arg(QString::number(rate_all*100)).arg(m_codeNames[code]); +// emit sendInfoMess(info); + //buy_price = close; // 姝诲弶涔板叆鐨勬儏鍐� + }else if(ma10_old < ma20_old && ma10 >= ma20){ + // 閲戝弶 + buy_price = close; // 閲戝弶涔板叆鐨勬儏鍐� + + qDebug()<<"MA10-20閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close; +// if(buy_price == 0) buy_price = close; +// double tmp_rate = (close-buy_price)/buy_price; +// rate_all += tmp_rate; +// QString info = QString("<font size=8 color=red> %3 %4 MA10-20閲戝弶:%1 浠锋牸:%2 </font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]); + //.arg(QString::number(tmp_rate*100)).arg(QString::number(rate_all*100)); + //emit sendInfoMess(info); + + } + } + }else if(m_menuIndex == 3){ + // MACD绛栫暐 缁撳悎鎴愪氦閲忔潵鍒ゆ柇浼氭洿濂�:涔板叆鐐规垚浜ら噺缁х画鏀惧ぇ鍒欐寔鏈夛紝缂╁皬鍒欑鍦� + double dea = jArr.at(i).toArray().at(12).toVariant().toDouble(); + double dif = jArr.at(i).toArray().at(13).toVariant().toDouble(); + double macd = jArr.at(i).toArray().at(14).toVariant().toDouble(); + + if(macd_buy == 1 && oldVolume > volume){ + QString info = QString("<font size=8 color=green> %4 MACD 鎴愪氦閲忓垵娆¤椤� 绂诲満1:%1 浠锋牸:%2 MACD=%3 </font>").arg(curDateTime).arg(close).arg(macd).arg(code); + //emit sendInfoMess(info); + macd_buy = 0; + oldVolume = 0; + + } + if(i > 0){ + double dea_old = jArr.at(i-1).toArray().at(12).toVariant().toDouble(); + double dif_old = jArr.at(i-1).toArray().at(13).toVariant().toDouble(); + double macd_old = jArr.at(i-1).toArray().at(14).toVariant().toDouble(); + + if(dif_old > dea_old && dif <= dea){ + // 姝诲弶 + qDebug()<<"MACD姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close <<"MACD="<<macd ; + QString info=QString("<font size=8 color=green> %4 MACD姝诲弶:%1 浠锋牸:%2 MACD=%3 </font>").arg(curDateTime).arg(close).arg(macd).arg(code); + //emit sendInfoMess(info); + }else if(dif_old < dea_old && dif >= dea){ + // 閲戝弶 + qDebug()<<"MACD閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close <<"MACD="<<macd <<"寤鸿璁板綍褰撳墠閲戝弶MACD鐨勫�硷紝鑻ュ悗闈㈡湁浣庝簬姝ゅ�硷紝鍏虫敞绂诲満鎻愮ず"; + QString info=QString("<font size=9 color=red> %4 MACD閲戝弶:%1 浠锋牸:%2 MACD=%3 寤鸿璁板綍褰撳墠閲戝弶MACD鐨勫�硷紝鑻ュ悗闈㈡湁浣庝簬姝ゅ�硷紝鍏虫敞绂诲満鎻愮ず </font>").arg(curDateTime).arg(close).arg(macd).arg(code); + //emit sendInfoMess(info); + + macd_buy = 1; + oldVolume = volume; + } + } + }else if(m_menuIndex == 4 || m_menuIndex == 6){ + // 搴曢儴鍙嶈浆绛栫暐,鎻愬墠鐨勬劅鐭ョ殑鏃堕棿浼氭洿鏃╋紝寰楀埌鏇村ソ鐨勯鍒よ秼鍔� + // qDebug()<<"搴曢儴鍙嶈浆绛栫暐"; + if(i > 0){ + { + double volume_cur = jArr.at(i).toArray().at(1).toDouble(); + double volume_old = jArr.at(i-1).toArray().at(1).toDouble(); + double volume_rate = volume_cur / volume_old; + if(volume_rate > 2){ + qDebug()<<"搴曢儴鍙嶈浆绛栫暐:閲忚兘姣�"<<volume_rate<<code <<curDateTime<<"浠锋牸:" <<close; + QString info = QString("<font size=8 color=red> %4 搴曢儴鍙嶈浆绛栫暐:閲忚兘 鏃堕棿:%1 浠锋牸:%2 閲忚兘姣斿��=%3 </font>").arg(curDateTime).arg(close).arg(volume_rate).arg(code); + //emit sendInfoMess(info); + + //淇敼鍙戠幇鐨勬渶鏂版椂闂� + updateFindTime(m_codes[code],curDateTime,7); // 涓嬫爣涓�7 + } + } + + + { + // 涓�闃崇┛鍥涚嚎 + + double ma5 = jArr.at(i).toArray().at(12).toVariant().toDouble(); + double ma10 = jArr.at(i).toArray().at(13).toVariant().toDouble(); + double ma20 = jArr.at(i).toArray().at(14).toVariant().toDouble(); + double ma30 = jArr.at(i).toArray().at(15).toVariant().toDouble(); + + double open = jArr.at(i).toArray().at(2).toVariant().toDouble(); + long long market_cap = jArr.at(i).toArray().at(22).toVariant().toLongLong(); + + double volume_rate = 0; + if(i > 0){ // 璁$畻閲忚兘姣� + double volume_cur = jArr.at(i).toArray().at(1).toDouble(); + double volume_old = jArr.at(i-1).toArray().at(1).toDouble(); + volume_rate = volume_cur / volume_old; + } + + if(ma5 >= open && ma10 >= open && ma20 >= open && ma30 >= open + && ma5 <= close && ma10 <= close && ma20 <= close && ma30 <= close){ + qDebug()<<"涓�闃崇┛鍥涚嚎:"<< code <<curDateTime<<" 浠锋牸:"<<close << "閲忚兘姣�:"<<volume_rate; + if(volume_rate > 4){ + // QString info = QString("<font size=8 color=blue> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) + // .arg(m_dateType).arg(market_cap/100000000.0); + //emit sendInfoMess(info); + }else{ + // QString info = QString("<font size=8 color=red> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) + // .arg(m_dateType).arg(market_cap/100000000.0); + //emit sendInfoMess(info); + } + + //淇敼鍙戠幇鐨勬渶鏂版椂闂� + updateFindTime(m_codes[code],curDateTime,8); // 涓嬫爣涓�8 + + } + } + } + + }else if(m_menuIndex == 5){ + // 澶氱瓥鐣ュ叡鎸�:閲忚兘銆丮ACD銆丮A銆丅OLL + + int cnt = 0; + // 閲忚兘 + if(i > 0){ + double volume_cur = jArr.at(i).toArray().at(1).toDouble(); + double volume_old = jArr.at(i-1).toArray().at(1).toDouble(); + double volume_rate = volume_cur / volume_old; + if(volume_rate > 2){ + cnt++; + qDebug()<<"澶氱瓥鐣ュ叡鎸�:閲忚兘姣�"<<volume_rate<<code <<curDateTime<<"浠锋牸:" <<close; + QString info = QString("<font size=8 color=red> %4 澶氱瓥鐣ュ叡鎸�:閲忚兘绛栫暐 鏃堕棿:%1 浠锋牸:%2 閲忚兘姣斿��=%3 鍏辨尟鍊�:%5</font>").arg(curDateTime).arg(close).arg(volume_rate).arg(code).arg(cnt); + //emit sendInfoMess(info); + } + } + + // MACD绛栫暐 缁撳悎鎴愪氦閲忔潵鍒ゆ柇浼氭洿濂�:涔板叆鐐规垚浜ら噺缁х画鏀惧ぇ鍒欐寔鏈夛紝缂╁皬鍒欑鍦� + double dea = jArr.at(i).toArray().at(16).toVariant().toDouble(); + double dif = jArr.at(i).toArray().at(17).toVariant().toDouble(); + double macd = jArr.at(i).toArray().at(18).toVariant().toDouble(); + + if(macd_buy == 1 && oldVolume > volume){ + QString info = QString("<font size=8 color=green> %4 MACD 鎴愪氦閲忓垵娆¤椤� 绂诲満1:%1 浠锋牸:%2 MACD=%3 </font>").arg(curDateTime).arg(close).arg(macd).arg(code); + //emit sendInfoMess(info); + macd_buy = 0; + oldVolume = 0; + + } + if(i > 0){ + double dea_old = jArr.at(i-1).toArray().at(16).toVariant().toDouble(); + double dif_old = jArr.at(i-1).toArray().at(17).toVariant().toDouble(); + double macd_old = jArr.at(i-1).toArray().at(18).toVariant().toDouble(); + + if(dif_old > dea_old && dif <= dea){ + // 姝诲弶 + qDebug()<<"MACD姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close <<"MACD="<<macd ; + QString info=QString("<font size=8 color=green> %4 MACD姝诲弶:%1 浠锋牸:%2 MACD=%3 </font>").arg(curDateTime).arg(close).arg(macd).arg(code); + //emit sendInfoMess(info); + }else if(dif_old < dea_old && dif >= dea){ + // 閲戝弶 + cnt++; + qDebug()<<"MACD閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close <<"MACD="<<macd <<"寤鸿璁板綍褰撳墠閲戝弶MACD鐨勫�硷紝鑻ュ悗闈㈡湁浣庝簬姝ゅ�硷紝鍏虫敞绂诲満鎻愮ず"; + QString info=QString("<font size=9 color=red> %4 MACD閲戝弶:%1 浠锋牸:%2 MACD=%3 鍏辨尟鍊�:%5 </font>").arg(curDateTime).arg(close).arg(macd).arg(code).arg(cnt); + //emit sendInfoMess(info); + + macd_buy = 1; + oldVolume = volume; + } + } + + + // MA ma10浜a20 閲戝弶锛宮a10浜a60 姝诲弶 + double ma5 = jArr.at(i).toArray().at(12).toVariant().toDouble(); + double ma10 = jArr.at(i).toArray().at(13).toVariant().toDouble(); + double ma20 = jArr.at(i).toArray().at(14).toVariant().toDouble(); + double ma30 = jArr.at(i).toArray().at(15).toVariant().toDouble(); + //qDebug()<<"MA5-10-20-30"<<ma5<<ma10<<ma20<<ma30; + if(i>0){ + double ma5_old = jArr.at(i-1).toArray().at(12).toVariant().toDouble(); + double ma10_old = jArr.at(i-1).toArray().at(13).toVariant().toDouble(); + double ma20_old = jArr.at(i-1).toArray().at(14).toVariant().toDouble(); + double ma30_old = jArr.at(i-1).toArray().at(15).toVariant().toDouble(); + +// if(ma5_old > ma20_old && ma5 <= ma20){ +// // 姝诲弶 +// qDebug()<<"MA5-20姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close; +// }else if(ma5_old < ma20_old && ma5 >= ma20){ +// // 閲戝弶 +// qDebug()<<"MA5-20閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close; +// } + + if(ma10_old > ma20_old && ma10 <= ma20){ + // 姝诲弶 + qDebug()<<"MA10-20姝诲弶:"<<curDateTime<<" 浠锋牸:"<<close; + if(buy_price == 0) buy_price = close; + double tmp_rate = (close-buy_price)/buy_price; + rate_all += tmp_rate; + +// QString info = QString("<font size=8 color=green> %3 %6 MA10-20姝诲弶:%1 浠锋牸:%2 鐩堝埄姣�:%4 鎬荤泩鍒�:%5</font>").arg(curDateTime).arg(close).arg(code) +// .arg(QString::number(tmp_rate*100)).arg(QString::number(rate_all*100)).arg(m_codeNames[code]); + //emit sendInfoMess(info); + //buy_price = close; // 姝诲弶涔板叆鐨勬儏鍐� + }else if(ma10_old < ma20_old && ma10 >= ma20){ + // 閲戝弶 + cnt++; + buy_price = close; // 閲戝弶涔板叆鐨勬儏鍐� + + qDebug()<<"MA10-20閲戝弶:"<<curDateTime<<" 浠锋牸:"<<close; +// QString info = QString("<font size=8 color=red> %3 %4 MA10-20閲戝弶:%1 浠锋牸:%2 鍏辨尟鍊�:%5 </font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(cnt); + //.arg(QString::number(tmp_rate*100)).arg(QString::number(rate_all*100)); + //emit sendInfoMess(info); + + } + } + + }else if(m_menuIndex == 6){ + // 涓�闃崇┛鍥涚嚎 + + double ma5 = jArr.at(i).toArray().at(12).toVariant().toDouble(); + double ma10 = jArr.at(i).toArray().at(13).toVariant().toDouble(); + double ma20 = jArr.at(i).toArray().at(14).toVariant().toDouble(); + double ma30 = jArr.at(i).toArray().at(15).toVariant().toDouble(); + + double open = jArr.at(i).toArray().at(2).toVariant().toDouble(); + long long market_cap = jArr.at(i).toArray().at(22).toVariant().toLongLong(); + + double volume_rate = 0; + if(i > 0){ // 璁$畻閲忚兘姣� + double volume_cur = jArr.at(i).toArray().at(1).toDouble(); + double volume_old = jArr.at(i-1).toArray().at(1).toDouble(); + volume_rate = volume_cur / volume_old; + } + + if(ma5 >= open && ma10 >= open && ma20 >= open && ma30 >= open + && ma5 <= close && ma10 <= close && ma20 <= close && ma30 <= close){ + qDebug()<<"涓�闃崇┛鍥涚嚎:"<< code <<curDateTime<<" 浠锋牸:"<<close << "閲忚兘姣�:"<<volume_rate; + if(volume_rate > 4){ +// QString info = QString("<font size=8 color=blue> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) +// .arg(m_dateType).arg(market_cap/100000000.0); + //emit sendInfoMess(info); + }else{ +// QString info = QString("<font size=8 color=red> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) +// .arg(m_dateType).arg(market_cap/100000000.0); + //emit sendInfoMess(info); + } + + } + } + + + } + if(m_menuIndex == 0){ + // 绛栫暐鍒嗘瀽 鍙兘閫変竴绉嶇嚎褰㈡暟鎹� + //emit sendChartData(series); // 鍙戦�佹姌绾挎暟鎹� +// emit sendChartData(sp); // 鍙戦�佹洸绾挎暟鎹� 鏀剁洏浠� +// emit sendChartData(spVolume); // 鍙戦�佷氦鏄撻噺鏇茬嚎 +// emit sendChartData(spAmount); // 浜ゆ槗棰濇洸绾� + }else if(m_menuIndex == 1){ + // 鏈�鏂颁环鏍� + }else if(m_menuIndex == 2){ + // MA绛栫暐 + }else if(m_menuIndex == 3){ + // MACD绛栫暐 + } + } +} + +void AnalysisByRedisCache::updateFindTime(QString name, QString trade_time, int index) +{ + for(int i=0;i<m_modelResult->rowCount();++i){ + if(m_modelResult->item(i,0)->text() == name){ // 鍖归厤鍒板悕瀛� + m_modelResult->setItem(i,index,new QStandardItem(trade_time)); // 鏇存柊鏃堕棿 + } + } +} + void AnalysisByRedisCache::searchAndAnalysisData(QString name) { QElapsedTimer timer; @@ -106,6 +583,7 @@ qDebug()<<"m_result size:"<<m_result.size()<<name; int rank_val = 0; + double amount_old = 0; int cnt = 0; int bigFlag = false; int bigRankUp = false; // 绐佺劧浠庡緢浣庣殑鎺掑悕涓婂崌鍒板ぇ鎺掑悕 @@ -180,6 +658,18 @@ rank_val = amount_rank.toInt(); } + double amount = it["amount"].toDouble(); + QStandardItem *amountItem = new QStandardItem(QString::number(amount/100000000)); + if(amount_old > 0){ + if(amount / amount_old >= 3){ + amountItem->setData(QColor("red"),Qt::BackgroundColorRole); + amountItem->setData(QString::number(amount / amount_old),Qt::ToolTipRole); + } + } + items.append(amountItem); + amount_old = amount; + + m_model->appendRow(items); if(bigFlag){ QList<QStandardItem*> items_2; @@ -201,6 +691,8 @@ items_2.back()->setData(QColor(85,255,255),Qt::BackgroundColorRole); } + }else if(i==7){ + // 鐪嬩氦鏄撻鍙樺寲 } } m_modelResult->appendRow(items_2); @@ -208,6 +700,9 @@ bigRankUp = false; big_3000 = false; big_2000 = false; + + // 淇濆瓨鍚嶅瓧淇℃伅:code-name + m_codes.insert(it["code"].toString(),name); } } @@ -216,6 +711,9 @@ qDebug() << "Query executed in" << timer.elapsed() << "ms"; qDebug()<<"婊戝姩绐楀彛鎺掑悕-cnt:"<<m_model->rowCount()<<cnt<<"start:"<<m_model->rowCount() - cnt + 1; calcWindowRank(m_model->rowCount() - cnt + 1); + + // 鏇存柊鏃堕棿 + } void AnalysisByRedisCache::on_pushButton_analysisByRedis_clicked() { @@ -236,5 +734,12 @@ int batch_num = ui->comboBox_batchNum->currentText().toInt(); // 鎵归噺鍒嗘瀽涓偂鐨勬暟閲� // 鎷垮嚭涓偂浜ゆ槗棰濇帓鍚嶇殑鍓峃鍚嶏紝杩涜缂撳瓨鍒嗘瀽 emit getStockNamesSignal(batch_num); + qDebug()<<"鎵归噺鍒嗘瀽瀹屾垚"; } + +void AnalysisByRedisCache::on_pushButton_updateStrategyTime_clicked() +{ + // 鏇存柊绛栫暐鐨勬椂闂� + updateAllFindTimeSlot(); +} diff --git a/analysisbyrediscache.h b/analysisbyrediscache.h index 82a4499..93d093a 100644 --- a/analysisbyrediscache.h +++ b/analysisbyrediscache.h @@ -3,7 +3,10 @@ #include <QMainWindow> #include "dbcache.h" +#include <QNetworkAccessManager> +#include <QNetworkRequest> #include <QStandardItemModel> +#include <QNetworkCookie> namespace Ui { class AnalysisByRedisCache; @@ -20,6 +23,15 @@ void calcWindowRank(int start); // 婊戝姩绐楀彛璁$畻鍙樺寲鎯呭喌 + + void loadHttpInit(QUrl url); // 鍔犺浇http鏁版嵁鐨勫垵濮嬪寲 + void getStockOne(QByteArray &buffer); + void updateFindTime(QString name,QString trade_time,int index); // 鍒锋柊鏈�鏂扮殑绛栫暐瑙﹀彂鏃堕棿 + + + void buttomToUpPolicySlot(QString symbol); // 搴曢儴鍙嶈浆 + + void oneUpCrossFourSlot(QString symbol); signals: void getStockNamesSignal(int); // 鑾峰彇鑲$エ鍓峃鍚嶇殑淇″彿 @@ -32,6 +44,12 @@ void searchAndAnalysisData(QString name); //鏌ユ壘缂撳瓨鐨勬暟鎹苟鍒嗘瀽 + void showAplyData(QNetworkReply *reply); // 澶勭悊http 鐖櫕鍝嶅簲鐨勬Ы + + void updateAllFindTimeSlot(); // 鏇存柊鎵�鏈夎緝绐佸嚭鐨勭瓥鐣ユ椂闂� + + void on_pushButton_updateStrategyTime_clicked(); + private: Ui::AnalysisByRedisCache *ui; @@ -39,8 +57,16 @@ QStandardItemModel *m_model; QStandardItemModel *m_modelResult; // 淇濆瓨鍒嗘瀽绐佸嚭缁撴灉 + QHash<QString,QString> m_codes; // 瀛樿偂绁ㄤ唬鍙峰拰鍚嶅瓧 QVector<QHash<QString, QVariant>> m_result; + + QNetworkRequest m_request; // 鐢ㄤ簬绠$悊璇锋眰澶寸殑 + QString m_cookie; // 缂撳瓨 + QNetworkAccessManager m_manager; // 鐢ㄤ簬绠$悊http璇锋眰鍙婂搷搴旂殑 + + int m_menuIndex = 0; // 鏆傛椂缁欎竴涓�0鍒濆鍖� + QString m_dateType = "week"; // 鏆傛椂鍒濆鍖栦负 week }; #endif // ANALYSISBYREDISCACHE_H diff --git a/analysisbyrediscache.ui b/analysisbyrediscache.ui index fad3a2b..6902524 100644 --- a/analysisbyrediscache.ui +++ b/analysisbyrediscache.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>800</width> - <height>600</height> + <width>910</width> + <height>623</height> </rect> </property> <property name="windowTitle"> @@ -82,6 +82,23 @@ </widget> </item> <item> + <widget class="QDateEdit" name="dateEdit_end"> + <property name="dateTime"> + <datetime> + <hour>0</hour> + <minute>0</minute> + <second>0</second> + <year>2025</year> + <month>1</month> + <day>1</day> + </datetime> + </property> + <property name="calendarPopup"> + <bool>true</bool> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="label_load"> <property name="text"> <string>缂撳瓨鏈姞杞�</string> @@ -149,6 +166,13 @@ </item> </widget> </item> + <item> + <widget class="QPushButton" name="pushButton_updateStrategyTime"> + <property name="text"> + <string>鍒风瓥鐣ユ椂闂�</string> + </property> + </widget> + </item> </layout> </item> <item row="1" column="0"> diff --git a/clientmainwindow.cpp b/clientmainwindow.cpp index 330c941..fe4a9cb 100644 --- a/clientmainwindow.cpp +++ b/clientmainwindow.cpp @@ -54,6 +54,9 @@ m_analysisByRedisCache = new AnalysisByRedisCache(this); ui->tabWidget->addTab(m_analysisByRedisCache,"缂撳瓨鍒嗘瀽"); // 閫氳繃redis涓殑缂撳瓨鏉ュ垎鏋愪釜鑲� + m_positionMan = new PositionManagement(this); + ui->tabWidget->addTab(m_positionMan,"浠撲綅绠$悊"); + // 鍏宠仈涓�涓�2涓晫闈㈢殑淇″彿鍜屾Ы锛岀敤鏉ヤ紶閫掑浘琛ㄦ墍闇�鐨勬暟鎹強灞曠ず connect(m_getStockList,SIGNAL(sendChartData(QLineSeries*)),m_stockPolicy,SLOT(showNewStockData(QLineSeries*))); @@ -73,5 +76,5 @@ connect(m_analysisByRedisCache,SIGNAL(getStockNamesSignal(int)),m_getStockList,SLOT(getStockNamesByNum(int)),Qt::QueuedConnection); connect(m_getStockList,SIGNAL(sendNameToAnalysis(QString)),m_analysisByRedisCache,SLOT(searchAndAnalysisData(QString)),Qt::QueuedConnection); - + connect(m_getStockList,SIGNAL(sendUpdateFindTime()),m_analysisByRedisCache,SLOT(updateAllFindTimeSlot())); } diff --git a/clientmainwindow.h b/clientmainwindow.h index 9bf70ad..7a677f9 100644 --- a/clientmainwindow.h +++ b/clientmainwindow.h @@ -12,6 +12,7 @@ #include "agilestrategy.h" // 鐏靛姩绛栫暐 #include "separateanalysis.h" #include "analysisbyrediscache.h" +#include "positionmanagement.h" namespace Ui { @@ -40,6 +41,8 @@ AgileStrategy *m_agileStrategy; // 鐏靛姩绛栫暐 SeparateAnalysis *m_separateAnalysis; // 涓偂鍒嗘瀽 鍗曠嫭鍒嗘瀽 AnalysisByRedisCache *m_analysisByRedisCache; // 涓偂鍒嗘瀽 閫氳繃缂撳瓨鍒嗘瀽 + PositionManagement *m_positionMan; // 浠撲綅绠$悊 + }; diff --git a/customitem.h b/customitem.h index 16c876b..1e0fe4e 100644 --- a/customitem.h +++ b/customitem.h @@ -3,7 +3,7 @@ #include <QStandardItemModel> #include <QDebug> - +#include <QItemDelegate> class CustomItem : public QStandardItem { diff --git a/getstocklist.cpp b/getstocklist.cpp index 2bb6f5e..9797849 100644 --- a/getstocklist.cpp +++ b/getstocklist.cpp @@ -1081,4 +1081,8 @@ // emit sendNameToAnalysis(m_model->item(i,0)->text()); // 鍙戝悕瀛楃粰缂撳瓨鍒嗘瀽鐣岄潰鏉ヤ緷娆″垎鏋� emit sendNameToAnalysis(m_customModel->data(m_customModel->index(i,0)).toString()); } + + // 鍒嗘瀽瀹屼簡锛屽啀鍒锋柊鏃堕棿 + //emit sendUpdateFindTime(); // 鍓嶉潰鏄槦鍒�-寮傛鐨勬柟寮� + } diff --git a/getstocklist.h b/getstocklist.h index b0d9581..9388bba 100644 --- a/getstocklist.h +++ b/getstocklist.h @@ -47,6 +47,7 @@ void sendClosePrice(QString,QString); // 鍙戦�佹渶鏂扮殑浠锋牸锛氬悕瀛椼�佷环鏍� void sendCodeNames(QMap<QString, QString> &); // 缁欏巻鍙插垎鏋愮晫闈㈠彂閫佸悕瀛椾唬鍙蜂俊鎭� void sendNameToAnalysis(QString); // 鍙戦�佸悕瀛楃粰缂撳瓨鍒嗘瀽鐣岄潰锛屼竴涓竴涓彂锛屽幓瑙﹀彂 + void sendUpdateFindTime(); // 鍒嗘瀽瀹屾垚浜嗭紝鏇存柊绛栫暐鏈�鍚庣殑鏃堕棿 private slots: void on_pushButton_get_clicked(); diff --git a/positionmanagement.cpp b/positionmanagement.cpp new file mode 100644 index 0000000..3b76da8 --- /dev/null +++ b/positionmanagement.cpp @@ -0,0 +1,32 @@ +锘�#include "positionmanagement.h" +#include "ui_positionmanagement.h" + +PositionManagement::PositionManagement(QWidget *parent): + QMainWindow(parent), + ui(new Ui::PositionManagement) +{ + ui->setupUi(this); + + m_modelAll = new QStandardItemModel(this); + m_modelShort = new QStandardItemModel(this); + m_modelMid = new QStandardItemModel(this); + m_modelLong = new QStandardItemModel(this); + + QStringList labels; + labels<<"id"<<"鑲$エ"<<"code"<<"鍏ユ睜鏃堕棿"<<"鍏ユ睜浠锋牸"<<"璐拱鏃堕棿"<<"璐拱浠锋牸"<<"鍏ユ睜鏀剁泭"<<"璐拱鏀剁泭"<<"绫诲瀷"; + + m_modelAll->setHorizontalHeaderLabels(labels); + m_modelShort->setHorizontalHeaderLabels(labels); + m_modelMid->setHorizontalHeaderLabels(labels); + m_modelLong->setHorizontalHeaderLabels(labels); + + ui->tableView_all->setModel(m_modelAll); + ui->tableView_short->setModel(m_modelShort); + ui->tableView_mid->setModel(m_modelMid); + ui->tableView_long->setModel(m_modelLong); +} + +PositionManagement::~PositionManagement() +{ + delete ui; +} diff --git a/positionmanagement.h b/positionmanagement.h new file mode 100644 index 0000000..c9142f1 --- /dev/null +++ b/positionmanagement.h @@ -0,0 +1,27 @@ +锘�#ifndef POSITIONMANAGEMENT_H +#define POSITIONMANAGEMENT_H + +#include <QMainWindow> +#include <QStandardItemModel> + +namespace Ui { +class PositionManagement; +} + +class PositionManagement : public QMainWindow +{ + Q_OBJECT + +public: + explicit PositionManagement(QWidget *parent = 0); + ~PositionManagement(); + +private: + Ui::PositionManagement *ui; + QStandardItemModel *m_modelAll; + QStandardItemModel *m_modelShort; + QStandardItemModel *m_modelMid; + QStandardItemModel *m_modelLong; +}; + +#endif // POSITIONMANAGEMENT_H diff --git a/positionmanagement.ui b/positionmanagement.ui new file mode 100644 index 0000000..e8f125d --- /dev/null +++ b/positionmanagement.ui @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PositionManagement</class> + <widget class="QMainWindow" name="PositionManagement"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>840</width> + <height>625</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>鎵�鏈変粨浣嶆睜</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTableView" name="tableView_all"/> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>鐭嚎浠撲綅姹�</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QTableView" name="tableView_short"/> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>涓嚎浠撲綅姹�</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QTableView" name="tableView_mid"/> + </item> + </layout> + </widget> + </item> + <item row="1" column="1"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>闀跨嚎浠撲綅姹�</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QTableView" name="tableView_long"/> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="pushButton_add"> + <property name="text"> + <string>娣诲姞鑲$エ</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>840</width> + <height>26</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar"/> + </widget> + <resources/> + <connections/> +</ui> diff --git a/stock_plan.pro b/stock_plan.pro index 244e6e6..3084763 100644 --- a/stock_plan.pro +++ b/stock_plan.pro @@ -39,7 +39,8 @@ agilestrategy.cpp \ separateanalysis.cpp \ dbcache.cpp \ - analysisbyrediscache.cpp + analysisbyrediscache.cpp \ + positionmanagement.cpp HEADERS += \ clientmainwindow.h \ @@ -56,7 +57,8 @@ agilestrategy.h \ separateanalysis.h \ dbcache.h \ - analysisbyrediscache.h + analysisbyrediscache.h \ + positionmanagement.h FORMS += \ clientmainwindow.ui \ @@ -69,7 +71,8 @@ deepseekmainwindow.ui \ agilestrategy.ui \ separateanalysis.ui \ - analysisbyrediscache.ui + analysisbyrediscache.ui \ + positionmanagement.ui win32:CONFIG(release, debug|release): LIBS += -L$$PWD/hiredis-master/build/release/ -lhiredisd else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/hiredis-master/build/debug/ -lhiredisd -- Gitblit v1.8.0