示例#1
0
文件: EOD.cs 项目: karlcc/qdms
        //Downloads data from EODData
        public async Task <IEnumerable <OHLCBar> > GetDataAsync(Instrument instrument, DateTime startDate, DateTime endDate)
        {
            IEnumerable <QUOTE>   prices = null;
            IEnumerable <OHLCBar> result = Enumerable.Empty <OHLCBar>();
            var code = new EODCode(instrument.Exchange.Name, instrument.Symbol);

            prices = await _service.GetPrices(code.Exchange, code.TickerSymbol, startDate, endDate);

            if (prices == null)
            {
                return(Enumerable.Empty <OHLCBar>());
            }

            result = prices
                     .Where(p => p.DateTime >= startDate && p.DateTime <= endDate)
                     .Select(p => new OHLCBar {
                DT = p.DateTime, Close = (decimal)p.Close
            });

            return(result);
        }
示例#2
0
 public bool TryResolve(string instrumentSymbol, out EODCode code)
 {
     code = Resolve(instrumentSymbol);
     return(code != null);
 }