Beispiel #1
0
        private decimal GetAveragePrice()
        {
            // TODO: Add a BinanceApiOption property for this update delay seconds/milliseconds... ?
            if (_averagePrice == 0 || DateTime.UtcNow - _lastUpdate > TimeSpan.FromSeconds(1))
            {
                // TODO: Redesign price/quantity validation to use async methods rather than properties... ?
                _averagePrice = _api.GetAvgPriceAsync(_symbol).GetAwaiter().GetResult().Value; // HACK
                _lastUpdate   = DateTime.UtcNow;
            }

            return(_averagePrice);
        }