?? stock.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 + -