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

📄 stock.h

📁 MFC 写的股票软件。含注释
💻 H
字号:
typedef struct 
{
	BYTE	Type;
	union	ALLSTRUCT
	{
		struct INDEXANDSTOCK
		{
			char	Code[8];
			char	Name[10];
			DWORD	Close;
			DWORD	Open;
			DWORD	High;
			DWORD	Low;
			DWORD	New;
			DWORD	Pbuy1;
			float	Vbuy1;
			DWORD	Pbuy2;
			float	Vbuy2;
			DWORD	Pbuy3;
			float	Vbuy3;
			DWORD	Pbuy4;
			float	Vbuy4;
			DWORD	Psell1;
			float	Vsell1;
			DWORD	Psell2;
			float	Vsell2;
			DWORD	Psell3;
			float	Vsell3;
			DWORD	Psell4;
			float	Vsell4;
			float	Volume;
			float	Amount;
			float	Cjbs;
			DWORD	Syl;
			BYTE	Reserved[9];
		}IndexAndStock;
		struct DAYLINE
		{
			char	Code[8];
			BYTE	Records;
			struct DayK
			{
				time_t	Date;
				DWORD	Open;
				DWORD	High;
				DWORD	Low;
				DWORD	Close;
				float	Volume;
				float	Amount;
			}Record[4];
			char	Reserved[6];
		}DayLine;
		struct INFORMATION
		{
			BYTE	SubType;
			time_t	Time;
			WORD	Serial;
			BYTE	Proviter;
			WORD	Total;
			WORD	PacketNumber;
			WORD	InfoLength;
			char	Info[110];
			char	Reserved[3];
		}Information;
		struct TXTFILE
		{
			char	Name[100];
			BYTE	FileType;
			time_t	Time;
			char	Reserved[22];
		}TxtFile;
		struct MINUTE
		{
			char	Code[8];
			time_t	Time;
			BYTE	Records;
			struct MinRec
			{
				DWORD	Price;
				float	Volume;
				float	Amount;
			}Record[9];
			char	Reserved[6];
		}Minute;
		struct WIGHTINTEREST
		{
			char	Code[8];
			BYTE	Records;
			struct Wight
			{
				time_t	Time;
				DWORD	Give;
				DWORD	Pei;
				DWORD	PeiPrice;
				DWORD	Bonus;
			}Record[5];
			char	Reserved[18];
		}WightInterest;
	}AllStruct;
}MAINSTRUCT;

struct STOCK
{
	char StockCode[10];
	char StockName[20];
	float fNew;
	float fClose;
	float fOpen;
	float fLow;
	float fHigh;
	float fAmount;
	float fVolume;
	DWORD	Pbuy1;
	float	Vbuy1;
	DWORD	Pbuy2;
	float	Vbuy2;
	DWORD	Pbuy3;
	float	Vbuy3;
	DWORD	Pbuy4;
	float	Vbuy4;
	DWORD	Psell1;
	float	Vsell1;
	DWORD	Psell2;
	float	Vsell2;
	DWORD	Psell3;
	float	Vsell3;
	DWORD	Psell4;
	float	Vsell4;
};

struct KLine		//K线价格结构体
{	
	float fOpen;
	float fClose;
	float fLow;
	float fHigh;
};

struct KAmount		//K线成交金额结构体
{	
	float Amount;
};

struct KPoint		//K线价格对应坐标结构体
{	
	POINT high;
	POINT low;
	POINT open;
	POINT close;
};

struct KAmountPoint		//K线成交金额结构体
{	
	POINT top;
	POINT bottom;
};

class CMyApp : public CWinApp
{
public:
	CMyApp();
    virtual BOOL InitInstance();
};

