Example #1
0
        private void genSampleConfig()
        {
            SimulatorConfig config = new SimulatorConfig();
            SimulatorProduct mySimProduct = new SimulatorProduct();
            CannedData cannedData = new CannedData();
            K2DataObjects.Product myProduct = new K2DataObjects.Product();

            myProduct.Symbol = "EPZ8";
            myProduct.CFICode = "FXXXXX";
            myProduct.MMY = "20081219";
            myProduct.Exchange = "CME";
            myProduct.TradeVenue = "CQG";
            myProduct.Mnemonic = "EMINI";
            myProduct.LongName = "CME eMini SP500";
            myProduct.SecurityID = "ZPZ8";

            //mySimProduct.InstrDef = myProduct;
            mySimProduct.HighPrice = 99.99M;
            mySimProduct.LowPrice = 98.99M;
            mySimProduct.IsAutoFill = true;
            mySimProduct.IsCannedData = true;
            mySimProduct.RunAsMarket = true;
            mySimProduct.Mnemonic = "EPZ8";

            cannedData.CannedDataFile = "filepath";
            cannedData.RepeatOnEnd = true;
            cannedData.RunInterval = 100;
            cannedData.RunRealTime = true;
            cannedData.PlayOnSubscribe = true;

            mySimProduct.CannedData = cannedData;

            config.SimulatorProduct.Add(mySimProduct);

            string configData = JsonConvert.SerializeObject(config);

            //m_Config.
               // _config.ToXmlFile("KTSimConfigTEMP.xml");
        }
Example #2
0
        private void generateProductPrices(SimulatorProduct product)
        {
            try
            {
                K2DataObjects.PXUpdateBase pxupdate = new K2DataObjects.PXUpdateBase(m_ID);
                pxupdate.Mnemonic = product.Mnemonic;

                pxupdate.BidSize = m_RNGen.Next(100);
                pxupdate.OfferSize = m_RNGen.Next(100);
                pxupdate.BidPrice = product.LowPrice;
                pxupdate.OfferPrice = pxupdate.BidPrice + 1;
                pxupdate.TradePrice = ((pxupdate.BidPrice + pxupdate.OfferPrice) / 2);
                pxupdate.TradeVolume = (pxupdate.BidSize + pxupdate.OfferSize) / 2;
                pxupdate.DayHigh = product.HighPrice;
                pxupdate.DayLow = product.LowPrice;
                if (product.LowPrice != product.HighPrice)
                {
                    pxupdate.BidPrice = (int)product.LowPrice + m_RNGen.Next(10);
                    pxupdate.OfferPrice = pxupdate.BidPrice + 1;
                    pxupdate.TradePrice = ((pxupdate.BidPrice + pxupdate.OfferPrice) / 2);
                }

                pxupdate.Ticks = DateTime.Now.Ticks;

                PriceUpdate(pxupdate);

            }
            catch (Exception myE)
            {

            }
        }