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

📄 datastruct.h

📁 股票分析系统
💻 H
字号:
#ifndef DATASTRUCTH#define DATASTRUCTH#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <qsocket.h>using namespace std;//struct KStruct//{//    float open;//    float high;//    float low;//    float close;//};class ZWorld{        float x1,x2,y1,y2;        int X,Y,W,H;        float scaleX,scaleY;        float dx,dy;public:        ZWorld(int X,int Y,int W,int H,float x1,float y1,float x2,float y2)        {                setWorld(X,Y,W,H,x1,y1,x2,y2);	 }        void setWorld(int X,int Y,int W,int H,float x1,float y1,float x2,float y2);           ZWorld(){setWorld(0,0,100,100,0,0,100,100);};	        int x(float in){return (int)((in-x1)*scaleX+X);}        int y(float in){return (int)((in-y2)*scaleY+Y);}        int w(float in){return (int)(in*scaleX);}        int h(float in){return (int)(in*scaleY);}	float fx(int x);	float fy(int y);};class ZNameCode{    unsigned char Head;    char Name[8];    unsigned char style;    char Code[6];    unsigned int LastClose;    unsigned int B;    char PinYin[4];public:    string getName();    string getCode();    string getPinYin();    unsigned char getStyle();    float fgetLastClose(){return((float)LastClose/1000);}}__attribute__ ((packed));class ZNameCodeTable{    int records;    ZNameCode* data;public:    ZNameCodeTable(int records,ZNameCode* data);    int findByCode(string code);    unsigned char getStyleByCode(string code);    string getNameByCode(string code);    int findNearBy(string s);};class ZCurrentIndexStruct{    unsigned int SZIndex;  //深圳指数 *1000    unsigned int SZShou;  //深圳 手数    unsigned int SZMoney; // 成交量  * 100    万元     unsigned int SHIndex;  //上海指数 *1000    unsigned int SHShou;  //上海 手数    unsigned int SHMoney; // 成交量  * 100    万元 public:    float getSZIndex(){return((float)SZIndex/1000);}    float getSZShou(){return((float)SZShou);}    float getSZMoney(){return((float)SZMoney/100);}    float getSHIndex(){return((float)SHIndex/1000);}    float getSHShou(){return((float)SHShou);}    float getSHMoney(){return((float)SHMoney/100);}}__attribute__ ((packed));class ZDaysStruct{    unsigned int FDate;    unsigned int FOpen;    unsigned int FHigh;    unsigned int FLow;    unsigned int FClose;    unsigned int FCount;public:    int date(){return(FDate);}    float open(){return((float)FOpen/1000);}    float high(){return((float)FHigh/1000);}    float low(){return((float)FLow/1000);}    float close(){return((float)FClose/1000);}    int count(){return(FCount);}}__attribute__ ((packed));class ZMinutesStruct{    unsigned int FPrice;    unsigned int FCount;public:    float price(){return((float)FPrice/1000);}    float getPrice(){return((float)FPrice/1000);}    int count(){return(FCount);}    int getCount(){return(FCount);}    void setPrice(float p){FPrice=(int)(p*1000);}    void setCount(unsigned int c){FCount=c;}}__attribute__ ((packed));class ZOldMinutesStruct{    unsigned int FPrice;    unsigned int FCount;    unsigned int A;    unsigned int B;    unsigned int C;public:    float price(){return((float)FPrice/1000);}    int count(){return(FCount);}}__attribute__ ((packed));class ZInfoMinutesStruct{    unsigned short int Time;    unsigned int Price;    unsigned int Count;      //股数    unsigned int Buy;    unsigned int Sell;public:    string sgetTime()    {	int H,M;	if(Time<=120)	{	    H=9;	    M=30;	    H=H+(Time+M)/60;	    M=(Time+M)%60;	}	else	{	    H=13;	    M=0;	    H=H+(Time+M-120)/60;	    M=(Time+M-120)%60;	}	string s;	stringstream ss;	ss<<H<<":"<<M;	ss>>s;	return(s);    }    float fgetPrice(){return((float)Price/1000);}    float fgetCount(){return((float)Count/100);}        //手数    float fgetBuy(){return((float)Buy/1000);}    float fgetSell(){return((float)Sell/1000);}} __attribute__ ((packed));class ZStockInfo{public:    struct ZInfoMinutesStruct Histroy0;    struct ZInfoMinutesStruct Histroy1;    struct ZInfoMinutesStruct Histroy2;    struct ZInfoMinutesStruct Histroy3;    struct ZInfoMinutesStruct Histroy4;    struct ZInfoMinutesStruct Histroy5;    struct ZInfoMinutesStruct Histroy6;    struct ZInfoMinutesStruct Histroy7;    struct ZInfoMinutesStruct Histroy8;    struct ZInfoMinutesStruct Histroy9;    struct ZInfoMinutesStruct Histroy10;        unsigned short int  currentTime;     //00E4    unsigned int NowShou; //00E6 现手  股数    unsigned int OutStock;  //00EA  外盘  股数    unsigned int InStock;   //  00EE 内盘   股数    unsigned int OpenPrice; //00F2     开盘    unsigned int HighPrice; //00F6      最高    unsigned int LowPrice; //00FA	   最低    unsigned int Price;  //00FE        成交    unsigned int AllCount;   //0102   总手    unsigned int ZhongLiang;  //0106   成交量  (元)    ZMinutesStruct Buy1;    //010A        ZMinutesStruct Buy2;     ZMinutesStruct Buy3;     ZMinutesStruct Sell1;     ZMinutesStruct Sell2;     ZMinutesStruct Sell3;     unsigned short int UNKNOW1 ;   //013A    unsigned int UNKNOW2;          //013C    ZMinutesStruct Buy4;     ZMinutesStruct Buy5;     ZMinutesStruct Sell4;     ZMinutesStruct Sell5; public:    ZStockInfo(ZStockInfo* data)    {	for(unsigned  int i=0;i<sizeof(ZStockInfo);i++)	{	    *(((unsigned char*)this)+i)= *(((unsigned char*)data)+i);	}    }    float fgetWeiC()    {	long int buy,sell;	buy=Buy1.getCount()+Buy2.getCount()+Buy3.getCount()+Buy4.getCount()+Buy5.getCount();	sell=Sell1.getCount()+Sell2.getCount()+Sell3.getCount()+Sell4.getCount()+Sell5.getCount();	return((float)((buy-sell)/100));    }    float fgetWeiR()    {	long int buy,sell;	buy=Buy1.getCount()+Buy2.getCount()+Buy3.getCount()+Buy4.getCount()+Buy5.getCount();	sell=Sell1.getCount()+Sell2.getCount()+Sell3.getCount()+Sell4.getCount()+Sell5.getCount();	return(((float)(buy-sell))/(buy+sell));    }    float fgetBuy(){return(Histroy9.fgetBuy());}    float fgetSell(){return(Histroy9.fgetSell());}    float fgetPrice(){return((float)Price/1000);}    float fgetOpen(){return((float)OpenPrice/1000);}    float fgetHigh(){return((float)HighPrice/1000);}    float fgetLow(){return((float)LowPrice/1000);}        float fgetDelta(){return(fgetPrice()-fgetOpen());}    float fgetDelta(float f){return(fgetPrice()-f);}    float fgetFD(){return(fgetDelta()/fgetOpen());}    float fgetZhongShou(){return((float)AllCount/100);}    float fgetXianShou(){return((float)NowShou/100);}    float fgetInStock(){return((float)InStock/100);}    float fgetOutStock(){return((float)OutStock/100);}    ZInfoMinutesStruct* getHistroy(int i){return(((ZInfoMinutesStruct*)this)+i);}} __attribute__ ((packed));class ZIndexInfoDays{    unsigned int IndexA;     //001C   *1000    unsigned int IndexB;    //0020     *1000    unsigned int Open;      //0024    unsigned int High;      //0028    unsigned int  Low;       //002C    unsigned int  Index; //0030    unsigned int ShouShu;  //0034    unsigned int  ChenJiao ; //0038    *100  万    unsigned short int  Up;   //003C    unsigned short int Down; //003E    unsigned short int unknow; //0040    unsigned int BuyShou;  //0042    unsigned int SellShou;  //0046public:    ZIndexInfoDays(ZIndexInfoDays* iif)    {	for (unsigned int i=0;i<sizeof(ZIndexInfoDays);i++)	{	    *(((unsigned char*)this)+i)=*(((unsigned char*)iif)+i);	}    }    float fgetIndex(){return((float)Index/1000);}    float fgetIndexA(){return((float)IndexA/1000);}    float fgetIndexB(){return((float)IndexB/1000);}    float fgetOpen(){return((float)Open/1000);}    float fgetHigh(){return((float)High/1000);}    float fgetLow(){return((float)Low/1000);}    float fgetShouShu(){return((float)ShouShu);}    float fgetChenJiao(){return((float)ChenJiao/100);}    int igetUp(){return(Up);}    int igetDown(){return(Down);}    float fgetBuyShou(){return((float)BuyShou);}    float fgetSellShou(){return((float)SellShou);}    float fgetWeiC(){return(fgetBuyShou()-fgetSellShou());}    float fgetWeiR(){return(fgetWeiC()/(fgetBuyShou()+fgetSellShou()));}    } __attribute__ ((packed));class ZStockInfoDaysTel{public:    unsigned int XianShou;           //0x1C    ZInfoMinutesStruct  Histroy0  ;//0x20    ZInfoMinutesStruct  Histroy1;  //0x32    ZInfoMinutesStruct  Histroy2 ; //0x44    ZInfoMinutesStruct  Histroy3 ; //0x56    ZInfoMinutesStruct  Histroy4;  //0x68    ZInfoMinutesStruct  Histroy5 ; //0x7A    ZInfoMinutesStruct  Histroy6 ; //0x8C    ZInfoMinutesStruct  Histroy7 ; //0x9E    ZInfoMinutesStruct  Histroy8 ; //0xB0    ZInfoMinutesStruct  Histroy9 ; //0xC2    ZInfoMinutesStruct  Current  ;//0xD4    unsigned int Open;		//0xE6    unsigned int High;		//0xEA    unsigned int Low;        	//0xEE    unsigned int Price;      //0f2  //成交    unsigned int ZhongShou;  //0xf6 //总手    unsigned int ZhongLiang; //0xfa //成交量    ZMinutesStruct Buy1;    //0xFE        ZMinutesStruct Buy2;     ZMinutesStruct Buy3;     ZMinutesStruct Sell1;     ZMinutesStruct Sell2;     ZMinutesStruct Sell3;     unsigned short int UNKNOW1 ;   //013A    unsigned int UNKNOW2;          //013C    ZMinutesStruct Buy4;     ZMinutesStruct Buy5;     ZMinutesStruct Sell4;     ZMinutesStruct Sell5; public:    ZStockInfoDaysTel(ZStockInfoDaysTel* data)    {	for(unsigned  int i=0;i<sizeof(ZStockInfoDaysTel);i++)	{	    *(((unsigned char*)this)+i)= *(((unsigned char*)data)+i);	}    }    float fgetWeiC()    {	long int buy,sell;	buy=Buy1.getCount()+Buy2.getCount()+Buy3.getCount()+Buy4.getCount()+Buy5.getCount();	sell=Sell1.getCount()+Sell2.getCount()+Sell3.getCount()+Sell4.getCount()+Sell5.getCount();	return((float)((buy-sell)/100));    }    float fgetWeiR()    {	long int buy,sell;	buy=Buy1.getCount()+Buy2.getCount()+Buy3.getCount()+Buy4.getCount()+Buy5.getCount();	sell=Sell1.getCount()+Sell2.getCount()+Sell3.getCount()+Sell4.getCount()+Sell5.getCount();	return(((float)(buy-sell))/(buy+sell));    }    float fgetBuy(){return(Current.fgetBuy());}    float fgetSell(){return(Current.fgetSell());}    float fgetPrice(){return((float)Price/1000);}    float fgetOpen(){return((float)Open/1000);}    float fgetHigh(){return((float)High/1000);}    float fgetLow(){return((float)Low/1000);}        float fgetDelta(){return(fgetPrice()-fgetOpen());}    float fgetDelta(float f){return(fgetPrice()-f);}    float fgetFD(){return(fgetDelta()/fgetOpen());}    float fgetZhongShou(){return((float)ZhongShou/100);}    float fgetXianShou(){return((float)XianShou/100);}    ZInfoMinutesStruct* getHistroy(int i){return(((ZInfoMinutesStruct*)this)+i);}} __attribute__ ((packed));#endif

⌨️ 快捷键说明

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