コード例 #1
0
 private void EmitChanged(MDSide side, MDOperation operation, int position)
 {
     if (this.Changed != null)
     {
         this.Changed(this, new OrderBookEventArgs(side, operation, position));
     }
 }
コード例 #2
0
ファイル: MarketDepth.cs プロジェクト: zhuzhenping/FreeOQ
 public MarketDepth(DateTime datetime, byte providerId, string marketMaker, string source, int position, MDOperation operation, MDSide side, double price, int size)
 {
     this.dateTime    = datetime;
     this.providerId  = providerId;
     this.MarketMaker = marketMaker;
     this.source      = source;
     this.position    = position;
     this.operation   = operation;
     this.side        = side;
     this.price       = price;
     this.size        = size;
 }
コード例 #3
0
        internal static BidAsk Convert(MDSide side)
        {
            switch (side)
            {
            case MDSide.Bid:
                return(BidAsk.Bid);

            case MDSide.Ask:
                return(BidAsk.Ask);

            default:
                throw new NotSupportedException(string.Format("MDSide is not supported - {0}", side));
            }
        }
コード例 #4
0
ファイル: MarketDepth.cs プロジェクト: zhuzhenping/FreeOQ
        public virtual void ReadFrom(BinaryReader reader)
        {
            byte num = reader.ReadByte();

            switch (num)
            {
            case (byte)1:
                this.dateTime    = new DateTime(reader.ReadInt64());
                this.MarketMaker = reader.ReadString();
                this.Source      = reader.ReadString();
                this.Side        = (MDSide)reader.ReadByte();
                this.Price       = Math.Round((double)reader.ReadSingle(), 4);
                this.Size        = reader.ReadInt32();
                this.ProviderId  = reader.ReadByte();
                this.Position    = -1;
                this.Operation   = MDOperation.Undefined;
                break;

            case (byte)2:
                this.dateTime    = new DateTime(reader.ReadInt64());
                this.MarketMaker = reader.ReadString();
                this.source      = reader.ReadString();
                this.side        = (MDSide)reader.ReadByte();
                this.price       = Math.Round((double)reader.ReadSingle(), 4);
                this.size        = reader.ReadInt32();
                this.providerId  = reader.ReadByte();
                this.position    = reader.ReadInt32();
                this.operation   = (MDOperation)reader.ReadByte();
                break;

            case (byte)3:
                this.dateTime    = new DateTime(reader.ReadInt64());
                this.MarketMaker = reader.ReadString();
                this.source      = reader.ReadString();
                this.side        = (MDSide)reader.ReadByte();
                this.price       = reader.ReadDouble();
                this.size        = reader.ReadInt32();
                this.providerId  = reader.ReadByte();
                this.position    = reader.ReadInt32();
                this.operation   = (MDOperation)reader.ReadByte();
                break;

            default:
                throw new Exception("" + (object)num);
            }
        }
コード例 #5
0
        private void EmitNewMarketDepth(Instrument instrument, DateTime datatime, int position, MDSide ask, double price, int size)
        {
            MDOperation insert = MDOperation.Update;
            if (MDSide.Ask == ask)
            {
                if (position >= instrument.OrderBook.Ask.Count)
                {
                    insert = MDOperation.Insert;
                }
            }
            else
            {
                if (position >= instrument.OrderBook.Bid.Count)
                {
                    insert = MDOperation.Insert;
                }
            }

            if (price != 0 && size != 0)
            {
                EmitNewMarketDepth(instrument, new MarketDepth(datatime, "", position, insert, ask, price, size));
            }
        }
コード例 #6
0
        private void EmitNewMarketDepth(Instrument instrument, DateTime datatime, int position, MDSide ask, double price, int size)
        {
            MDOperation insert = MDOperation.Update;

            if (MDSide.Ask == ask)
            {
                if (position >= instrument.OrderBook.Ask.Count)
                {
                    insert = MDOperation.Insert;
                }
            }
            else
            {
                if (position >= instrument.OrderBook.Bid.Count)
                {
                    insert = MDOperation.Insert;
                }
            }

            if (price != -1 && size != -1)
            {
                EmitNewMarketDepth(instrument, new MarketDepth(datatime, "", position, insert, ask, price, size));
            }
        }
コード例 #7
0
ファイル: OrderBook.cs プロジェクト: heber/FreeOQ
		private void EmitChanged(MDSide side, MDOperation operation, int position)
		{
			if (this.Changed != null)
				this.Changed(this, new OrderBookEventArgs(side, operation, position));
		}
