コード例 #1
0
        static byte[] GenerateNewOrderCross()
        {
            // This byte array is used for encoding and decoding, this is what you would send on the wire or save to disk
            var byteBuffer = new byte[4096];
            // You need to "wrap" the array with a DirectBuffer, this class is used by the generated code to read and write efficiently to the underlying byte array
            var directBuffer = new DirectBuffer(byteBuffer);
            int bufferOffset = 0;

            var MessageHeader = new SbeFIX.MessageHeader();
            var sno           = new NewOrderCross();

            // Before encoding a message we need to create a SBE header which specify what we are going to encode (this will allow the decoder to detect that it's an encoded 'car' object)
            // We will probably simplify this part soon, so the header gets applied automatically, but for now it's manual
            MessageHeader.Wrap(directBuffer, bufferOffset, Negotiate.SchemaVersion); // position the MessageHeader on the DirectBuffer, at the correct position
            MessageHeader.BlockLength = NewOrderCross.BlockLength;                   // size that a car takes on the wire
            MessageHeader.SchemaId    = NewOrderCross.SchemaId;
            MessageHeader.TemplateId  = NewOrderCross.TemplateId;                    // identifier for the car object (SBE template ID)
            MessageHeader.Version     = NewOrderCross.SchemaVersion;                 // this can be overriden if we want to support different versions of the car object (advanced functionality)

            // Now that we have encoded the header in the byte array we can encode the car object itself
            bufferOffset += SbeFIX.MessageHeader.Size;

            int carLength = NewOrderSingleExample.Encode(sno, directBuffer, bufferOffset);

            var byteBuffer2 = new byte[carLength];

            directBuffer.GetBytes(0, byteBuffer2, 0, carLength);
            return(byteBuffer2);
        }
コード例 #2
0
 /// <summary>
 /// Tratamento do New Order Cross - TODO [FF] - Verificar tratamento do Order Cross
 /// </summary>
 /// <param name="noc"></param>
 /// <param name="s"></param>
 public void OnMessage(NewOrderCross noc, SessionID s)
 {
     try
     {
         TODropCopyDB to = new TODropCopyDB();
         to.MensagemQF = noc;
         to.Sessao     = s;
         to.TipoMsg    = MsgType.NEWORDERCROSS;
         this._addMessage(to);
     }
     catch (Exception ex)
     {
         logger.Error("Problemas no processamento da mensagem de NewOrderCross: " + ex.Message, ex);
     }
 }
コード例 #3
0
 public virtual void onMessage(NewOrderCross message, QuickFix.SessionID session)
 {
     throw new QuickFix.UnsupportedMessageType();
 }
コード例 #4
0
        public static void ConsistirNovaOrdemCross(NewOrderCross noc, string exchange)
        {
            string strAccount1 = string.Empty;

            if (!noc.IsSetCrossID())
            {
                throw new ArgumentException("CrossID field must be provided");
            }

            if (!noc.IsSetCrossType())
            {
                throw new ArgumentException("CrossType field must be provided");
            }
            if (!noc.IsSetCrossPrioritization())
            {
                throw new ArgumentException("CrossPriorization field must be provided");
            }

            if (noc.IsSetNoSides() && noc.NoSides.getValue() == 2)
            {
                QuickFix.Group grpNoSides = noc.GetGroup(1, Tags.NoSides);
                OrdensConsistencia.ProcessGroupNOC(grpNoSides);
                grpNoSides = noc.GetGroup(2, Tags.NoSides);
                OrdensConsistencia.ProcessGroupNOC(grpNoSides);
            }

            // Instrument Identification Block
            if (string.IsNullOrEmpty(noc.Symbol.ToString()))
            {
                throw new ArgumentException("Symbol field must be provided");
            }

            if (exchange.Equals(ExchangePrefixes.BMF, StringComparison.InvariantCultureIgnoreCase))
            {
                if (string.IsNullOrEmpty(noc.SecurityID.ToString()))
                {
                    throw new ArgumentException("SecurityID field must be provided");
                }
            }

            OrdType ordType = noc.OrdType;

            if (ordType == null)
            {
                throw new ArgumentException("OrdType is invalid");
            }

            // Verifica envio do preco
            bool aux = false;

            switch (ordType.ToString()[0])
            {
            case OrdType.LIMIT:    // OrdemTipoEnum.Limitada:
                break;

            default:
                aux = true;
                break;
            }

            if (aux)
            {
                throw new ArgumentException("OrderType must be 2 - Limit");
            }

            if (noc.IsSetPrice())
            {
                if (noc.Price.getValue() <= new Decimal(0))
                {
                    throw new ArgumentException("Must must be >= 0");
                }
            }
        }