private void PriceAction(long timeStamp, double closingPrice) { double closingPricePoint = closingPrice / _pricePoint; if (_lastClosingPrice == 0) { _lastClosingPrice = closingPrice; _lastClosingPricePoint = closingPricePoint; } else { double pricePointDelta = closingPricePoint - _lastClosingPricePoint; if (Math.Abs(pricePointDelta) + 1 >= _brickValue) { UpdatePool(timeStamp, _lastClosingPrice, closingPrice); _lastClosingPrice = closingPrice; _lastClosingPricePoint = closingPricePoint; } } BarUpdated?.Invoke(Current); PriceUpdated?.Invoke(Current.Timestamp, RenkoPriceOption.Low, Current.Close); }
public void Write(long timeStamp, double open, double high, double low, double close, double volume = 0) { var priceBar = (PriceBar)NextPoolItem; priceBar.Write(timeStamp, open, high, low, close, volume); MoveNext(); BarUpdated?.Invoke(Current); PriceUpdated?.Invoke(Current.Timestamp, PriceBarOption.Close, Current.Close); }
void _tick_Elapsed(object sender, ElapsedEventArgs e) { _tick.Stop(); foreach (var securityID in _prices.Keys.ToList()) { decimal change = (decimal)1 + _stockMovement.Next(-30, 30) * (decimal).0001; _prices[securityID] = _prices[securityID] * change; if (null != PriceUpdated) { PriceUpdated.Invoke(securityID, _prices[securityID]); } } _tick.Start(); }
public void Write(long timeStamp, double open, double high, double low, double close) { var ohlcBar = (OHLCBar)NextPoolItem; ohlcBar.Write(timeStamp, open, high, low, close); MoveNext(); if (_persistenceWriter != null) { _persistenceWriter.Append(ohlcBar.ToByteArray()); } BarUpdated?.Invoke(Current); PriceUpdated?.Invoke(Current.Timestamp, OHLCPriceOption.Close, Current.Close); }
public void Write(long timeStamp, double open, double high, double low, double close) { var CandlestickBar = (CandlestickBar)NextPoolItem; if (open > close) { CandlestickBar.Write(timeStamp, open, high, low, close, open - close, high - open, close - low, false); } else { CandlestickBar.Write(timeStamp, open, high, low, close, close - open, high - close, open - low, true); } MoveNext(); if (_persistenceWriter != null) { _persistenceWriter.Append(CandlestickBar.ToByteArray()); } BarUpdated?.Invoke(Current); PriceUpdated?.Invoke(Current.Timestamp, CandlestickPriceOption.Close, Current.Close); }
private void NotifyUpdate() { BarUpdated?.Invoke(Current); PriceUpdated?.Invoke(Current.Timestamp, HeikenAshiPriceOption.Close, Current.Close); }
public async void UpdatePrice() { Price = await API.GetCardPrice(this); PriceUpdated?.Invoke(this, this); }
private void OnPriceUpdateReceived(PriceUpdateMessageResponse response) { var priceUpdateModel = Mapper.Map <PriceUpdateModel>(response.Data.First()); PriceUpdated?.Invoke(priceUpdateModel); }