Пример #1
0
 // aktualizacja danych obiektu po odebraniu ich z sieci
 internal void Update(DTO.MarketStatsData data)
 {
     if (data.OpeningPrice.HasValue)
     {
         OpeningPrice    = data.OpeningPrice;
         OpeningTurnover = data.OpeningTurnover;
     }
     if (data.ClosingPrice.HasValue)
     {
         ClosingPrice    = data.ClosingPrice;
         ClosingTurnover = data.ClosingTurnover;
     }
     if (data.TotalVolume.HasValue)
     {
         TotalVolume   = (uint)data.TotalVolume;
         TotalTurnover = (decimal)data.TotalTurnover;
     }
     if (data.HighestPrice.HasValue)
     {
         HighestPrice = data.HighestPrice;
     }
     if (data.LowestPrice.HasValue)
     {
         LowestPrice = data.LowestPrice;
     }
     if (data.ReferencePrice.HasValue)
     {
         ReferencePrice = data.ReferencePrice;
     }
 }
Пример #2
0
		// funkcja pomocnicza konwertująca dane z Fixml.MDEntry na DTO.MarketStatsData
		private static MarketStatsData MarketData_GetStatsData(MDEntry entry)
		{
			var stats = new MarketStatsData();
			switch (entry.EntryType)
			{
				case MDEntryType.Vol:
					stats.TotalVolume = entry.Size;
					stats.TotalTurnover = entry.Turnover;
					break;
				case MDEntryType.Open:
					stats.OpeningPrice = entry.Price;
					stats.OpeningTurnover = entry.Turnover ?? 0;
					break;
				case MDEntryType.Close:
					stats.ClosingPrice = entry.Price;
					stats.ClosingTurnover = entry.Turnover ?? 0;
					break;
				case MDEntryType.High:
					stats.HighestPrice = entry.Price;
					break;
				case MDEntryType.Low:
					stats.LowestPrice = entry.Price;
					break;
				case MDEntryType.Ref:
					stats.ReferencePrice = entry.Price;
					break;
			}
			return stats;
		}