parent
9aca214e77
commit
0218865835
@ -0,0 +1,39 @@
|
|||||||
|
#include "xhighstockindexs.h"
|
||||||
|
|
||||||
|
XHighStockIndexs::XHighStockIndexs(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XHighStockIndexs::~XHighStockIndexs()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStockIndexs::toInsertSql(_HighStockIndexsParam stock)
|
||||||
|
{
|
||||||
|
QString sql = QString("insert into highstockindexs (code, name, tradeDay,open,close,differRange,isHighRangeP,hpDateP,LIMITUPNUM,mvByCSRC,COMPONENTNUM) "
|
||||||
|
"SELECT '%1', '%2', '%3',%4,%5,%6,%7,'%8',%9,%10,%11 from DUAL where not exists(select code from highstockindexs where code = '%1' and hpDateP = '%8');")
|
||||||
|
.arg(stock.code)
|
||||||
|
.arg(stock.name)
|
||||||
|
.arg(stock.tradeDay)
|
||||||
|
.arg(stock.open)
|
||||||
|
.arg(stock.close)
|
||||||
|
.arg(stock.differRange)
|
||||||
|
.arg(stock.isHighRangeP)
|
||||||
|
.arg(stock.HpDateP)
|
||||||
|
.arg(stock.LIMITUPNUM)
|
||||||
|
.arg(stock.mvByCSRC)
|
||||||
|
.arg(stock.COMPONENTNUM);
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStockIndexs::toDeleteSql()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStockIndexs::toQuerySql()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef NHIGHSTOCKINDEXS_H
|
||||||
|
#define NHIGHSTOCKINDEXS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "structs.h"
|
||||||
|
|
||||||
|
class XHighStockIndexs : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit XHighStockIndexs(QObject *parent = nullptr);
|
||||||
|
~XHighStockIndexs();
|
||||||
|
|
||||||
|
QString toInsertSql(_HighStockIndexsParam stock);
|
||||||
|
QString toDeleteSql();
|
||||||
|
QString toQuerySql();
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NHIGHSTOCKINDEXS_H
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
#include "xhighstocks.h"
|
||||||
|
|
||||||
|
XHighStocks::XHighStocks(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XHighStocks::~XHighStocks()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStocks::toInsertSql(_HighStocksParam stock)
|
||||||
|
{
|
||||||
|
QString sql = QString("insert into highstocks (code, name, tradeDay,open,close,high,differRange,volumn,BLEMIND2,hpDateP,isHighRangeP) "
|
||||||
|
"SELECT '%1', '%2', '%3',%4,%5,%6,%7,%8,'%9','%10',%11 from DUAL where not exists(select code from highstocks where code = '%1' and tradeDay = '%3' and open = %4);")
|
||||||
|
.arg(stock.code)
|
||||||
|
.arg(stock.name)
|
||||||
|
.arg(stock.tradeDay)
|
||||||
|
.arg(stock.open)
|
||||||
|
.arg(stock.close)
|
||||||
|
.arg(stock.high)
|
||||||
|
.arg(stock.differRange)
|
||||||
|
.arg(stock.volumn)
|
||||||
|
.arg(stock.BLEMIND2)
|
||||||
|
.arg(stock.HpDateP)
|
||||||
|
.arg(stock.isHighRangeP);
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStocks::toDeleteSql()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHighStocks::toQuerySql()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef NHIGHSTOCKS_H
|
||||||
|
#define NHIGHSTOCKS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "structs.h"
|
||||||
|
|
||||||
|
class XHighStocks : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit XHighStocks(QObject *parent = nullptr);
|
||||||
|
~XHighStocks();
|
||||||
|
|
||||||
|
QString toInsertSql(_HighStocksParam stock);
|
||||||
|
QString toDeleteSql();
|
||||||
|
QString toQuerySql();
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NHIGHSTOCKS_H
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
#include "exceldecoder.h"
|
||||||
|
|
||||||
|
ExcelDecoder::ExcelDecoder()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
#include "stocksdecoder.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
StocksDecoder::StocksDecoder()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void StocksDecoder::decode(QList<QList<QVariant> > edatas,QString date)
|
||||||
|
{
|
||||||
|
if(edatas.count() <= 1)
|
||||||
|
return;
|
||||||
|
QList<QVariant> headDatas = edatas.at(0);
|
||||||
|
data.clear();
|
||||||
|
QString tradeDay = parseStockHead(headDatas);
|
||||||
|
if(tradeDay.isEmpty())
|
||||||
|
tradeDay = date;
|
||||||
|
if(!tradeDay.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << " datas count :" << edatas.count();
|
||||||
|
for (int row = 1; row < edatas.count();row++)
|
||||||
|
{
|
||||||
|
QList<QVariant> rowData = edatas.at(row);
|
||||||
|
_stocksInfo param;
|
||||||
|
for(int column = 0; column < rowData.count() ; column++)
|
||||||
|
{
|
||||||
|
if(rowData.at(column).toString().isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "break";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
param.tradeDay = tradeDay;
|
||||||
|
toValueStockInfo(param,column,rowData.at(column).toString());
|
||||||
|
}
|
||||||
|
if(param.code.isEmpty() || param.name.isEmpty())
|
||||||
|
continue;
|
||||||
|
data.append(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StocksDecoder::parseStockHead(QList<QVariant> headDatas)
|
||||||
|
{
|
||||||
|
QString tradeDay = "";//暂时不查询交易日期
|
||||||
|
for(int i = 0; i < headDatas.count(); i++)
|
||||||
|
{
|
||||||
|
QVariant value = headDatas[i];
|
||||||
|
QString headValue = value.toString();
|
||||||
|
if(headValue.contains(QStringLiteral("证券代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"code");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("证券名称")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"name");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("开盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"open");
|
||||||
|
// if(headValue.contains(QStringLiteral("最新")))
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //开盘价[交易日期]最新(2021-05-20)[复权方式]前复权
|
||||||
|
// int dayStart = headValue.indexOf("(");
|
||||||
|
// int dayEnd = headValue.indexOf(")");
|
||||||
|
// tradeDay = headValue.mid(dayStart+1,dayEnd - dayStart-1);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("收盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"close");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨跌幅")) &&
|
||||||
|
!headValue.contains(QStringLiteral("前10个交易日")) &&
|
||||||
|
!headValue.contains(QStringLiteral("前20个交易日")) &&
|
||||||
|
!headValue.contains(QStringLiteral("前60个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("所属东财行业指数")) &&
|
||||||
|
headValue.contains(QStringLiteral("2级")) &&
|
||||||
|
!headValue.contains(QStringLiteral("所属东财行业指数代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"blemind2");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("所属东财行业")) &&
|
||||||
|
headValue.contains(QStringLiteral("3级")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"blemind3");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间涨跌幅")) &&
|
||||||
|
headValue.contains(QStringLiteral("前10")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange10");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间涨跌幅")) &&
|
||||||
|
headValue.contains(QStringLiteral("前20")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange20");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间涨跌幅")) &&
|
||||||
|
headValue.contains(QStringLiteral("前60")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange60");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("首发上市日期")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"listDate");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间可交易日数")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"tradeDays");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交量")) &&
|
||||||
|
!headValue.contains(QStringLiteral("区间日均成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"volumn");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交额")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"amount");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("自由流通市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"freeFloatMarketValue");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("总市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"totalMarketValue");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间日均成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"avgVolume20");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("机构持股比例合计")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"agenciesHold");
|
||||||
|
}
|
||||||
|
qDebug() << "parseWholeStockHead : " <<m_wholeStocksKeyIndexs[i];
|
||||||
|
}
|
||||||
|
return tradeDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StocksDecoder::toValueStockInfo(_stocksInfo ¶m ,int index,QString value)
|
||||||
|
{
|
||||||
|
if(m_wholeStocksKeyIndexs[index] == "code")
|
||||||
|
{
|
||||||
|
param.code = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "name")
|
||||||
|
{
|
||||||
|
param.name = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "open")
|
||||||
|
{
|
||||||
|
// param.open = value.toDouble();
|
||||||
|
param.open = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "close")
|
||||||
|
{
|
||||||
|
// param.close = value.toDouble();
|
||||||
|
param.close = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange")
|
||||||
|
{
|
||||||
|
// param.differRange = value.toDouble();
|
||||||
|
param.differRange = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "blemind2")
|
||||||
|
{
|
||||||
|
param.blemind2 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "blemind3")
|
||||||
|
{
|
||||||
|
param.blemind3 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange10")
|
||||||
|
{
|
||||||
|
// param.differRangeP20 = value.toDouble();
|
||||||
|
param.differRangeP10 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange20")
|
||||||
|
{
|
||||||
|
// param.differRangeP20 = value.toDouble();
|
||||||
|
param.differRangeP20 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange60")
|
||||||
|
{
|
||||||
|
// param.differRangeP60 = value.toDouble();
|
||||||
|
param.differRangeP60 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "listDate")
|
||||||
|
{
|
||||||
|
param.listDate = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "tradeDays")
|
||||||
|
{
|
||||||
|
// param.tradeDaysP = value.toInt();
|
||||||
|
param.tradeDays = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "volumn")
|
||||||
|
{
|
||||||
|
// param.volumn = value.toDouble();
|
||||||
|
param.volumn = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "amount")
|
||||||
|
{
|
||||||
|
// param.amount = value.toDouble();
|
||||||
|
param.amount = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "freeFloatMarketValue")
|
||||||
|
{
|
||||||
|
// param.freeFloatMv = value.toDouble();
|
||||||
|
param.freeFloatMarketValue = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "totalMarketValue")
|
||||||
|
{
|
||||||
|
// param.mvByCSRC = value.toDouble();
|
||||||
|
param.totalMarketValue = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "avgVolume20")
|
||||||
|
{
|
||||||
|
// param.avgVolumeP20 = value.toDouble();
|
||||||
|
param.avgVolume20 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "agenciesHold")
|
||||||
|
{
|
||||||
|
// param.avgVolumeP20 = value.toDouble();
|
||||||
|
param.agenciesHold = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef STOCKSDECODER_H
|
||||||
|
#define STOCKSDECODER_H
|
||||||
|
#include "exceldecoder.h"
|
||||||
|
#include <QMap>
|
||||||
|
#include <QVariant>
|
||||||
|
#include "db/structs.h"
|
||||||
|
|
||||||
|
class StocksDecoder : public ExcelDecoder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QList<_stocksInfo> data;
|
||||||
|
public:
|
||||||
|
StocksDecoder();
|
||||||
|
virtual DecoderType decoderType(){ return DecoderType::stocks;}
|
||||||
|
virtual ~StocksDecoder(){}
|
||||||
|
virtual void decode(QList<QList<QVariant> > edatas,QString date = "");
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString parseStockHead(QList<QVariant> headDatas);//½âÎöÍ· ·µ»Ø½»Ò×ÈÕ
|
||||||
|
void toValueStockInfo(_stocksInfo ¶m ,int index,QString value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMap<int,QString> m_wholeStocksKeyIndexs;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STOCKSDECODER_H
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef XEXCEL_H
|
||||||
|
#define XEXCEL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class QAxObject;
|
||||||
|
class XExcel : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit XExcel(QObject *parent = nullptr);
|
||||||
|
//打开excel com
|
||||||
|
void openExcelCom();
|
||||||
|
//关闭excel com
|
||||||
|
void closeExcelCom();
|
||||||
|
|
||||||
|
QList<QList<QVariant> > readExcel(QString fileName);
|
||||||
|
void readExcels(QList<QString> fileNames);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QAxObject* m_pExcel;
|
||||||
|
QAxObject* m_pWorkbooks;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // XEXCEL_H
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
#include "historywidget.h"
|
||||||
|
#include "ui_historywidget.h"
|
||||||
|
|
||||||
|
HistoryWidget::HistoryWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::HistoryWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
HistoryWidget::~HistoryWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef HISTORYWIDGET_H
|
||||||
|
#define HISTORYWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class HistoryWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit HistoryWidget(QWidget *parent = nullptr);
|
||||||
|
~HistoryWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::HistoryWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HISTORYWIDGET_H
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>HistoryWidget</class>
|
||||||
|
<widget class="QWidget" name="HistoryWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>959</width>
|
||||||
|
<height>622</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color:rgb(0, 0, 255);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>importWidget</class>
|
||||||
|
<widget class="QWidget" name="importWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>938</width>
|
||||||
|
<height>580</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>日期</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDateEdit" name="currentDate"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>文件</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QPushButton" name="pushButton_Stocks_query">
|
||||||
|
<property name="text">
|
||||||
|
<string>查询个股</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<widget class="QPushButton" name="pushButton_LimitUp">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入涨停板</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="pushButton_Stocks">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入个股</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="pushButton_LimitUp_query">
|
||||||
|
<property name="text">
|
||||||
|
<string>查询涨停板</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="6">
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView_import"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef LOADINGDIALOG_H
|
||||||
|
#define LOADINGDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class LoadingDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoadingDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit LoadingDialog(QWidget *parent = nullptr);
|
||||||
|
~LoadingDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::LoadingDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOADINGDIALOG_H
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LoadingDialog</class>
|
||||||
|
<widget class="QDialog" name="LoadingDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>750</width>
|
||||||
|
<height>750</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>750</width>
|
||||||
|
<height>750</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="resource.qrc">:/resource/loading2.gif</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="resource.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include "db/xsqlexcute.h"
|
||||||
|
#include "db/xwholestocks.h"
|
||||||
|
#include "db/xwholestockindexs.h"
|
||||||
|
#include "db/xhighstocks.h"
|
||||||
|
#include "db/xhighstockindexs.h"
|
||||||
|
#include <QtDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include "excel/xexcel.h"
|
||||||
|
#include "xexceltomysq.h"
|
||||||
|
#include "excel/stocksdecoder.h"
|
||||||
|
#include "db/stockssqlmanager.h"
|
||||||
|
#include "db/stockbasissqlmanager.h"
|
||||||
|
#include "excel/limitupstockdecoder.h"
|
||||||
|
#include "db/limitupstocksqlmanager.h"
|
||||||
|
#include "loadingdialog.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget* parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
, ui(new Ui::MainWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
// m_importWidget = new ImportWidget;
|
||||||
|
m_todayWidget = new TodayWidget;
|
||||||
|
m_historyWidget = new HistoryWidget;
|
||||||
|
m_importWidget = ui->iwidget;
|
||||||
|
|
||||||
|
// QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
|
||||||
|
// db.setHostName("127.0.0.1");
|
||||||
|
// db.setDatabaseName("nstocks");
|
||||||
|
// db.setUserName("admin");
|
||||||
|
// db.setPassword("1qazse42W3");
|
||||||
|
// db.open();
|
||||||
|
// XSqlExcute::instance()->openMysql("127.0.0.1","nstocks","admin","1qazse42W3");
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::testStocks()
|
||||||
|
{
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, QStringLiteral("选择Excel文件"), "",QStringLiteral("Exel file(*.xls *.xlsx)"));
|
||||||
|
XExcel excel;
|
||||||
|
excel.openExcelCom();
|
||||||
|
QList<QList<QVariant> > excelDatas = excel.readExcel(filePath);
|
||||||
|
excel.closeExcelCom();
|
||||||
|
|
||||||
|
//测试stocks
|
||||||
|
StocksDecoder* decoder = new StocksDecoder;
|
||||||
|
decoder->decode(excelDatas,"2021-11-25");
|
||||||
|
QList<_stocksInfo> d = decoder->data;
|
||||||
|
if(!d.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << d[0].code << " "
|
||||||
|
<< d[0].name << " "
|
||||||
|
<< d[0].tradeDay << " "
|
||||||
|
<< d[0].open << " "
|
||||||
|
<< d[0].close << " "
|
||||||
|
<< d[0].differRange << " "
|
||||||
|
<< d[0].blemind2 << " "
|
||||||
|
<< d[0].blemind3 << " "
|
||||||
|
<< d[0].differRangeP10 << " "
|
||||||
|
<< d[0].differRangeP20 << " "
|
||||||
|
<< d[0].differRangeP60 << " "
|
||||||
|
<< d[0].listDate << " "
|
||||||
|
<< d[0].tradeDays << " "
|
||||||
|
<< d[0].volumn << " "
|
||||||
|
<< d[0].amount << " "
|
||||||
|
<< d[0].freeFloatMarketValue << " "
|
||||||
|
<< d[0].totalMarketValue << " "
|
||||||
|
<< d[0].agenciesHold << " "
|
||||||
|
<< d[0].avgVolume20;
|
||||||
|
//插入到数据库
|
||||||
|
StocksSqlManager* ssm = new StocksSqlManager;
|
||||||
|
QString sql = ssm->toInsertSql(d[0]);
|
||||||
|
qDebug() << "sql : " << sql;
|
||||||
|
StockBasisSqlManager* sbsm = new StockBasisSqlManager;
|
||||||
|
QString bsql = sbsm->toInsertSql(d[0]);
|
||||||
|
qDebug() << "bsql : " << bsql;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::testLimitUpStocks()
|
||||||
|
{
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, QStringLiteral("选择Excel文件"), "",QStringLiteral("Exel file(*.xls *.xlsx)"));
|
||||||
|
XExcel excel;
|
||||||
|
excel.openExcelCom();
|
||||||
|
QList<QList<QVariant> > excelDatas = excel.readExcel(filePath);
|
||||||
|
excel.closeExcelCom();
|
||||||
|
//测试limitup
|
||||||
|
LimitUpStockDecoder* decoder = new LimitUpStockDecoder;
|
||||||
|
decoder->decode(excelDatas);
|
||||||
|
QList<_limitUpStocksInfo> d = decoder->data;
|
||||||
|
if(!d.isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << d[0].code << " "
|
||||||
|
<< d[0].tradeDay << " ";
|
||||||
|
//插入到数据库
|
||||||
|
LimitUpStockSqlManager* ssm = new LimitUpStockSqlManager;
|
||||||
|
QString sql = ssm->toInsertSql(d[0]);
|
||||||
|
qDebug() << "sql : " << sql;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_import_clicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_today_clicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_history_clicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_7_clicked()
|
||||||
|
{
|
||||||
|
LoadingDialog ld;
|
||||||
|
ld.exec();
|
||||||
|
return;
|
||||||
|
testStocks();
|
||||||
|
return;
|
||||||
|
// QList<QString> fileNames;
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, QStringLiteral("选择Excel文件"), "",QStringLiteral("Exel file(*.xls *.xlsx)"));
|
||||||
|
// fileNames.append(filePath);
|
||||||
|
// filePath = QFileDialog::getOpenFileName(this, QStringLiteral("选择Excel文件"), "",QStringLiteral("Exel file(*.xls *.xlsx)"));
|
||||||
|
// fileNames.append(filePath);
|
||||||
|
XExcel excel;
|
||||||
|
excel.openExcelCom();
|
||||||
|
// excel.readExcels(fileNames);
|
||||||
|
QList<QList<QVariant> > excelDatas = excel.readExcel(filePath);
|
||||||
|
excel.closeExcelCom();
|
||||||
|
|
||||||
|
XStocksDataParser stocksParser;
|
||||||
|
if(filePath.contains(QStringLiteral("动量原始股")))
|
||||||
|
{
|
||||||
|
//全A
|
||||||
|
QList<_WholeStocksParam> wholeStocks = stocksParser.parseWholeStocks(excelDatas);
|
||||||
|
if(wholeStocks.count() > 0)
|
||||||
|
{
|
||||||
|
qDebug() << " wholeStocks count :" << wholeStocks.count();
|
||||||
|
XWholeStocks stock;
|
||||||
|
XSqlExcute::instance()->transaction("mainWindow");
|
||||||
|
for(int i = 0 ; i < wholeStocks.count() ; i++)
|
||||||
|
{
|
||||||
|
_WholeStocksParam wp = wholeStocks.at(i);
|
||||||
|
QString sql = stock.toInsertSql(wp);
|
||||||
|
qDebug() << sql;
|
||||||
|
XSqlExcute::instance()->query(sql,"mainWindow");
|
||||||
|
}
|
||||||
|
XSqlExcute::instance()->commit("mainWindow");
|
||||||
|
|
||||||
|
//计算统计值
|
||||||
|
QString totalSql = QString("INSERT INTO wholeaindex (tradeDay,COMPONENTNUM,amount,freeFloatMv,mvByCSRC) "
|
||||||
|
"SELECT tradeDay,COUNT(`code`),SUM(amount ),SUM(freeFloatMv),SUM(mvByCSRC)"
|
||||||
|
"FROM wholestocks WHERE tradeDay = '%1';").arg(wholeStocks.at(0).tradeDay);
|
||||||
|
XSqlExcute::instance()->transaction("mainWindow");
|
||||||
|
XSqlExcute::instance()->query(totalSql,"mainWindow");
|
||||||
|
XSqlExcute::instance()->commit("mainWindow");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(filePath.contains(QStringLiteral("东财二级行业指数每日成交情况")))
|
||||||
|
{
|
||||||
|
//全部指数
|
||||||
|
QList<XWholeStockIndexs::_WholeStockIndexsParam> wholeStockIndexs = stocksParser.parseWholeStockIndexs(excelDatas);
|
||||||
|
if(wholeStockIndexs.count() > 0)
|
||||||
|
{
|
||||||
|
qDebug() << " wholeStocks count :" << wholeStockIndexs.count();
|
||||||
|
XWholeStockIndexs stockIndex;
|
||||||
|
XSqlExcute::instance()->transaction("mainWindow");
|
||||||
|
for(int i = 0 ; i < wholeStockIndexs.count() ; i++)
|
||||||
|
{
|
||||||
|
XWholeStockIndexs::_WholeStockIndexsParam wp = wholeStockIndexs.at(i);
|
||||||
|
QString sql = stockIndex.toInsertSql(wp);
|
||||||
|
qDebug() << sql;
|
||||||
|
XSqlExcute::instance()->query(sql,"mainWindow");
|
||||||
|
}
|
||||||
|
XSqlExcute::instance()->commit("mainWindow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(filePath.contains(QStringLiteral("创300天新高")))
|
||||||
|
{
|
||||||
|
//创新高个股
|
||||||
|
QList<_HighStocksParam> wholeStockIndexs = stocksParser.parseHightStocks(excelDatas);
|
||||||
|
if(wholeStockIndexs.count() > 0)
|
||||||
|
{
|
||||||
|
qDebug() << " wholeStocks count :" << wholeStockIndexs.count();
|
||||||
|
XHighStocks stockIndex;
|
||||||
|
XSqlExcute::instance()->transaction("mainWindow");
|
||||||
|
for(int i = 0 ; i < wholeStockIndexs.count() ; i++)
|
||||||
|
{
|
||||||
|
_HighStocksParam wp = wholeStockIndexs.at(i);
|
||||||
|
QString sql = stockIndex.toInsertSql(wp);
|
||||||
|
qDebug() << sql;
|
||||||
|
XSqlExcute::instance()->query(sql,"mainWindow");
|
||||||
|
}
|
||||||
|
XSqlExcute::instance()->commit("mainWindow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(filePath.contains(QStringLiteral("东财二级创250天新高")))
|
||||||
|
{
|
||||||
|
//创新高指数
|
||||||
|
QList<_HighStockIndexsParam> wholeStockIndexs = stocksParser.parseHightStockIndexs(excelDatas);
|
||||||
|
if(wholeStockIndexs.count() > 0)
|
||||||
|
{
|
||||||
|
qDebug() << " wholeStocks count :" << wholeStockIndexs.count();
|
||||||
|
XHighStockIndexs stockIndex;
|
||||||
|
XSqlExcute::instance()->transaction("mainWindow");
|
||||||
|
for(int i = 0 ; i < wholeStockIndexs.count() ; i++)
|
||||||
|
{
|
||||||
|
_HighStockIndexsParam wp = wholeStockIndexs.at(i);
|
||||||
|
QString sql = stockIndex.toInsertSql(wp);
|
||||||
|
qDebug() << sql;
|
||||||
|
XSqlExcute::instance()->query(sql,"mainWindow");
|
||||||
|
}
|
||||||
|
XSqlExcute::instance()->commit("mainWindow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1294</width>
|
||||||
|
<height>701</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="18">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="ImportWidget" name="iwidget">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>导入数据</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="trendWidet" name="twidget">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>动量分析</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1294</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuklui">
|
||||||
|
<property name="title">
|
||||||
|
<string>开始</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action"/>
|
||||||
|
<addaction name="action_5"/>
|
||||||
|
<addaction name="action_3"/>
|
||||||
|
<addaction name="actionaa"/>
|
||||||
|
<addaction name="action_4"/>
|
||||||
|
<addaction name="action_import"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="title">
|
||||||
|
<string>配置</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>帮助</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_2"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuklui"/>
|
||||||
|
<addaction name="menu"/>
|
||||||
|
<addaction name="menu_2"/>
|
||||||
|
</widget>
|
||||||
|
<action name="action">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入全A股票</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于我们</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionaa">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入东财指数</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_import">
|
||||||
|
<property name="text">
|
||||||
|
<string>批量导入</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入涨跌停</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入板块创新高</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入个股创新高</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ImportWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">importwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>trendWidet</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">trendwidet.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>resource/loading.gif</file>
|
||||||
|
<file>resource/loading2.gif</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 639 KiB |
@ -0,0 +1,92 @@
|
|||||||
|
QT += core gui charts sql axcontainer
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
datamanagerthread.cpp \
|
||||||
|
db/limitupstocksqlmanager.cpp \
|
||||||
|
db/stockbasissqlmanager.cpp \
|
||||||
|
db/stockssqlmanager.cpp \
|
||||||
|
db/xhighstockindexs.cpp \
|
||||||
|
db/xhighstocks.cpp \
|
||||||
|
db/xsqlexcute.cpp \
|
||||||
|
db/xwholestockindexs.cpp \
|
||||||
|
db/xwholestocks.cpp \
|
||||||
|
excel/exceldecoder.cpp \
|
||||||
|
excel/limitupstockdecoder.cpp \
|
||||||
|
excel/stocksdecoder.cpp \
|
||||||
|
limitupstocksmanager.cpp \
|
||||||
|
loadingdialog.cpp \
|
||||||
|
stocksmanager.cpp \
|
||||||
|
trendmanager.cpp \
|
||||||
|
trendtablemodel.cpp \
|
||||||
|
trendwidet.cpp \
|
||||||
|
widget/distributewidget.cpp \
|
||||||
|
historywidget.cpp \
|
||||||
|
importwidget.cpp \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
todaywidget.cpp \
|
||||||
|
excel/xexcel.cpp \
|
||||||
|
xexceltomysq.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
datamanagerbase.h \
|
||||||
|
datamanagerthread.h \
|
||||||
|
db/limitupstocksqlmanager.h \
|
||||||
|
db/stockbasissqlmanager.h \
|
||||||
|
db/stockssqlmanager.h \
|
||||||
|
db/structs.h \
|
||||||
|
db/xhighstockindexs.h \
|
||||||
|
db/xhighstocks.h \
|
||||||
|
db/xsqlexcute.h \
|
||||||
|
db/xwholestockindexs.h \
|
||||||
|
db/xwholestocks.h \
|
||||||
|
excel/exceldecoder.h \
|
||||||
|
excel/limitupstockdecoder.h \
|
||||||
|
excel/stocksdecoder.h \
|
||||||
|
limitupstocksmanager.h \
|
||||||
|
loadingdialog.h \
|
||||||
|
loadingdialog.h \
|
||||||
|
stocksmanager.h \
|
||||||
|
trendmanager.h \
|
||||||
|
trendtablemodel.h \
|
||||||
|
trendwidet.h \
|
||||||
|
widget/distributewidget.h \
|
||||||
|
historywidget.h \
|
||||||
|
importwidget.h \
|
||||||
|
mainwindow.h \
|
||||||
|
todaywidget.h \
|
||||||
|
excel/xexcel.h \
|
||||||
|
xexceltomysq.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
loadingdialog.ui \
|
||||||
|
trendwidet.ui \
|
||||||
|
widget/distributewidget.ui \
|
||||||
|
historywidget.ui \
|
||||||
|
importwidget.ui \
|
||||||
|
mainwindow.ui \
|
||||||
|
todaywidget.ui
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
resource.qrc
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef TODAYWIDGET_H
|
||||||
|
#define TODAYWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class TodayWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TodayWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TodayWidget(QWidget *parent = nullptr);
|
||||||
|
~TodayWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::TodayWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TODAYWIDGET_H
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TodayWidget</class>
|
||||||
|
<widget class="QWidget" name="TodayWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1121</width>
|
||||||
|
<height>654</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>涨跌分布</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>热点板块</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>指数涨跌</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_4">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>资金流向</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>trendWidet</class>
|
||||||
|
<widget class="QWidget" name="trendWidet">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1184</width>
|
||||||
|
<height>640</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDateEdit" name="currentDate"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>文件</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="pushButton_trend">
|
||||||
|
<property name="text">
|
||||||
|
<string>分析</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>日期</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QPushButton" name="pushButton_query">
|
||||||
|
<property name="text">
|
||||||
|
<string>查询</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2" rowstretch="6,4">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTableView" name="tableView_trend20"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QTableView" name="tableView_trend10"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableView" name="tableView_stocks20"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QTableView" name="tableView_stocks10"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef DISTRIBUTEWIDGET_H
|
||||||
|
#define DISTRIBUTEWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DistributeWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DistributeWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DistributeWidget(QWidget *parent = nullptr);
|
||||||
|
~DistributeWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::DistributeWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DISTRIBUTEWIDGET_H
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DistributeWidget</class>
|
||||||
|
<widget class="QWidget" name="DistributeWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>896</width>
|
||||||
|
<height>517</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@ -0,0 +1,641 @@
|
|||||||
|
#include "xexceltomysq.h"
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
XStocksDataParser::XStocksDataParser(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<_WholeStocksParam> XStocksDataParser::parseWholeStocks(QList<QList<QVariant> > datas)
|
||||||
|
{
|
||||||
|
QList<_WholeStocksParam> wholeStocksParamList;
|
||||||
|
if(datas.count() <= 1)
|
||||||
|
return wholeStocksParamList;
|
||||||
|
QList<QVariant> headDatas = datas.at(0);
|
||||||
|
m_wholeStocksKeyIndexs.clear();
|
||||||
|
QString tradeDay = parseWholeStockHead(headDatas);
|
||||||
|
if(!tradeDay.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << " datas count :" << datas.count();
|
||||||
|
for (int row = 1; row < datas.count();row++)
|
||||||
|
{
|
||||||
|
QList<QVariant> rowData = datas.at(row);
|
||||||
|
_WholeStocksParam param;
|
||||||
|
for(int column = 0; column < rowData.count() ; column++)
|
||||||
|
{
|
||||||
|
if(rowData.at(column).toString().isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "break";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
param.tradeDay = tradeDay;
|
||||||
|
addValueToWholeStockParam(param,column,rowData.at(column).toString());
|
||||||
|
}
|
||||||
|
if(param.code.isEmpty() || param.name.isEmpty())
|
||||||
|
continue;
|
||||||
|
wholeStocksParamList.append(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wholeStocksParamList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<XWholeStockIndexs::_WholeStockIndexsParam> XStocksDataParser::parseWholeStockIndexs(QList<QList<QVariant> > datas)
|
||||||
|
{
|
||||||
|
QList<XWholeStockIndexs::_WholeStockIndexsParam> wholeStockIndexsParamList;
|
||||||
|
if(datas.count() <= 1)
|
||||||
|
return wholeStockIndexsParamList;
|
||||||
|
QList<QVariant> headDatas = datas.at(0);
|
||||||
|
m_wholeStocksKeyIndexs.clear();
|
||||||
|
QString tradeDay = parseWholeStockIndexHead(headDatas);
|
||||||
|
if(!tradeDay.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << " datas count :" << datas.count();
|
||||||
|
for (int row = 1; row < datas.count();row++)
|
||||||
|
{
|
||||||
|
QList<QVariant> rowData = datas.at(row);
|
||||||
|
XWholeStockIndexs::_WholeStockIndexsParam param;
|
||||||
|
for(int column = 0; column < rowData.count() ; column++)
|
||||||
|
{
|
||||||
|
if(rowData.at(column).toString().isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "break";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
param.tradeDay = tradeDay;
|
||||||
|
addValueToWholeStockIndexParam(param,column,rowData.at(column).toString());
|
||||||
|
}
|
||||||
|
if(param.code.isEmpty() || param.name.isEmpty())
|
||||||
|
continue;
|
||||||
|
wholeStockIndexsParamList.append(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wholeStockIndexsParamList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<_HighStocksParam> XStocksDataParser::parseHightStocks(QList<QList<QVariant> > datas)
|
||||||
|
{
|
||||||
|
QList<_HighStocksParam> highStocksParamList;
|
||||||
|
if(datas.count() <= 1)
|
||||||
|
return highStocksParamList;
|
||||||
|
QList<QVariant> headDatas = datas.at(0);
|
||||||
|
m_wholeStocksKeyIndexs.clear();
|
||||||
|
QString tradeDay = parseHighStockHead(headDatas);
|
||||||
|
if(!tradeDay.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << " datas count :" << datas.count();
|
||||||
|
for (int row = 1; row < datas.count();row++)
|
||||||
|
{
|
||||||
|
QList<QVariant> rowData = datas.at(row);
|
||||||
|
_HighStocksParam param;
|
||||||
|
for(int column = 0; column < rowData.count() ; column++)
|
||||||
|
{
|
||||||
|
if(rowData.at(column).toString().isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "break";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
param.tradeDay = tradeDay;
|
||||||
|
addValueToHighStockParam(param,column,rowData.at(column).toString());
|
||||||
|
}
|
||||||
|
if(param.code.isEmpty() || param.name.isEmpty())
|
||||||
|
continue;
|
||||||
|
highStocksParamList.append(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return highStocksParamList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<_HighStockIndexsParam> XStocksDataParser::parseHightStockIndexs(QList<QList<QVariant> > datas)
|
||||||
|
{
|
||||||
|
QList<_HighStockIndexsParam> highStockIndexParamList;
|
||||||
|
if(datas.count() <= 1)
|
||||||
|
return highStockIndexParamList;
|
||||||
|
QList<QVariant> headDatas = datas.at(0);
|
||||||
|
m_wholeStocksKeyIndexs.clear();
|
||||||
|
QString tradeDay = parseHighStockIndexHead(headDatas);
|
||||||
|
if(!tradeDay.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << " datas count :" << datas.count();
|
||||||
|
for (int row = 1; row < datas.count();row++)
|
||||||
|
{
|
||||||
|
QList<QVariant> rowData = datas.at(row);
|
||||||
|
_HighStockIndexsParam param;
|
||||||
|
for(int column = 0; column < rowData.count() ; column++)
|
||||||
|
{
|
||||||
|
if(rowData.at(column).toString().isEmpty())
|
||||||
|
{
|
||||||
|
qDebug() << "break";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
param.tradeDay = tradeDay;
|
||||||
|
addValueToHighStockIndexParam(param,column,rowData.at(column).toString());
|
||||||
|
}
|
||||||
|
if(param.code.isEmpty() || param.name.isEmpty())
|
||||||
|
continue;
|
||||||
|
highStockIndexParamList.append(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return highStockIndexParamList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XStocksDataParser::parseWholeStockHead(QList<QVariant> headDatas)
|
||||||
|
{
|
||||||
|
QString tradeDay = "";
|
||||||
|
for(int i = 0; i < headDatas.count(); i++)
|
||||||
|
{
|
||||||
|
QVariant value = headDatas[i];
|
||||||
|
QString headValue = value.toString();
|
||||||
|
if(headValue.contains(QStringLiteral("证券代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"code");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("证券名称")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"name");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("开盘价")))
|
||||||
|
{
|
||||||
|
// //开盘价[交易日期]最新(2021-05-20)[复权方式]前复权
|
||||||
|
int dayStart = headValue.indexOf("(");
|
||||||
|
int dayEnd = headValue.indexOf(")");
|
||||||
|
tradeDay = headValue.mid(dayStart+1,dayEnd - dayStart-1);
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"open");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("收盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"close");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨跌幅")) && !headValue.contains(QStringLiteral("前20个交易日")) && !headValue.contains(QStringLiteral("前60个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("所属东财行业指数")) && !headValue.contains(QStringLiteral("所属东财行业指数代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"BLEMIND2");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间涨跌幅")) && headValue.contains(QStringLiteral("前20个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRangeP20");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间涨跌幅")) && headValue.contains(QStringLiteral("前60个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRangeP60");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("是否为ST股票")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"isSTStock");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("是否为*ST股票")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"isSTXStock");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("首发上市日期")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"listDate");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间可交易日数")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"tradeDaysP");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交量")) && !headValue.contains(QStringLiteral("区间日均成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"volumn");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交额")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"amount");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("所属东财行业指数代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"BLEMINDCODE2");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("自由流通市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"freeFloatMv");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("总市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"mvByCSRC");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间日均成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"avgVolumeP20");
|
||||||
|
}
|
||||||
|
qDebug() << "parseWholeStockHead : " <<m_wholeStocksKeyIndexs[i];
|
||||||
|
}
|
||||||
|
return tradeDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XStocksDataParser::parseWholeStockIndexHead(QList<QVariant> headDatas)
|
||||||
|
{
|
||||||
|
QString tradeDay = "";
|
||||||
|
for(int i = 0; i < headDatas.count(); i++)
|
||||||
|
{
|
||||||
|
QVariant value = headDatas[i];
|
||||||
|
QString headValue = value.toString();
|
||||||
|
if(headValue.contains(QStringLiteral("证券代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"code");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("证券名称")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"name");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成份个数")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"componentNum");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("开盘价")))
|
||||||
|
{
|
||||||
|
// //开盘价[交易日期]最新(2021-05-20)[复权方式]前复权
|
||||||
|
int dayStart = headValue.indexOf("(");
|
||||||
|
int dayEnd = headValue.indexOf(")");
|
||||||
|
tradeDay = headValue.mid(dayStart+1,dayEnd - dayStart-1);
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"open");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("收盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"close");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨跌幅")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"volumn");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交额")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"amount");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("自由流通市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"freeFloatMv");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("总市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"mvByCSRC");
|
||||||
|
}
|
||||||
|
qDebug() << "parseWholeStockIndexHead : " <<m_wholeStocksKeyIndexs[i];
|
||||||
|
}
|
||||||
|
return tradeDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XStocksDataParser::parseHighStockHead(QList<QVariant> headDatas)
|
||||||
|
{
|
||||||
|
QString tradeDay = "";
|
||||||
|
for(int i = 0; i < headDatas.count(); i++)
|
||||||
|
{
|
||||||
|
QVariant value = headDatas[i];
|
||||||
|
QString headValue = value.toString();
|
||||||
|
if(headValue.contains(QStringLiteral("证券代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"code");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("证券名称")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"name");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("开盘价")))
|
||||||
|
{
|
||||||
|
// //开盘价[交易日期]最新(2021-05-20)[复权方式]前复权
|
||||||
|
int dayStart = headValue.indexOf("(");
|
||||||
|
int dayEnd = headValue.indexOf(")");
|
||||||
|
tradeDay = headValue.mid(dayStart+1,dayEnd - dayStart-1);
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"open");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("收盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"close");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("最高价")) && !headValue.contains(QStringLiteral("区间最高价日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"high");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨跌幅")) && !headValue.contains(QStringLiteral("前20个交易日")) && !headValue.contains(QStringLiteral("前60个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成交量")) && !headValue.contains(QStringLiteral("区间日均成交量")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"volumn");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("近期创阶段新高")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"isHighRangeP");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("所属东财行业指数")) && !headValue.contains(QStringLiteral("所属东财行业指数代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"BLEMIND2");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间最高价日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"HpDateP");
|
||||||
|
}
|
||||||
|
qDebug() << "parseWholeStockHead : " <<m_wholeStocksKeyIndexs[i];
|
||||||
|
}
|
||||||
|
return tradeDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XStocksDataParser::parseHighStockIndexHead(QList<QVariant> headDatas)
|
||||||
|
{
|
||||||
|
QString tradeDay = "";
|
||||||
|
for(int i = 0; i < headDatas.count(); i++)
|
||||||
|
{
|
||||||
|
QVariant value = headDatas[i];
|
||||||
|
QString headValue = value.toString();
|
||||||
|
if(headValue.contains(QStringLiteral("证券代码")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"code");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("证券名称")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"name");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("开盘价")))
|
||||||
|
{
|
||||||
|
// //开盘价[交易日期]最新(2021-05-20)[复权方式]前复权
|
||||||
|
int dayStart = headValue.indexOf("(");
|
||||||
|
int dayEnd = headValue.indexOf(")");
|
||||||
|
tradeDay = headValue.mid(dayStart+1,dayEnd - dayStart-1);
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"open");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("收盘价")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"close");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨跌幅")) && !headValue.contains(QStringLiteral("前20个交易日")) && !headValue.contains(QStringLiteral("前60个交易日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"differRange");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("近期创阶段新高")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"isHighRangeP");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("区间最高价日")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"HpDateP");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("涨停家数")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"LIMITUPNUM");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("总市值")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"mvByCSRC");
|
||||||
|
}
|
||||||
|
else if(headValue.contains(QStringLiteral("成份个数")))
|
||||||
|
{
|
||||||
|
m_wholeStocksKeyIndexs.insert(i,"componentNum");
|
||||||
|
}
|
||||||
|
qDebug() << "parseWholeStockHead : " <<m_wholeStocksKeyIndexs[i];
|
||||||
|
}
|
||||||
|
return tradeDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XStocksDataParser::addValueToWholeStockParam(_WholeStocksParam ¶m ,int index,QString value)
|
||||||
|
{
|
||||||
|
if(m_wholeStocksKeyIndexs[index] == "code")
|
||||||
|
{
|
||||||
|
param.code = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "name")
|
||||||
|
{
|
||||||
|
param.name = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "open")
|
||||||
|
{
|
||||||
|
// param.open = value.toDouble();
|
||||||
|
param.open = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "close")
|
||||||
|
{
|
||||||
|
// param.close = value.toDouble();
|
||||||
|
param.close = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange")
|
||||||
|
{
|
||||||
|
// param.differRange = value.toDouble();
|
||||||
|
param.differRange = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "BLEMIND2")
|
||||||
|
{
|
||||||
|
param.BLEMIND2 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRangeP20")
|
||||||
|
{
|
||||||
|
// param.differRangeP20 = value.toDouble();
|
||||||
|
param.differRangeP20 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRangeP60")
|
||||||
|
{
|
||||||
|
// param.differRangeP60 = value.toDouble();
|
||||||
|
param.differRangeP60 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "isSTStock")
|
||||||
|
{
|
||||||
|
// param.isSTStock = value.toInt();
|
||||||
|
param.isSTStock = value == QStringLiteral("是") ? 1 : 0;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "isSTXStock")
|
||||||
|
{
|
||||||
|
param.isSTXStock = value == QStringLiteral("是") ? 1 : 0;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "listDate")
|
||||||
|
{
|
||||||
|
param.listDate = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "tradeDaysP")
|
||||||
|
{
|
||||||
|
// param.tradeDaysP = value.toInt();
|
||||||
|
param.tradeDaysP = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "volumn")
|
||||||
|
{
|
||||||
|
// param.volumn = value.toDouble();
|
||||||
|
param.volumn = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "amount")
|
||||||
|
{
|
||||||
|
// param.amount = value.toDouble();
|
||||||
|
param.amount = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "BLEMINDCODE2")
|
||||||
|
{
|
||||||
|
param.BLEMINDCODE2 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "freeFloatMv")
|
||||||
|
{
|
||||||
|
// param.freeFloatMv = value.toDouble();
|
||||||
|
param.freeFloatMv = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "mvByCSRC")
|
||||||
|
{
|
||||||
|
// param.mvByCSRC = value.toDouble();
|
||||||
|
param.mvByCSRC = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "avgVolumeP20")
|
||||||
|
{
|
||||||
|
// param.avgVolumeP20 = value.toDouble();
|
||||||
|
param.avgVolumeP20 = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XStocksDataParser::addValueToWholeStockIndexParam(XWholeStockIndexs::_WholeStockIndexsParam ¶m ,int index,QString value)
|
||||||
|
{
|
||||||
|
if(m_wholeStocksKeyIndexs[index] == "code")
|
||||||
|
{
|
||||||
|
param.code = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "name")
|
||||||
|
{
|
||||||
|
param.name = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "componentNum")
|
||||||
|
{
|
||||||
|
// param.componentNum = value.toInt();
|
||||||
|
param.componentNum = value;
|
||||||
|
// qDebug() << "componentNum : " << value << " toInt : " << param.componentNum;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "open")
|
||||||
|
{
|
||||||
|
// param.open = value.toDouble();
|
||||||
|
param.open = value;
|
||||||
|
// qDebug() << "open : " << param.open;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "close")
|
||||||
|
{
|
||||||
|
// param.close = value.toDouble();
|
||||||
|
param.close = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange")
|
||||||
|
{
|
||||||
|
// param.differRange = value.toDouble();
|
||||||
|
param.differRange = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "volumn")
|
||||||
|
{
|
||||||
|
// param.volumn = value.toDouble();
|
||||||
|
param.volumn = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "amount")
|
||||||
|
{
|
||||||
|
// param.amount = value.toDouble();
|
||||||
|
param.amount = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "freeFloatMv")
|
||||||
|
{
|
||||||
|
// param.freeFloatMv = value.toDouble();
|
||||||
|
param.freeFloatMv = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "mvByCSRC")
|
||||||
|
{
|
||||||
|
// param.mvByCSRC = value.toDouble();
|
||||||
|
param.mvByCSRC = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XStocksDataParser::addValueToHighStockParam(_HighStocksParam ¶m ,int index,QString value)
|
||||||
|
{
|
||||||
|
if(m_wholeStocksKeyIndexs[index] == "code")
|
||||||
|
{
|
||||||
|
param.code = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "name")
|
||||||
|
{
|
||||||
|
param.name = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "open")
|
||||||
|
{
|
||||||
|
// param.open = value.toDouble();
|
||||||
|
param.open = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "close")
|
||||||
|
{
|
||||||
|
// param.close = value.toDouble();
|
||||||
|
param.close = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "high")
|
||||||
|
{
|
||||||
|
// param.high = value.toDouble();
|
||||||
|
param.high = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange")
|
||||||
|
{
|
||||||
|
// param.differRange = value.toDouble();
|
||||||
|
param.differRange = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "volumn")
|
||||||
|
{
|
||||||
|
// param.volumn = value.toDouble();
|
||||||
|
param.volumn = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "isHighRangeP")
|
||||||
|
{
|
||||||
|
// param.isHighRangeP = value.toInt();
|
||||||
|
param.isHighRangeP = value == QStringLiteral("是") ? 1 : 0;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "BLEMIND2")
|
||||||
|
{
|
||||||
|
param.BLEMIND2 = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "HpDateP")
|
||||||
|
{
|
||||||
|
param.HpDateP = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XStocksDataParser::addValueToHighStockIndexParam(_HighStockIndexsParam ¶m ,int index,QString value)
|
||||||
|
{
|
||||||
|
if(m_wholeStocksKeyIndexs[index] == "code")
|
||||||
|
{
|
||||||
|
param.code = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "name")
|
||||||
|
{
|
||||||
|
param.name = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "open")
|
||||||
|
{
|
||||||
|
// param.open = value.toDouble();
|
||||||
|
param.open = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "close")
|
||||||
|
{
|
||||||
|
// param.close = value.toDouble();
|
||||||
|
param.close = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "differRange")
|
||||||
|
{
|
||||||
|
// param.differRange = value.toDouble();
|
||||||
|
param.differRange = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "isHighRangeP")
|
||||||
|
{
|
||||||
|
// param.isHighRangeP = value.toInt();
|
||||||
|
param.isHighRangeP = value == QStringLiteral("是") ? 1 : 0;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "HpDateP")
|
||||||
|
{
|
||||||
|
// param.HpDateP = value;
|
||||||
|
param.HpDateP = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "LIMITUPNUM")
|
||||||
|
{
|
||||||
|
param.LIMITUPNUM = value.toInt();
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "mvByCSRC")
|
||||||
|
{
|
||||||
|
param.mvByCSRC = value;
|
||||||
|
}
|
||||||
|
else if(m_wholeStocksKeyIndexs[index] == "componentNum")
|
||||||
|
{
|
||||||
|
param.COMPONENTNUM = value.toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue