Ejemplo n.º 1
0
        /// <summary>
        ///  根据合约ID 判断是否交易时间
        /// </summary>
        /// <param name="time"></param>
        /// <param name="contractId"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public static bool IsTradingTimeByContractId(DateTime time, long contractId, bool defaultValue = true)
        {
            var contract = AllContractDao.Get(contractId);

            if (contract == null)
            {
                return(defaultValue);
            }
            if (!AllContractDao.IsIndustryIndexContract(contractId))
            {
                return(IsTradingTime(time, contract.VarietyID, defaultValue));
            }
            var tradeTimeRange = IndexOpenTimeDao.GetTimeRanges(contractId);

            return(IsTradingTime(time, tradeTimeRange, defaultValue));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据合约和当前时间 判断下个间隔时间
        /// </summary>
        /// <param name="time">当前时间</param>
        /// <param name="contractId">合约ID</param>
        /// <param name="minute">间隔分钟</param>
        /// <returns></returns>
        public static DateTime GetNextTime(DateTime time, long contractId, int minute)
        {
            var contract = AllContractDao.Get(contractId);

            if (contract == null)
            {
                return(DateTime.MinValue);
            }
            if (!AllContractDao.IsIndustryIndexContract(contractId))
            {
                return(VarietyDao.GetNextTime(time, contract.VarietyID, minute));
            }
            var tradeTimeRange = IndexOpenTimeDao.GetTimeRanges(contractId);

            return(VarietyDao.GetNextTimeByContractId(time, tradeTimeRange, contractId, minute));
        }