public List <PriceLevelDto> Calculate(List <Candle> candles, int pivotCount) { _logId = _batchLog.Start(); _batchLog.Update(_logId, "Start Pivot Level High"); var priceLevels = new List <PriceLevelDto>(); foreach (var candle in candles) { var pastPivotHigh = PivotHigh(candle, candle.PastCandles, pivotCount); var futurePivotHigh = PivotHigh(candle, candle.FutureCandles, pivotCount); if (!pastPivotHigh || !futurePivotHigh) { //_batchLog.Update(_logId, $"Missing PastPivotHigh:{pastPivotHigh} FuturePivotHigh:{futurePivotHigh}"); continue; } _batchLog.Update(_logId, $"PivotHigh found: {candle.TimeFrame} {candle.TimeStamp}"); var p = new PriceLevelDto() { TimeStamp = candle.TimeStamp, Granularity = candle.TimeFrame, Market = candle.Market, Active = true, AskPrice = candle.Top().Ask, AskPriceRange = candle.High.Ask, BidPrice = candle.Top().Bid, BidPriceRange = candle.High.Bid, Strategy = "PIVOT HIGH " + pivotCount, BuySell = "SELL", CandleType = candle.BodyFillRate().ToString(CultureInfo.InvariantCulture), LastUpdated = DateTime.Now }; priceLevels.Add(p); } _logger.LogInformation(_batchLog.Print(_logId)); return(priceLevels); }
public async Task Add(PriceLevelDto value) { await Clients.All.Add(value); }
public async Task Update(PriceLevelDto value) { await Clients.All.Update(value); }
public async Task Delete(PriceLevelDto value) { await Clients.All.Delete(value); }
public Task Update(PriceLevelDto level) { _logger.LogInformation($"Update received from TradeService {level}"); _context.Clients.All.SendAsync("Update", level); return(Task.CompletedTask); }
public Task Delete(PriceLevelDto level) { _context.Clients.All.SendAsync("Delete", level); return(Task.CompletedTask); }