Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>
        /// if one of sites return error, return error
        /// </returns>
        public static EERROR Ontick()
        {
            EERROR nRet = EERROR.NONE;
            EERROR nErr = EERROR.NONE;

            CFATCommon.m_dtCurTime = DateTime.Now;//For synchronize of all CSite.m_rates.time
            foreach (KeyValuePair <string, CSite> entry in CSiteMng.g_allSites)
            {
                nRet = entry.Value.OnTick();
                if (nRet != EERROR.NONE)
                {
                    nErr = nRet;
                }
            }

            return(nErr);
        }
Beispiel #2
0
        public bool OnTick()
        {
            EERROR nRet = CSiteMng.Ontick();

            if (nRet == EERROR.RATE_INVALID)
            {
                if (CFATManager.isOnlineMode())
                {
                    CFATLogger.output_proc("Invalid price!");
                }
                m_nInvalidTicks++;
                return(false);
            }
            if (nRet == EERROR.RATE_END)
            {
                CFATLogger.output_proc("Rates End!");
                m_nInvalidTicks = 10000;
                return(false); // For backtest mode, update tick data , if return false rates is end.
            }
            m_nInvalidTicks = 0;
            if (nRet != EERROR.NONE)
            {
                CFATLogger.output_proc("CSiteMng.Ontick() : Unknown Error!");
                return(false);
            }

            foreach (CLogic objLogic in m_lstLogics)
            {
                if (objLogic.OnTick() == (int)ETRADE_RET.NEWORDER)
                {
                    break;
                }
            }

            CSiteMng.process_ReqOrders();
            CSiteMng.process_ReqPosMatch();
            return(true);
        }