Example #1
0
        public void newPriceQuote(Object a)
        {
            while (true)
            {
                newQuote.WaitOne(10000, false);

                LeafContainer buyBook  = this.parentContainer.ChildContainers["B"] as LeafContainer;
                LeafContainer sellBook = this.parentContainer.ChildContainers["S"] as LeafContainer;

                if (buyBook != null && sellBook != null)
                {
                    if (buyBook.OrderQuote() == "" || sellBook.OrderQuote() == "")
                    {
                        Console.WriteLine("No price");
                    }

                    string buyBookQuote  = buyBook.OrderQuote();
                    string sellBookQuote = sellBook.OrderQuote();

                    //currentPrice = buyBookQuote == "N/A" ? Convert.ToDouble(sellBookQuote) : sellBookQuote == "N/A" ?
                    //    Convert.ToDouble(buyBookQuote) : (Convert.ToDouble(buyBook.OrderQuote()) + Convert.ToDouble(sellBook.OrderQuote())) / 2.0;

                    XElement xml = new XElement("Method");
                    xml.Add(new XAttribute("PriceQuote", "RSXM"));
                    xml.Add(new XElement("Field", new XAttribute("Name", "Buy"), buyBookQuote),
                            new XElement("Field", new XAttribute("Name", "Sell"), sellBookQuote));


                    string quote = this.parentContainer.contName + "," + buyBook.OrderQuote() + "," + sellBook.OrderQuote();
                    Exchange.QuoteSender.sendQuote(xml.ToString());
                }
                newQuote.Reset();
            }
        }
Example #2
0
        public Order CurrentPrice(string Instrument, string BuySell)
        {
            //Order curPrice = bookRoot[Instrument].ChildContainers["Regular"].ChildContainers["B"];
            LeafContainer leafContainer = bookRoot[Instrument].ChildContainers[BuySell] as LeafContainer;

            Order curOrder = leafContainer.OrderQuote();

            return(curOrder);
        }
Example #3
0
        public void newPriceQuote(Object a)
        {
            while (true)
            {
                newQuote.WaitOne(10000, false);

                LeafContainer buyBook  = this.parentContainer.ChildContainers["B"] as LeafContainer;
                LeafContainer sellBook = this.parentContainer.ChildContainers["S"] as LeafContainer;

                if (buyBook != null && sellBook != null)
                {
                    if (buyBook.OrderQuote() == "" || sellBook.OrderQuote() == "")
                    {
                        Console.WriteLine("No price");
                    }
                    string quote = this.parentContainer.contName + "," + buyBook.OrderQuote() + "," + sellBook.OrderQuote();
                    Exchange.QuoteSender.sendQuote(quote);
                }
                newQuote.Reset();
            }
        }