class CMyFrame : public CWnd
{
public:
    CMyFrame();
	~CMyFrame();

protected:
	typedef unsigned int __stdcall INITCARD(HWND, UINT Msg);
	typedef void __stdcall ENABLEMESSAGE(BOOL flag);
	typedef int __stdcall RECEIVEINFO(void);
	typedef void __stdcall DATAACQUISITION(void*, int);
	//typedef int __stdcall READMYCOUNT(void);

protected:					//数据
	MAINSTRUCT				m_Data;					//整个的数据结构
	STOCK					m_Stock;
	HINSTANCE				m_hLibrary;				//类库句柄
	ENABLEMESSAGE*			m_EnableMessage;		//指向ENABLEMESSAGE(BOOL flag)函数的指针
	RECEIVEINFO*			m_ReceiveInfo;			//指向RECEIVEINFO(void)函数的指针
	DATAACQUISITION*		m_DataAcquisition;		//指向DATAACQUISITION(void*, int)函数的指针
	//READMYCOUNT*			m_MyCount;

	float	   Price[240];								//收到的价格
	int		   Point[240][2];                    	    //对应的坐标值
	int		   PointAver[240][2];						//加权平均线的点
	int		   m;										//横坐标(分钟数)
	float	   M;										//最大偏移量

	float	   VolLast;									//上一笔总成交量
	float	   VolThis;									//实时成交量(非总)
	float	   VolOffset;								//上次以前所有的成交量
	float	   VolMax;									//最大实时成交量
	//float	   VolLastDay;								//昨天总成交量
	float	   Vol[240];								//算出的成交量
	int		   VPoint[240][2];							//对应的成交量线坐标值

	BOOL	   bNExit;		                            //正常退出,是正常退出吗?
	BOOL	   bReStart;								//是重新开始的吗?
	BOOL	   bKLine;	                                //是K线吗?
	BOOL	   bCtrl;									//是否按了Ctrl键	

	CArray <KLine, KLine> KLineArray;					//K线价格数据
	CArray <KPoint, KPoint> KPointArray;				//K线坐标数据
	float	KHighMax;									//最大K线价格
	float	KLowMin;									//最小K线价格
	float	KDay;										//显示的总天数
	float	KM;											//最大最小价格之差
	float	KBegine;									//开始显示的K线索引	

	CArray <KAmount, KAmount> KAmountArray;						//K线成交金额数据
	CArray <KAmountPoint, KAmountPoint> KAmountPointArray;		//K线成交金额坐标数据
	float	KAmountMax;											//最大成交金额
	//float	KAmountLastDay;										//昨日成交金额

protected:
	void ExpandPackage(MAINSTRUCT Data);			//拆包函数
	void Exchange();								//"分时线" 价格到坐标值的转换
    void ExchangeA( int m );						//"分时线" 价格,成交量到加权平均线坐标的转换
	void ExchangeV();								//"分时线" 成交量到坐标值的转换
	void ExchangeK();								//"K线" 数据到坐标值的转换
	void ExchangeKAmount();							//"K线" 成交金额数据到坐标的转换

	void StoreDayLine();							//储存"分时线"数据
	void StoreKLine();								//储存"K线"数据
	void StoreKAmount();							//储存"K线"成交金额数据
	
	DWORD ReadDayLine();							//读取"分时线"数据
	DWORD ReadKLine();								//读取"K线"数据
	DWORD ReadKAmount();							//读取"K线"成交金额数据
	
	void ReStart();									//重新开始一天的DayLine
	
protected:					//消息映射
	afx_msg void OnCreate();
    afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
	afx_msg void OnKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags );
    afx_msg LRESULT OnIRQSTOCK(WPARAM wParam,LPARAM lParam);	//自定义消息
	afx_msg void OnDrawDayLine(WPARAM wParam,LPARAM lParam);	//自定义消息
    afx_msg void OnDrawKLine(WPARAM wParam,LPARAM lParam);
	afx_msg void OnDrawCommon(WPARAM wParam,LPARAM lParam);
	afx_msg void OnKLine();
    afx_msg void OnDayLine();

	DECLARE_MESSAGE_MAP()  
};








⌨️ 快捷键说明

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