public override void Start() { var orders = _marginTradingBlobRepository.Read <List <Order> >(LykkeConstants.StateBlobContainer, BlobName) ?? new List <Order>(); _orderCache.InitOrders(orders); base.Start(); }
public override void Start() { _quotes = _blobRepository .Read <Dictionary <string, InstrumentBidAskPair> >(LykkeConstants.StateBlobContainer, BlobName) ?.ToDictionary(d => d.Key, d => d.Value) ?? new Dictionary <string, InstrumentBidAskPair>(); base.Start(); }
public override void Start() { var state = _blobRepository.Read <Dictionary <string, OrderBook> >(LykkeConstants.StateBlobContainer, BlobName) ?.ToDictionary(d => d.Key, d => d.Value) ?? new Dictionary <string, OrderBook>(); using (_contextFactory.GetWriteSyncContext($"{nameof(OrderBookSaveService)}.{nameof(Start)}")) { _orderBookList.Init(state); } base.Start(); }
public override void Start() { var graphData = _blobRepository.Read <Dictionary <string, List <GraphBidAskPair> > >("prices", "graph") ?.ToDictionary(d => d.Key, d => d.Value) ?? new Dictionary <string, List <GraphBidAskPair> >(); if (graphData.Count > 0) { FixGraphData(graphData); _micrographCacheService.InitCache(graphData); } base.Start(); }
public override void Start() { var orders = _marginTradingBlobRepository.Read <List <Order> >(LykkeConstants.StateBlobContainer, BlobName) ?? new List <Order>(); orders.ForEach(o => { // migrate orders to add LegalEntity field // todo: can be removed once published to prod if (o.LegalEntity == null) { o.LegalEntity = _accountsCacheService.Get(o.ClientId, o.AccountId).LegalEntity; } }); _orderCache.InitOrders(orders); base.Start(); }
public override void Start() { _log.WriteInfo(nameof(QuoteCacheService), nameof(Start), "Quote cache init started."); var blobQuotes = _blobRepository .Read <Dictionary <string, InstrumentBidAskPair> >(LykkeConstants.StateBlobContainer, BlobName) ?.ToDictionary(d => d.Key, d => d.Value) ?? new Dictionary <string, InstrumentBidAskPair>(); _log.WriteInfo(nameof(QuoteCacheService), nameof(Start), $"{blobQuotes.Count} quotes read from blob."); var orderBooks = _externalOrderbookService.GetOrderBooks(); _log.WriteInfo(nameof(QuoteCacheService), nameof(Start), $"{orderBooks.Count} order books read from {nameof(IExternalOrderbookService)}."); var result = new Dictionary <string, InstrumentBidAskPair>(); foreach (var orderBook in orderBooks) { if (!blobQuotes.TryGetValue(orderBook.AssetPairId, out var quote) || orderBook.Timestamp > quote.Date) { result.Add(orderBook.AssetPairId, orderBook.GetBestPrice()); } } foreach (var remainsToAdd in blobQuotes.Keys.Except(result.Keys)) { var item = blobQuotes[remainsToAdd]; result.Add(item.Instrument, item); } _cache = result; _log.WriteInfo(nameof(QuoteCacheService), nameof(Start), $"Quote cache initialised with total {result.Count} items."); base.Start(); }