예제 #1
0
        public void OnNewQuote(IFIXInstrument instrument, Quote quote)
        {
            if (!this.Enabled)
            {
                return;
            }
            double price;
            int    size;

            switch (this.Input)
            {
            case BarFactoryInput.Bid:
                price = quote.Bid;
                size  = quote.BidSize;
                break;

            case BarFactoryInput.Ask:
                price = quote.Ask;
                size  = quote.AskSize;
                break;

            case BarFactoryInput.BidAsk:
                this.AddTrade(instrument, DateTime.Now, quote.Bid, quote.BidSize);
                this.AddTrade(instrument, DateTime.Now, quote.Ask, quote.AskSize);
                return;

            case BarFactoryInput.Middle:
                this.AddTrade(instrument, DateTime.Now, (quote.Ask + quote.Bid) / 2.0, (quote.AskSize + quote.BidSize) / 2);
                return;

            case BarFactoryInput.Spread:
                price = quote.Ask - quote.Bid;
                size  = 0;
                break;

            default:
                return;
            }
            BarFactory.mU5OEr88NSmCpsBxeD u5Oer88NsmCpsBxeD = this.cqyLFWMOvs[instrument] as BarFactory.mU5OEr88NSmCpsBxeD;
            if (u5Oer88NsmCpsBxeD == null)
            {
                u5Oer88NsmCpsBxeD = new BarFactory.mU5OEr88NSmCpsBxeD();
                this.cqyLFWMOvs.Add(instrument, u5Oer88NsmCpsBxeD);
            }
            if (price == u5Oer88NsmCpsBxeD.price && size == u5Oer88NsmCpsBxeD.size)
            {
                return;
            }
            this.AddTrade(instrument, DateTime.Now, price, size);
            u5Oer88NsmCpsBxeD.price = price;
            u5Oer88NsmCpsBxeD.size  = size;
        }
예제 #2
0
파일: BarFactory.cs 프로젝트: heber/FreeOQ
		public void OnNewQuote(IFIXInstrument instrument, Quote quote)
		{
			if (!this.Enabled)
				return;
			double price;
			int size;
			switch (this.Input)
			{
				case BarFactoryInput.Bid:
					price = quote.Bid;
					size = quote.BidSize;
					break;
				case BarFactoryInput.Ask:
					price = quote.Ask;
					size = quote.AskSize;
					break;
				case BarFactoryInput.BidAsk:
					this.AddTrade(instrument, DateTime.Now, quote.Bid, quote.BidSize);
					this.AddTrade(instrument, DateTime.Now, quote.Ask, quote.AskSize);
					return;
				case BarFactoryInput.Middle:
					this.AddTrade(instrument, DateTime.Now, (quote.Ask + quote.Bid) / 2.0, (quote.AskSize + quote.BidSize) / 2);
					return;
				case BarFactoryInput.Spread:
					price = quote.Ask - quote.Bid;
					size = 0;
					break;
				default:
					return;
			}
			BarFactory.mU5OEr88NSmCpsBxeD u5Oer88NsmCpsBxeD = this.cqyLFWMOvs[instrument] as BarFactory.mU5OEr88NSmCpsBxeD;
			if (u5Oer88NsmCpsBxeD == null)
			{
				u5Oer88NsmCpsBxeD = new BarFactory.mU5OEr88NSmCpsBxeD();
				this.cqyLFWMOvs.Add(instrument, u5Oer88NsmCpsBxeD);
			}
			if (price == u5Oer88NsmCpsBxeD.price && size == u5Oer88NsmCpsBxeD.size)
				return;
			this.AddTrade(instrument, DateTime.Now, price, size);
			u5Oer88NsmCpsBxeD.price = price;
			u5Oer88NsmCpsBxeD.size = size;
		}