Esempio n. 1
0
        /// <summary>
        ///   取得即時報價服務
        /// </summary>
        /// <param name="quoteServiceInformation">報價服務資訊</param>
        /// <returns>返回值: AbstractQuoteService 報價服務抽象類別</returns>
        public AbstractQuoteService GetQuoteService(QuoteServiceInformation quoteServiceInformation)
        {
            AbstractQuoteService cQuoteService = null;
            string sDataSource = quoteServiceInformation.DataSource;

            if (sDataSource == null)
            {
                string   sFilename = Path.GetFileName(quoteServiceInformation.Location);
                Assembly cAssembly = File.Exists(sFilename) ? Assembly.LoadFile(Path.GetFullPath(sFilename)) : Assembly.LoadFile(Path.GetFullPath(quoteServiceInformation.Location));
                Type     cType     = cAssembly.GetType(quoteServiceInformation.Name);

                cQuoteService = Activator.CreateInstance(cType) as AbstractQuoteService;
                cQuoteService.Load();                   //讀取資訊
            }
            else
            {
                cQuoteService = GetQuoteService(sDataSource);
            }
            return(cQuoteService);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("log4net_config.xml"));

            ServicePointManager.DefaultConnectionLimit = 1024;

            ProductManager.Load("exchanges");
            QuoteManager.Manager.Refresh("plugins\\quotes");

            QuoteServiceInformation[] cQuoteServiceInfos = QuoteManager.Manager.GetQuoteServiceInformations();
            QuoteManager.Manager.StartQuoteService(cQuoteServiceInfos[0]);
            AbstractQuoteService cService = QuoteManager.Manager.GetQuoteService(cQuoteServiceInfos[0].DataSource);

            cService.Load();
            cService.onLoginCompleted += Service_onLoginCompleted;

            Zeghs.Settings.GlobalSettings.Load();

            //*
            //轉換三竹資訊源即時資料
            if (args.Length > 0 && args[0].Equals("/admin"))
            {
                int iCommand = PrintMenu();
                if (iCommand > 0)
                {
                    ExcuteCommand(iCommand);
                }
            }
            else
            {
                MitakeSourceAdapter cAdapter = new MitakeSourceAdapter();
                cAdapter.Load(DateTime.Today);
            }
            // */

            /* 轉換期交所指數期貨 RPT 資料
             * if (args.Length > 0 && args[0].Equals("/admin")) {
             *      int iCommand = PrintMenu();
             *      if (iCommand > 0) {
             *              ExcuteCommand(iCommand);
             *      }
             * } else {
             *      bool bEvent = __cManualEvent.WaitOne(60000);
             *      FuturesRptAdapter.Convert(DateTime.Now);
             * }
             * // */

            //DumpDataUtil.Load("TXF0.tw", true, new DateTime(2017, 12, 22, 8, 45, 0), new DateTime(2017, 12, 26, 13, 45, 0));
            //DumpDataUtil.Save("TXF0.tw", true, "abc.txt", new DateTime(2013,11,20,8,45,0));

            //FuturesCsvAdapter.Convert();  //轉換CSV使用

            //bool bEvent = __cManualEvent.WaitOne(60000);

            /*
             * MitakeSourceAdapter cAdapter = new MitakeSourceAdapter();
             * DateTime cStartDate = new DateTime(2012, 1, 1);
             * DateTime cEndDate = new DateTime(2014, 12, 31);
             *
             * while (cStartDate <= cEndDate) {
             *      cAdapter.Load(cStartDate);
             *      cStartDate = cStartDate.AddSeconds(86400);
             * }
             * cAdapter.Dispose();
             *
             * //*/
            //System.Console.WriteLine("Completed...");
            //System.Console.ReadLine();
            //return;

            __cManualEvent.Dispose();
            QuoteManager.Manager.CloseAll();
        }