⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stockdataprocess.cpp

📁 从联合证券数据读取股票数据以及画出K线。不完善
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// StockDataProcess.cpp: implementation of the StockDataProcess class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "StockDataParse.h"
#include "StockDataProcess.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

StockDataProcess::StockDataProcess()
{

}

StockDataProcess::~StockDataProcess()
{

}

CString StockDataProcess::ParseDy(unsigned char iCode)
{
	CString strRet;
	
	switch(iCode) 
	{
	case 1 :
		strRet = "黑龙江";
		break;
	case 2 :
		strRet ="新疆";
		break;
	case 3:
		strRet ="吉林";  //3 吉林
		break;
	case 4:
		strRet ="甘肃";  //4 		
		break;
	case 5:
		strRet ="辽宁"; //5 辽宁		
		break;
	case 6:
		strRet ="青海"; //6 青海				
		break;
	case 7:
		strRet ="北京";
		break;
	case 8:
		strRet ="陕西";
		break;
	case 9:
		strRet ="天津";
		break;
	case 10:
		strRet ="广西";
		break;
	case 11:
		strRet ="河北";
		break;

	case 12:
		strRet ="广东";
		break;
	case 13:
		strRet ="河南";
		break;
	case 14:
		strRet ="宁夏";
		break;
	case 15:
		strRet ="山东";
		break;
	case 16:
		strRet ="上海";
		break;
	case 17:
		strRet ="山西";
		break;
	case 18:
		strRet ="深圳";
		break;
	case 19:
		strRet ="湖北";		
		break;
	case 20:
		strRet ="福建";
		break;
	case 21:
		strRet ="湖南";
		break;
	case 22:
		strRet ="江西";
		break;
	case 23:
		strRet ="四川";
		break;
	case 24:
		strRet ="安徽";
		break;
	case 25:
		strRet ="重庆";
		break;
	case 26:
		strRet ="江苏";
		break;
	case 27:
		strRet ="云南";
		break;
	case 28:
		strRet ="浙江";
		break;
	case 29:
		strRet ="贵州";
		break;
	case 30:
		strRet ="海南";
		break;
	case 31:
		strRet ="西藏";
		break;
	case 32:
		strRet ="内蒙"; //32  
		break;

	default:		
		strRet = "Unkown Diyu";	
		
	}
	return strRet;
	

}

CString StockDataProcess::ParseHy(unsigned char chCode)
{

	CString strRet;
	
	switch(chCode) 
	{
	case 1 :
		strRet = "金融";
		break;
	case 2 :
		strRet ="首饰";
		break;
	case 3:
		strRet ="钢铁";  //3 吉林
		break;
	case 4:
		strRet ="家具";  //4 		
		break;
	case 5:
		strRet ="石油"; //5 辽宁		
		break;
	case 6:
		strRet ="公路桥梁"; //6 青海				
		break;
	case 7:
		strRet ="汽车制造";
		break;
	case 8:
		strRet ="交通运输";
		break;
	case 9:
		strRet ="医疗器械";
		break;
	case 10:
		strRet ="酒店旅游";
		break;
	case 11:
		strRet ="房地产";
		break;

	case 12:
		strRet ="商业百货";
		break;
	case 13:
		strRet ="物资外贸";
		break;
	case 14:
		strRet ="食品";
		break;
	case 15:
		strRet ="纺织";
		break;
	case 16:
		strRet ="电力";
		break;
	case 17:
		strRet ="农林牧渔";
		break;
	case 18:
		strRet ="传媒娱乐";
		break;
	case 19:
		strRet ="化工";		
		break;
	case 20:
		strRet ="煤炭";
		break;
	case 21:
		strRet ="建筑建材";
		break;
	case 22:
		strRet ="水泥";
		break;
	case 23:
		strRet ="家电";
		break;
	case 24:
		strRet ="电子信息";
		break;
	case 25:
		strRet ="综合";
		break;
	case 26:
		strRet ="机械";
		break;
	case 27:
		strRet ="化纤";
		break;
	case 28:
		strRet ="农药化肥";
		break;
	case 29:
		strRet ="电器";
		break;
	case 30:
		strRet ="摩托车";
		break;
	case 31:
		strRet ="开发区";
		break;
	case 32:
		strRet ="自行车"; //32  
		break;	
	case 33:
		strRet ="船舶制造";
		break;
	case 34:
		strRet ="生物制药";
		break;
	case 35:
		strRet ="电子器件";
		break;
	case 36:
		strRet ="有色金属";
		break;
	case 37:
		strRet ="酿酒";
		break;
	case 38:
		strRet ="造纸";
		break;
	case 39:
		strRet ="环保";		
		break;
	case 40:
		strRet ="陶瓷";
		break;
	case 41:
		strRet ="服装鞋类";
		break;
	case 42:
		strRet ="供水供气";
		break;
	case 43:
		strRet ="发电设备";
		break;
	case 44:
		strRet ="制笔";
		break;
	case 45:
		strRet ="纺织";
		break;
	case 46:
		strRet ="印刷包装";
		break;
	case 47:
		strRet ="塑料制品";
		break;
	case 48:
		strRet ="玻璃";
		break;
	case 49:
		strRet ="飞机制造";
		break;
	case 50:
		strRet ="感光材料";
		break;
	case 51:
		strRet ="仪器仪表";
		break;
	case 52:
		strRet ="其它"; //32  
		break;

	default:		
		strRet = "Unkown Diyu";	
		
	}
	return strRet;

}

