Пример #1
0
        protected async Task HandleOrdebookSnapshotAsync(string pair, DateTime timeStamp, IEnumerable <OrderBookItem> orders)
        {
            var orderBookSnapshot = new OrderBookSnapshot(ExchangeName, pair, timeStamp);

            orderBookSnapshot.AddOrUpdateOrders(orders);

            if (ExchangeConfiguration.SaveOrderBooksToAzure)
            {
                await OrderBookSnapshotsRepository.SaveAsync(orderBookSnapshot);
            }

            _orderBookSnapshots[pair] = orderBookSnapshot;

            await PublishOrderBookSnapshotAsync(pair);
        }
        protected async Task HandleOrderBookSnapshotAsync(string pair, DateTime timeStamp, IEnumerable <OrderBookItem> orders)
        {
            var orderBookSnapshot = new OrderBookSnapshot(ExchangeName, pair, timeStamp, Log, ExchangeConfiguration.SupportedCurrencySymbols);

            orderBookSnapshot.AddOrUpdateOrders(orders);
            if (await orderBookSnapshot.DetectNegativeSpread())
            {
                ScheduleSnapshotRefresh();
            }
            else
            {
                CancelSnapshotRefresh();
            }

            _orderBookSnapshots[pair] = orderBookSnapshot;
            await PublishOrderBookSnapshotAsync(pair);
        }
 protected bool TryGetOrderBookSnapshot(string pair, out OrderBookSnapshot orderBookSnapshot)
 {
     return(_orderBookSnapshots.TryGetValue(pair, out orderBookSnapshot));
 }