// CPRobotDlg.h : Çì´õ ÆÄÀÏ // #pragma once #include "afxwin.h" #include "EventHandler.h" #include "OptionEventHandler.h" #include "Trader.h" #include #include #include using std::vector; using std::string; using std::ofstream; struct CP_BUYINFO { string m_Code; int m_iBoughtTime; float m_fBoughtPrice; float m_fHighestPrice; }; enum CP_STATE { CPS_WAIT=0, CPS_LOOKING, CPS_LOOKING_DEAL, CPS_BUYING, CPS_WAITING_SELL, CPS_SELLING }; // CCPRobotDlg ´ëÈ­ »óÀÚ class CCPRobotDlg : public CDialog, public IEventHandler { // »ý¼ºÀÔ´Ï´Ù. public: CCPRobotDlg(CWnd* pParent = NULL); // Ç¥ÁØ »ý¼ºÀÚÀÔ´Ï´Ù. // ´ëÈ­ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù. enum { IDD = IDD_CPROBOT_DIALOG }; afx_msg void OnBnClickedButtonRefreshBalance(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); afx_msg void OnBnClickedButtonStartDeal(); afx_msg void OnBnClickedButtonSearch(); afx_msg void OnBnClickedRadioBid(); afx_msg void OnBnClickedRadioAsk(); virtual void Received(); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Áö¿øÀÔ´Ï´Ù. virtual BOOL DestroyWindow(); // »ý¼ºµÈ ¸Þ½ÃÁö ¸Ê ÇÔ¼ö virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() void SaveToFile(void); void LoadFromFile(void); HICON m_hIcon; private: CP_STATE m_enState; CListBox m_ResultList; vector m_OpCodeList; ISysDibPtr m_pOpJpBid; CEventHandler m_EventHandler; string m_AccountNum; BOOL m_bSell; int m_iBalance; int m_iAmountSet; float m_fMinPriceSet; float m_fMaxPriceSet; int m_iPlusTick; float m_fLossCutTick; float m_fTrailingTick; int m_iCancelDelay; BOOL m_bPutOption; string m_CurCode; float m_fBoughtTick; float m_fHighestTick; float m_fCurTick; int m_iBoughtCnt; int m_iOrderNum; ATOM m_IdKeyFxCall; ATOM m_IdKeyFxPut; ofstream m_LogFile; void Subscribe(void); void Unsubscribe(void); void BuyThis(const string& Code, const float fBid1Price, const int iBid1Cnt, float afOfferPrice[5]); void CorrectToCurrent(const string& Code); void CPLog(const std::string fmt, ...); public: afx_msg void OnHotKey(UINT nHotKeyId, UINT nKey1, UINT nKey2); };