コード例 #1
0
        internal Result <List <SecurityPrice> > GetSecurityPrices(DateTime date)
        {
            Maybe <TradeDate> tradeDate = _tradeDateRepository.GetTradeDate(date);

            if (tradeDate.HasValue)
            {
                return(GetSecurityPrices(tradeDate.Value));
            }
            else
            {
                return(Result.Failure <List <SecurityPrice> >(new InvalidTradeDateError(date)));
            }
        }
コード例 #2
0
        public Result <TradeDate> GetTradeDate(DateTime date)
        {
            var tradeDate = _tradeDateRepository.GetTradeDate(date.Date);

            return(tradeDate.Eval <Result <TradeDate> >(
                       (d) => Result.Success <TradeDate>(d),
                       () => Result.Failure <TradeDate>(new InvalidTradeDateError(date))));
        }