int StockDataProcess::FunParseStockTypeInfo(unsigned char *pchInput,ST_StockReportInfo* pST_StockReportInfo, int* piRet)
{

	if(pchInput ==NULL)
	{
		return -1;
	}
	unsigned char* pchStart = pchInput;
	//	pchInput = pchInput;
	
	/* 解析股票 类型,字的起始位置
	pchTemp = pBuf+0x20;			
			ST_tockType myST_tockType[50];
						memset(myST_tockType,0,sizeof(ST_tockType));
						for(int i=0;i<40;i++)
						{
							int index=0;
							unsigned char* pchTempindex = pchTemp;
							while (*pchTempindex !='\0') 
							{					
								myST_tockType[i].chStockTypeName[index] = *pchTempindex++;
								index++;
							}
							myST_tockType[i].chStockTypeName[index] ='\0';
							
							myST_tockType[i].uiStockTypeNameOffset = *(int*)(pchTemp+12);
							
							pchTemp = pchTemp+0x20;
							
	}*/
			
	
	//read stock code
	memset(pST_StockReportInfo,0,sizeof(ST_StockReportInfo));
	
	//hu shen
	if(*pchInput =='0')
	{
		pST_StockReportInfo->chSc = 0;
	}
	else 
	{
		pST_StockReportInfo->chSc = 1;  //chSc
	}
	
	pchInput++;		
	
	//股票代码
	memcpy(pST_StockReportInfo->chGpdm,pchInput,6);
	pchInput=pchInput+6;

	//更新日期
	memcpy(pST_StockReportInfo->chGxrq,pchInput,8);
	pchInput=pchInput+8;
	
	const int iLen  = 14;
	//总股本   Zgb 
	pST_StockReportInfo->fZgb = TanslatChar2Double(pchInput,iLen);  
	pchInput = pchInput+iLen;
	//Skip Gjg  Fqrfrg  Frg
	pchInput = pchInput+3*iLen;
	
	//流通B股  Bg
	pST_StockReportInfo->fBg = TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//H股  Hg
	pST_StockReportInfo->fHg = TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//流通A股 Ltag
	pST_StockReportInfo->fLtag = TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//Skip Zgg Zpg			
	pchInput = pchInput+2*iLen;
	
	//总资产:   Zzc  
	pST_StockReportInfo->fZzc = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//流动资产  Ldzc
	pST_StockReportInfo->fLdzc = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//固定资产:    Gdzc 
	pST_StockReportInfo->fGdzc = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//无形资产:      Wxzc
	pST_StockReportInfo->fWxzc = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//长期投资:     Cqtz
	pST_StockReportInfo->fCqtz = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//流动负债:      Ldfz
	pST_StockReportInfo->fLdfz = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//长期负债:     Cqfz
	pST_StockReportInfo->fCqfz= 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//资本公积金:     Zbgjj
	pST_StockReportInfo->fZbgjj= 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//净资产:    Jzc
	pST_StockReportInfo->fJzc = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//主营收入:     Zysy
	pST_StockReportInfo->fZysy = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//主营利润:     Zyly
	pST_StockReportInfo->fZyly = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	
	//应收帐款:     Qtly 
	pST_StockReportInfo->fQtly = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//营业利润:     Yyly
	pST_StockReportInfo->fYyly = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//投资收益:       Tzsy 
	pST_StockReportInfo->fTzsy = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	// 经营现金流量:     Btsy
	pST_StockReportInfo->fBtsy= 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//总现金流量:     Yywsz 
	pST_StockReportInfo->fYywsz = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//存货:          Snsytz
	pST_StockReportInfo->fSnsytz = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//利润总额:     Lyze 
	pST_StockReportInfo->fLyze = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//税后利润:     Shly
	pST_StockReportInfo->fShly = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	
	//净利润:     Jly 
	pST_StockReportInfo->fJly = 0.1*TanslatChar2Double(pchInput,iLen);
	pchInput = pchInput+iLen;
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -