Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Strategy Strategy1 = new Strategy("LNV2016Z2016Q2016V2016", "FuturesButterfly");
            //Strategy Strategy2 = new Strategy("CU2017Z2017N2017U2017", "FuturesButterfly");



            //Console.WriteLine(table.Rows[0]["ticker1"]);
            //Console.WriteLine(table.Rows[0]["ticker2"]);
            //Console.WriteLine(table.Rows[0]["ticker3"]);

            //Instrument Instrument1 = new Instrument(table.Rows[0]["ticker1"].ToString(), "F", null, null);
            //Instrument Instrument2 = new Instrument(table.Rows[0]["ticker2"].ToString(), "F", null, null);
            //Instrument Instrument3 = new Instrument(table.Rows[0]["ticker3"].ToString(), "F", null, null);

            //InstumentSpecs InstrumentSpecs1 = Instrument.GetSpecs(Instrument1.Ticker);
            //InstumentSpecs InstrumentSpecs2 = Instrument.GetSpecs(Instrument2.Ticker);
            // InstrumentSpecs3 = Instrument.GetSpecs(Instrument3.Ticker);

            string ttUserId   = "ekocatulum";
            string ttPassword = "******";

            TTAPIBasicFunctionality.TTAPIInitialize initialize = new TTAPIBasicFunctionality.TTAPIInitialize(ttUserId, ttPassword);



            FuturesButterflyPortfolio FutButtPort = new FuturesButterflyPortfolio();

            DataTable AllSheet = FutButtPort.SpreadSheet.Tables["All"];

            //List<string> s = AllSheet.AsEnumerable().Select(x => x["tickerHead"].ToString()).ToList();

            var s = AllSheet.AsEnumerable().Select(x => x["tickerHead"].ToString());

            var s2 = s.Distinct().ToList();

            Console.WriteLine(TA.TickerheadConverters.ConversionFromTT2DB["IPE e-Brent"].ToString());

            Console.WriteLine(TA.TickerheadConverters.ConversionFromTT2DB.FirstOrDefault(x => x.Value == "B").Key);



            // Check that the compiler settings are compatible with the version of TT API installed
            TTAPIArchitectureCheck archCheck = new TTAPIArchitectureCheck();

            if (archCheck.validate())
            {
                Console.WriteLine("Architecture check passed.");

                // Dictates whether TT API will be started on its own thread
                bool startOnSeparateThread = false;

                if (startOnSeparateThread)
                {
                    // Start TT API on a separate thread
                    TTAPIFunctions tf           = new TTAPIFunctions(ttUserId, ttPassword);
                    Thread         workerThread = new Thread(tf.Start);
                    workerThread.Name = "TT API Thread";
                    workerThread.Start();

                    // Insert other code here that will run on this thread
                }
                else
                {
                    // Start the TT API on the same thread
                    using (TTAPIFunctions tf = new TTAPIFunctions(ttUserId, ttPassword))
                    {
                        tf.Start();
                    }
                }
            }
            else
            {
                Console.WriteLine("Architecture check failed.  {0}", archCheck.ErrorString);
            }



            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {


            //Strategy Strategy1 = new Strategy("LNV2016Z2016Q2016V2016", "FuturesButterfly");
            //Strategy Strategy2 = new Strategy("CU2017Z2017N2017U2017", "FuturesButterfly");

            

            //Console.WriteLine(table.Rows[0]["ticker1"]);
            //Console.WriteLine(table.Rows[0]["ticker2"]);
            //Console.WriteLine(table.Rows[0]["ticker3"]);

            //Instrument Instrument1 = new Instrument(table.Rows[0]["ticker1"].ToString(), "F", null, null);
            //Instrument Instrument2 = new Instrument(table.Rows[0]["ticker2"].ToString(), "F", null, null);
            //Instrument Instrument3 = new Instrument(table.Rows[0]["ticker3"].ToString(), "F", null, null);

            //InstumentSpecs InstrumentSpecs1 = Instrument.GetSpecs(Instrument1.Ticker);
            //InstumentSpecs InstrumentSpecs2 = Instrument.GetSpecs(Instrument2.Ticker);
            // InstrumentSpecs3 = Instrument.GetSpecs(Instrument3.Ticker);

            string ttUserId = "ekocatulum";
            string ttPassword = "******";

            TTAPIBasicFunctionality.TTAPIInitialize initialize = new TTAPIBasicFunctionality.TTAPIInitialize(ttUserId, ttPassword);





            FuturesButterflyPortfolio FutButtPort = new FuturesButterflyPortfolio();

            DataTable AllSheet = FutButtPort.SpreadSheet.Tables["All"];

            //List<string> s = AllSheet.AsEnumerable().Select(x => x["tickerHead"].ToString()).ToList();

            var s = AllSheet.AsEnumerable().Select(x => x["tickerHead"].ToString());

            var s2 = s.Distinct().ToList();

            Console.WriteLine(TA.TickerheadConverters.ConversionFromTT2DB["IPE e-Brent"].ToString());

            Console.WriteLine(TA.TickerheadConverters.ConversionFromTT2DB.FirstOrDefault(x => x.Value == "B").Key);

            

            // Check that the compiler settings are compatible with the version of TT API installed
            TTAPIArchitectureCheck archCheck = new TTAPIArchitectureCheck();
            if (archCheck.validate())
            {
                Console.WriteLine("Architecture check passed.");

                // Dictates whether TT API will be started on its own thread
                bool startOnSeparateThread = false;

                if (startOnSeparateThread)
                {
                    // Start TT API on a separate thread
                    TTAPIFunctions tf = new TTAPIFunctions(ttUserId, ttPassword);
                    Thread workerThread = new Thread(tf.Start);
                    workerThread.Name = "TT API Thread";
                    workerThread.Start();

                    // Insert other code here that will run on this thread
                }
                else
                {
                    // Start the TT API on the same thread
                    using (TTAPIFunctions tf = new TTAPIFunctions(ttUserId, ttPassword))
                    {
                        tf.Start();
                    }
                }
            }
            else
            {
                Console.WriteLine("Architecture check failed.  {0}", archCheck.ErrorString);
            }


   
            



  
            Console.ReadLine();

   
        }