// CPRobotDlg.h : Çì´õ ÆÄÀÏ #pragma once #include "afxwin.h" #include "EventHandler.h" #include #include #include #include using std::vector; using std::map; using std::string; using std::ofstream; struct CP_UNITINFO { string m_Code; int m_iCnt; float m_fBoughtPrice; float m_fHighestPrice; CTime m_Time; int m_iOrderNum; CTime m_TestCurTime; }; struct CP_PRICEINFO { float m_afAskPrice[5]; float m_afBidPrice[5]; }; // CCPRobotDlg ´ëÈ­ »óÀÚ class CCPRobotDlg : public CDialog, public IEventHandlerSysDib, public IEventHandlerDib { // »ý¼ºÀÔ´Ï´Ù. public: CCPRobotDlg(CWnd* pParent = NULL); // Ç¥ÁØ »ý¼ºÀÚÀÔ´Ï´Ù. // ´ëÈ­ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù. enum { IDD = IDD_CPROBOT_DIALOG }; afx_msg void OnBnClickedButtonRefreshBalance(); afx_msg void OnBnClickedButtonStartDeal(); afx_msg void OnBnClickedButtonSearch(); afx_msg void OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2); afx_msg void OnTimer(UINT_PTR nIDEvent); virtual void ReceivedSysDib(); virtual void ReceivedDib(); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Áö¿øÀÔ´Ï´Ù. virtual BOOL DestroyWindow(); // »ý¼ºµÈ ¸Þ½ÃÁö ¸Ê ÇÔ¼ö virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg LRESULT OnBuy(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnSell(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnCancelOrder(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnWindUp(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() void SaveToFile(void); void LoadFromFile(void); HICON m_hIcon; private: CListBox m_ResultList; vector m_OpCodeList; CpSysDib::ISysDibPtr m_pOpJpBid; CEventHandlerSysDib m_EventHandlerSysDib; string m_AccountNum; int m_iBalance; int m_iAmountSet; float m_fMinPriceSet; float m_fMaxPriceSet; int m_iPlusTick; float m_fLossCutTick; float m_fTrailingTick; int m_iCancelDelay; int m_iWindUpDelay; int m_iWindUpTick; BOOL m_bBuyOnBid1; BOOL m_bPutOption; BOOL m_bLookingDeal; CTime m_DealStartT; vector m_BidOrderList; // ¸Å¼ö ¿äûÇÑ ¸®½ºÆ® //vector m_BidConclusionList; // ¸Å¼ö ü°áµÈ ¸®½ºÆ® vector m_AskOrderList; // ¸Åµµ ¿äûÇÑ ¸®½ºÆ® map m_CurPriceList; CRITICAL_SECTION m_CSBid; CRITICAL_SECTION m_CSAsk; CRITICAL_SECTION m_CSLog; CpDib::IDibPtr m_pCpFConclusion; CEventHandlerDib m_EventHandlerDib; ATOM m_IdKeyFxCall; ATOM m_IdKeyFxPut; ATOM m_IdKeyFxStop; ofstream m_LogFile; void Subscribe(void); void Unsubscribe(void); void BuyThis(const string& Code, const float fBid1Price, const int iBid1Cnt, float afAskPrice[5]); void SellThis(CP_UNITINFO& AskInfo); void WindUp(const CP_UNITINFO& Unit); void CancelOrder(const CP_UNITINFO& Unit); void CPLog(const string fmt, ...); public: afx_msg void OnBnClickedButton1(); afx_msg LRESULT OnBuyMsg(WPARAM wParam, LPARAM lParam); };