private StatScanSet GetNewScanSet(string setRef) { StatScanSet sst = new StatScanSet() { Id = -1, SetRef = setRef, EntryLogic = "", Notes = "", StartDt = DateTime.Now, }; return(sst); }
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); }
public List <StatScanResultItem> ScanShare(StatScanSet scanSet, int shareId, int startDate, int endDate) { TradeSimulateOrderBLL tsBll = new TradeSimulateOrderBLL(_unit); List <StatScanResultItem> resultItems = new List <StatScanResultItem>(); var loadStart = DateHelper.DateToInt(DateHelper.IntToDate(startDate).AddDays(OFFSET_DAY * (-1))); this.startDate = startDate; this.endDate = endDate; Entity.Indicator[] indList = scanCalculator.LoadIndicators(shareId, startDate, endDate); PopulateExtendedIndicators(indList); resultItems = GetMatchResult(indList); foreach (var item in resultItems) { item.StatScanSetId = scanSet.Id; tsBll.AddSOrder(item); } return(resultItems); }