/// <summary> /// Constructor. /// </summary> /// <see cref="Message"/> /// <param name="message">Source message.</param> public MarketStateUpdateData(Message message) { Symbol = SymbolsContainer.GetSymbol(message.MarketId); MarketStateUpdateMessage marketStateUpdateMessage = message.MarketStateUpdateMsg.Clone(); MarketId = message.MarketId; Symbol symbol = SymbolsContainer.GetSymbol(MarketId); DailyStats = new List <DailyStatisticsData>(); foreach (DailyStatisticsMessage dailyStats in marketStateUpdateMessage.DailyStats) { DailyStatisticsData stats = new DailyStatisticsData(dailyStats); DailyStats.Add(stats); } DgtxToBasePrice = DWConverter.FromProtoDecimal(marketStateUpdateMessage.DgtxToBasePrice); FundingInterval = marketStateUpdateMessage.FundingInterval; PayoutPerContract = DWConverter.FromProtoDecimal(marketStateUpdateMessage.PayoutPerContract); EventTimestamp = DWConverter.FromLongDateTime(marketStateUpdateMessage.EventTimestamp); FundingRate = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FundingRate); FundingTime = marketStateUpdateMessage.FundingTime; FutureCount = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FutureCount); FutureValue = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FutureValue); ImpactAskCount = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactAskCount); ImpactAskValue = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactAskValue); ImpactBaseQuantity = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBaseQuantity); ImpactBidCount = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBidCount); ImpactBidValue = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBidValue); ImpactQuantity = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactQuantity); ImpactValue = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactValue); LastTradePrice = DWConverter.FromProtoDecimal(marketStateUpdateMessage.LastTradePrice); LastTradeQuantity = DWConverter.FromProtoDecimal(marketStateUpdateMessage.LastTradeQuantity); Ohlcvs = new List <OHLCVData>(); foreach (OHLCVMessage ohlcv in marketStateUpdateMessage.Ohlcvs) { OHLCVData ohlc = new OHLCVData(ohlcv); Ohlcvs.Add(ohlc); } SpotPrice = DWConverter.FromProtoDecimal(marketStateUpdateMessage.SpotPrice); Trades = new List <Trade>(); foreach (TradeMessage trade in marketStateUpdateMessage.Trades) { Trade tTrade = new Trade(trade, symbol); Trades.Add(tTrade); } }
/// <summary> /// Constructor. /// </summary> /// <see cref="Message"/> /// <param name="message">Surce message.</param> public MarketStateData(Message message) { Symbol = SymbolsContainer.GetSymbol(message.MarketId); MarketStateMessage marketStateMessage = message.MarketStateMsg.Clone(); MarketId = message.MarketId; ContractValue = DWConverter.FromProtoDecimal(marketStateMessage.ContractValue); DailyStats = new List <DailyStatisticsData>(); foreach (DailyStatisticsMessage dailyStats in marketStateMessage.DailyStats) { DailyStatisticsData stats = new DailyStatisticsData(dailyStats); DailyStats.Add(stats); } EventTimestamp = DWConverter.FromLongDateTime(marketStateMessage.EventTimestamp); FundingRate = DWConverter.FromProtoDecimal(marketStateMessage.FundingRate); FundingTime = marketStateMessage.FundingTime; LastTradePrice = DWConverter.FromProtoDecimal(marketStateMessage.LastTradePrice); LastTradeQuantity = DWConverter.FromProtoDecimal(marketStateMessage.LastTradeQuantity); NextFundingRate = DWConverter.FromProtoDecimal(marketStateMessage.NextFundingRate); Ohlcvs = new List <OHLCVData>(); foreach (OHLCVMessage ohlcv in marketStateMessage.Ohlcvs) { OHLCVData ohlc = new OHLCVData(ohlcv); Ohlcvs.Add(ohlc); } TickPrice = DWConverter.FromProtoDecimal(marketStateMessage.TickPrice); TickValue = DWConverter.FromProtoDecimal(marketStateMessage.TickValue); Trades = new List <Trade>(); foreach (TradeMessage trade in marketStateMessage.Trades) { Trade tTrade = new Trade(trade, SymbolsContainer.GetSymbol(MarketId)); Trades.Add(tTrade); } FundingInterval = marketStateMessage.FundingInterval; PayoutPerContract = DWConverter.FromProtoDecimal(marketStateMessage.PayoutPerContract); }