Esempio n. 1
0
        private static async Task HandleMessage(string msg)
        {
            Console.WriteLine(msg);
            Console.WriteLine("----");
            var contract = Newtonsoft.Json.JsonConvert.DeserializeObject <IndexInformationContract>(msg);

            await _informationRepository.UpdateAsync(contract);

            var result    = new List <IBidAsk>();
            var newBitAsk = BidAsk.Create(contract.AssetPair, contract.Bid, contract.Timestamp);

            result.Add(newBitAsk);
            result.AddRange(contract.AssetsInfo.Select(assetInfo => BidAsk.Create(assetInfo.AssetId, assetInfo.Price, contract.Timestamp)));


            var items = result.ToArray();
            await BidAskHistoryWriter.UpdateAsync(items);

            await BidAskWriter.UpdateAsync(items);
        }