Пример #1
0
        public void AddEntry(MDEntry entry)
        {
            switch (entry.EntryType)
            {
            case MDEntryType.Buy:
                AddOffer(bids, entry);
                break;

            case MDEntryType.Sell:
                AddOffer(offers, entry);
                break;

            case MDEntryType.Trade:
                AddTrade(entry);
                break;

            case MDEntryType.Lop:
                Lop = entry.Size;
                if (trades.Count() > 0)
                {
                    trades.Last().Lop = Lop;
                }
                break;

            case MDEntryType.Vol:
                SessionVolume   = entry.Size;
                SessionTurnover = entry.Turnover;
                break;

            case MDEntryType.Index:
                SessionTurnover = entry.Turnover;
                break;

            case MDEntryType.Open:
                OpenPrice    = entry.Price;
                OpenTurnover = entry.Turnover;
                break;

            case MDEntryType.Close:
                ClosePrice    = entry.Price;
                CloseTurnover = entry.Turnover;
                break;

            case MDEntryType.High:
                HighPrice = entry.Price;
                break;

            case MDEntryType.Low:
                LowPrice = entry.Price;
                break;

            case MDEntryType.Ref:
                RefPrice = entry.Price;
                break;
            }
        }
Пример #2
0
		public void AddEntry(MDEntry entry)
		{
			switch (entry.EntryType)
			{
				case MDEntryType.Buy:
					AddOffer(bids, entry);
					break;
				case MDEntryType.Sell:
					AddOffer(offers, entry);
					break;
				case MDEntryType.Trade:
					AddTrade(entry);
					break;
				case MDEntryType.Lop:
					Lop = entry.Size;
					if (trades.Count() > 0)
						trades.Last().Lop = Lop;
					break;
				case MDEntryType.Vol:
					SessionVolume = entry.Size;
					SessionTurnover = entry.Turnover;
					break;
				case MDEntryType.Index:
					SessionTurnover = entry.Turnover;
					break;
				case MDEntryType.Open:
					OpenPrice = entry.Price;
					OpenTurnover = entry.Turnover;
					break;
				case MDEntryType.Close:
					ClosePrice = entry.Price;
					CloseTurnover = entry.Turnover;
					break;
				case MDEntryType.High:
					HighPrice = entry.Price;
					break;
				case MDEntryType.Low:
					LowPrice = entry.Price;
					break;
				case MDEntryType.Ref:
					RefPrice = entry.Price;
					break;
			}
		}
Пример #3
0
        private void AddOffer(List <Offer> list, MDEntry entry)
        {
            int   level = (int)entry.Level - 1;
            Offer offer = new Offer(entry.Price, entry.PriceStr, (uint)entry.Size, (uint)entry.Orders);

            if (list.Count > 0)
            {
                list[0] = offer;
            }
            else
            {
                list.Add(offer);
            }
            //switch (entry.UpdateAction) //TODO: UpdateAction - na razie nie jest przesyłane
            //{
            //    case MDUpdateAction.New: list.Insert(level, offer); break;
            //    case MDUpdateAction.Change: list[level] = offer; break;
            //    case MDUpdateAction.Delete: list.RemoveAt(level); break;
            //}
        }
Пример #4
0
        private void AddTrade(MDEntry entry)
        {
            Trade trade = new Trade(entry.DateTime, (decimal)entry.Price, entry.Size ?? 0, this.Lop);

            trades.Add(trade);
        }
Пример #5
0
		private void AddOffer(List<Offer> list, MDEntry entry)
		{
			int level = (int)entry.Level - 1;
			Offer offer = new Offer(entry.Price, entry.PriceStr, (uint)entry.Size, (uint)entry.Orders);
			if (list.Count > 0) list[0] = offer;
			else list.Add(offer);
			//switch (entry.UpdateAction) //TODO: UpdateAction - na razie nie jest przesyłane
			//{
			//    case MDUpdateAction.New: list.Insert(level, offer); break;
			//    case MDUpdateAction.Change: list[level] = offer; break;
			//    case MDUpdateAction.Delete: list.RemoveAt(level); break;
			//}
		}
Пример #6
0
		private void AddTrade(MDEntry entry)
		{
			Trade trade = new Trade(entry.DateTime, (decimal)entry.Price, entry.Size ?? 0, this.Lop);
			trades.Add(trade);
		}
Пример #7
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;
		}
Пример #8
0
		// funkcja pomocnicza konwertująca dane z Fixml.MDEntry na DTO.MarketTradeData
		private static MarketTradeData MarketData_GetTradeData(MDEntry entry)
		{
			var trade = new MarketTradeData();
			trade.Time = entry.DateTime;
			trade.Price = (decimal)entry.Price;
			trade.Quantity = entry.Size ?? 0;  // może być null dla notowań indeksów
			return trade;
		}
Пример #9
0
		// funkcja pomocnicza konwertująca dane z Fixml.MDEntry na DTO.MarketOfferData
		private static MarketOfferData MarketData_GetOfferData(MDEntry entry)
		{
			var offer = new MarketOfferData();
			offer.Level = (int)entry.Level;
			offer.Update = (entry.UpdateAction != MDUpdateAction.New);
			if (entry.UpdateAction != MDUpdateAction.Delete)
			{
				switch (entry.PriceStr)
				{
					case "PKC": offer.PriceType = PriceType.PKC; break;
					case "PCR": offer.PriceType = PriceType.PCR; break;
					case "PCRO": offer.PriceType = PriceType.PCRO; break;
				}
				offer.PriceLimit = entry.Price;
				offer.Volume = (uint)entry.Size;
				offer.Count = (uint)entry.Orders;
			}
			return offer;
		}
Пример #10
0
		// funkcja pomocnicza konwertująca obiekt Fixml.MDEntry na DTO.MarketData
		private static MarketData MarketData_GetData(MDEntry entry)
		{
			var data = new MarketData();
			data.Instrument = entry.Instrument.Convert();
			switch (entry.EntryType)
			{
				case MDEntryType.Buy: data.BuyOffer = MarketData_GetOfferData(entry); break;
				case MDEntryType.Sell: data.SellOffer = MarketData_GetOfferData(entry); break;
				case MDEntryType.Trade: data.Trade = MarketData_GetTradeData(entry); break;
				case MDEntryType.Lop: data.OpenInt = entry.Size; break;
				case MDEntryType.Vol:
				case MDEntryType.Open:
				case MDEntryType.Close:
				case MDEntryType.High:
				case MDEntryType.Low:
				case MDEntryType.Ref: data.Stats = MarketData_GetStatsData(entry); break;
				default: return null;   // pozostałe pomijamy
			}
			return data;
		}