Beispiel #1
0
        public Dictionary <string, InstrumentBidAskPairContract> InitPrices([FromBody] InitPricesBackendRequest request)
        {
            IEnumerable <KeyValuePair <string, InstrumentBidAskPair> > allQuotes = _quoteCacheService.GetAllQuotes();

            if (request.AssetIds != null && request.AssetIds.Any())
            {
                allQuotes = allQuotes.Where(q => request.AssetIds.Contains(q.Key));
            }

            return(allQuotes.ToDictionary(q => q.Key, q => q.Value.ToBackendContract()));
        }
Beispiel #2
0
        public async Task <Dictionary <string, BidAskClientContract> > InitPrices(string clientId = null, string[] assetIds = null)
        {
            var request = new InitPricesBackendRequest {
                ClientId = clientId, AssetIds = assetIds
            };

            var initPricesResponse = await _httpRequestService
                                     .RequestWithRetriesAsync <Dictionary <string, InstrumentBidAskPairContract> >(request, "init.prices");

            return(initPricesResponse.ToDictionary(p => p.Key, p => p.Value.ToClientContract()));
        }
Beispiel #3
0
        public Task <Dictionary <string, BestPriceContract> > GetBestFxAsync(
            [FromBody] InitPricesBackendRequest request)
        {
            IEnumerable <KeyValuePair <string, InstrumentBidAskPair> > allQuotes = _fxRateCacheService.GetAllQuotes();

            if (request.AssetIds != null && request.AssetIds.Any())
            {
                allQuotes = allQuotes.Where(q => request.AssetIds.Contains(q.Key));
            }

            return(Task.FromResult(allQuotes.ToDictionary(q => q.Key, q => q.Value.ConvertToContract())));
        }