Exemple #1
0
        public void Process(Order order)
        {
            Container container = ProcessContainers(bookRoot, order.Instrument, order, null);

            //container = ProcessContainers(container.ChildContainers, order.OrderType, order, container);
            if (container.ChildContainers.Exists(order.BuySell.ToString()) == false)
            {
                LeafContainer buyContainer  = new LeafContainer(this, "B", container);
                LeafContainer sellContainer = new LeafContainer(this, "S", container);
                container.ChildContainers["B"] = buyContainer;
                container.ChildContainers["S"] = sellContainer;
            }
            LeafContainer leafContainer = container.ChildContainers[order.BuySell.ToString()] as LeafContainer;

            leafContainer.ProcessOrder(order);
        }
Exemple #2
0
        //This method looks after the arrangement of order in order tree,
        //based on key attributes of the order it seeks appropriate node
        //in tree, in case if a node doesn’t exists it creates a new node
        //by instantiating the appropriate Container Class.
        //The logic deviates a bit when it comes to creation of leaf node of
        //the tree (i.e. Buy or Sell Node), we fallback to LeafContainer
        //class that is where the actual order is rested.
        public void Process(Order order)
        {
            Container container = ProcessContainers(bookRoot, order.Instrument, order, null);

            container = ProcessContainers(container.ChildContainers, order.OrderType, order, container);

            //Logic deviates a bit, if it is a buy or sell node
            //then leafcontainer is created which actually holds the order
            if (container.ChildContainers.Exists(order.BuySell.ToString()) == false)
            {
                //create buy and sell leaf container
                LeafContainer buyContainer  = new LeafContainer(this, "B", container);
                LeafContainer sellContainer = new LeafContainer(this, "S", container);
                container.ChildContainers["B"] = buyContainer;
                container.ChildContainers["S"] = sellContainer;
            }

            //Based on the buy/sell attribute of the order
            //access the underlying leaf container
            LeafContainer leafContainer = container.ChildContainers[order.BuySell.ToString()] as LeafContainer;

            //process the order
            leafContainer.ProcessOrder(order);
        }