public virtual List <DailyScanResultItem> DailyScanByWatch(int watchId, int tradingDate) { List <DailyScanResultItem> resultList = new List <DailyScanResultItem>(); List <int> ShareIdList = new WatchListDetailBLL(_unit).GetShareIdsByWatchID(watchId); this.startDate = tradingDate; var loadStart = DateHelper.DateToInt(DateHelper.IntToDate(tradingDate).AddDays(OFFSET_DAY * (-1))); foreach (int shareId in ShareIdList) { try { Entity.Indicator[] indList = scanCalculator.LoadIndicators(shareId, loadStart, tradingDate); PopulateExtendedIndicators(indList); int len = indList.Length; double entryPrice = -1; if (indList.Length > 0) { if (IsDailyScanMatched(null, indList, indList[len - 1], out entryPrice)) { DailyScanResultItem item = new DailyScanResultItem(); item.EntryPrice = entryPrice; item.IsMatch = true; item.ProcessDT = DateTime.Now; item.SetRef = GetSetRef(); item.ShareId = indList[len - 1].ShareId; item.TradingDate = indList[len - 1].TradingDate; resultList.Add(item); } } } catch (Exception ex) { LogHelper.Error(_log, string.Format("Error process daily scan {0}. ", shareId), ex); } } return(resultList); }
public List <int> GetShareListByDailyScan(DailyScan dailyScan) { List <int> shareIDs = new List <int>(); List <int> watchList = this.GetWtachLists(dailyScan); foreach (int w in watchList) { List <WatchListDetail> wdList = new WatchListDetailBLL(_unit).GetWatchListListByWatchID(w); foreach (WatchListDetail wd in wdList) { if (shareIDs.IndexOf(wd.ShareId) == -1) { shareIDs.Add(wd.ShareId); } } } return(shareIDs); }
public virtual List <StatScanResultItem> ScanWatchShares(int watchId, int startDate, int endDate) { List <StatScanResultItem> resultList = new List <StatScanResultItem>(); List <int> ShareIdList = new WatchListDetailBLL(_unit).GetShareIdsByWatchID(watchId); StatScanSetBLL ssBLL = new StatScanSetBLL(_unit); this.startDate = startDate; this.endDate = endDate; //RemoveTradeSimulatorOrders(); LoadIndex(startDate, endDate); StatScanSet sst = new StatScanSet() { WatchId = watchId, StartDate = startDate, EndDate = endDate, SetRef = GetSetRefName(), EntryLogic = GetEntryLogic(), Notes = GetNotes(), StartDt = DateTime.Now, }; ssBLL.Create(sst); foreach (int shareId in ShareIdList) { List <StatScanResultItem> shareResultList = ScanShare(sst, shareId, startDate, endDate); resultList.AddRange(shareResultList); } sst.CompleteDt = DateTime.Now; ssBLL.Update(sst); return(resultList); }