コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 private void NotifyUpdate()
 {
     BarUpdated?.Invoke(Current);
     PriceUpdated?.Invoke(Current.Timestamp, HeikenAshiPriceOption.Close, Current.Close);
 }
コード例 #7
0
        public async void UpdatePrice()
        {
            Price = await API.GetCardPrice(this);

            PriceUpdated?.Invoke(this, this);
        }
コード例 #8
0
        private void OnPriceUpdateReceived(PriceUpdateMessageResponse response)
        {
            var priceUpdateModel = Mapper.Map <PriceUpdateModel>(response.Data.First());

            PriceUpdated?.Invoke(priceUpdateModel);
        }