private async Task <RealTimeData> Filter(string stockId) { using (var scope = _serviceScopeFactory.CreateScope()) { var scopedServices = scope.ServiceProvider; var db = scopedServices.GetRequiredService <BlogContext>(); var helper = new Utils.Utility(db); float marketLow = _arg.MarketLow; float marketHigh = _arg.MarketHigh; RealTimeData ret = null; var realData = await helper.GetRealTimeDataWithDate(stockId, _arg.BaseDate); if (realData != null && realData.ZongShiZhi != null) { if (marketLow * 1e8 <= realData.LiuTongShiZhi && realData.LiuTongShiZhi <= marketHigh * 1e8) { ret = realData; } } //如果是null,表示不符合筛选条件 return(ret);; } }
private async Task <RealTimeData> Filter(string stockId) { using (var scope = _serviceScopeFactory.CreateScope()) { var scopedServices = scope.ServiceProvider; var db = scopedServices.GetRequiredService <StockContext>(); var helper = new Utils.Utility(db); float low = _arg.TurnOverRateLow; float high = _arg.TurnOverRateHigh; RealTimeData ret = null; var realData = await helper.GetRealTimeDataWithDate(stockId, _arg.BaseDate); if (realData != null) { var zhibiao = realData.HuanShouLiu; if (zhibiao != null) { if (low <= zhibiao && zhibiao <= high) { ret = realData; } } } //如果是null,表示不符合筛选条件 return(ret);; } }