コード例 #8
0
        private bool EmitNewMarketDepth(Instrument instrument, DateTime datatime, int position, MDSide ask, double price, int size)
        {
            bool        bRet   = false;
            MDOperation insert = MDOperation.Update;

            if (MDSide.Ask == ask)
            {
                if (position >= instrument.OrderBook.Ask.Count)
                {
                    insert = MDOperation.Insert;
                }
            }
            else
            {
                if (position >= instrument.OrderBook.Bid.Count)
                {
                    insert = MDOperation.Insert;
                }
            }

            if (price != 0 && size != 0)
            {
                EmitNewMarketDepth(instrument, new MarketDepth(datatime, "", position, insert, ask, price, size));
                bRet = true;
            }
            return(bRet);
        }
コード例 #9
0
 public OrderBookEventArgs(MDSide size, MDOperation operation, int position) : base()
 {
     this.Side      = size;
     this.Operation = operation;
     this.Position  = position;
 }
コード例 #10
0
		internal static BidAsk Convert(MDSide side)
		{
			switch (side)
			{
			case MDSide.Bid:
				return BidAsk.Bid;
			case MDSide.Ask:
				return BidAsk.Ask;
			default:
				throw new NotSupportedException(string.Format("MDSide is not supported - {0}", side));
			}
		}
コード例 #11
0
ファイル: OrderBookEventArgs.cs プロジェクト: heber/FreeOQ
        public OrderBookEventArgs(MDSide size, MDOperation operation, int position) : base()
		{
			this.Side = size;
			this.Operation = operation;
			this.Position = position;
		}
コード例 #12
0
ファイル: MarketDepth.cs プロジェクト: heber/FreeOQ
		public virtual void ReadFrom(BinaryReader reader)
		{
			byte num = reader.ReadByte();
			switch (num)
			{
				case (byte) 1:
					this.dateTime = new DateTime(reader.ReadInt64());
					this.MarketMaker = reader.ReadString();
					this.Source = reader.ReadString();
					this.Side = (MDSide)reader.ReadByte();
					this.Price = Math.Round((double)reader.ReadSingle(), 4);
					this.Size = reader.ReadInt32();
					this.ProviderId = reader.ReadByte();
					this.Position = -1;
					this.Operation = MDOperation.Undefined;
					break;
				case (byte) 2:
					this.dateTime = new DateTime(reader.ReadInt64());
					this.MarketMaker = reader.ReadString();
					this.source = reader.ReadString();
					this.side = (MDSide)reader.ReadByte();
					this.price = Math.Round((double)reader.ReadSingle(), 4);
					this.size = reader.ReadInt32();
					this.providerId = reader.ReadByte();
					this.position = reader.ReadInt32();
					this.operation = (MDOperation)reader.ReadByte();
					break;
				case (byte) 3:
					this.dateTime = new DateTime(reader.ReadInt64());
					this.MarketMaker = reader.ReadString();
					this.source = reader.ReadString();
					this.side = (MDSide)reader.ReadByte();
					this.price = reader.ReadDouble();
					this.size = reader.ReadInt32();
					this.providerId = reader.ReadByte();
					this.position = reader.ReadInt32();
					this.operation = (MDOperation)reader.ReadByte();
					break;
				default:
					throw new Exception("" + (object)num);
			}
		}
コード例 #13
0
ファイル: MarketDepth.cs プロジェクト: heber/FreeOQ
		public MarketDepth(DateTime datetime, string marketMaker, int position, MDOperation operation, MDSide side, double price, int size) : this(datetime, 0, marketMaker, String.Empty, position, operation, side, price, size)
		{

		}
コード例 #14
0
ファイル: MarketDepth.cs プロジェクト: heber/FreeOQ
		public MarketDepth(DateTime datetime, byte providerId, string marketMaker, string source, int position, MDOperation operation, MDSide side, double price, int size)
		{
			this.dateTime = datetime;
			this.providerId = providerId;
			this.MarketMaker = marketMaker;
			this.source = source;
			this.position = position;
			this.operation = operation;
			this.side = side;
			this.price = price;
			this.size = size;
		}
コード例 #15
0
ファイル: MarketDepth.cs プロジェクト: zhuzhenping/FreeOQ
 public MarketDepth(DateTime datetime, string marketMaker, int position, MDOperation operation, MDSide side, double price, int size) : this(datetime, 0, marketMaker, String.Empty, position, operation, side, price, size)
 {
 }