Пример #1
0
        private void Test04()
        {
            const int CYCLE_SEC = 2;

            //const int CYCLE_SEC = 10;

            T4_OutDir = @"C:\pub\Fx";

            if (Directory.Exists(T4_OutDir) == false)
            {
                T4_OutDir = @"C:\temp";
            }

            for (; ;)
            {
                T4_Now = new TimeData((TimeData.Now.T / CYCLE_SEC + 1) * CYCLE_SEC);

                while (TimeData.Now.T < T4_Now.T)
                {
                    while (Console.KeyAvailable)
                    {
                        if (Console.ReadKey().KeyChar == 0x1b)                         // ? esc
                        {
                            throw new Exception("プロセス停止");
                        }
                    }
                    Thread.Sleep(100);
                }

                try
                {
                    byte[] binResBody = new HttpClient(
                        ///////////////////////////////////////////// $_git:secret
                        ).Perform();
                    string resBody = Encoding.UTF8.GetString(binResBody);

                    T4_ResBody = resBody;

                    T4_FxList("USDJPY");
                    T4_FxList("EURJPY");
                    T4_FxList("AUDJPY");
                    T4_FxList("GBPJPY");
                    T4_FxList("NZDJPY");
                    T4_FxList("CADJPY");
                    T4_FxList("CHFJPY");
                    T4_FxList("ZARJPY");
                    T4_FxList("CNHJPY");
                    T4_FxList("EURUSD");
                    T4_FxList("GBPUSD");
                    T4_FxList("AUDUSD");
                    T4_FxList("NZDUSD");
                    T4_FxList("HKDJPY");
                    T4_FxList("EURGBP");
                    T4_FxList("EURAUD");
                    T4_FxList("USDCHF");
                    T4_FxList("EURCHF");
                    T4_FxList("GBPCHF");
                    T4_FxList("AUDCHF");
                    T4_FxList("CADCHF");
                    T4_FxList("USDHKD");
                }
                catch (Exception e)
                {
                    T4_Error(e);
                }
            }
        }
Пример #2
0
        private void Test03()
        {
            const int CYCLE_SEC = 2;

            for (; ;)
            {
                long next_t = (TimeData.Now.T / CYCLE_SEC + 1) * CYCLE_SEC;

                try
                {
                    T3_Now = TimeData.Now;

                    byte[] binResBody = new HttpClient(
                        ///////////////////////////////////////////// $_git:secret
                        ).Perform();
                    string resBody = Encoding.UTF8.GetString(binResBody);

                    T3_ResBody = resBody;

                    FxList("USDJPY");
                    FxList("EURJPY");
                    FxList("AUDJPY");
                    FxList("GBPJPY");
                    FxList("NZDJPY");
                    FxList("CADJPY");
                    FxList("CHFJPY");
                    FxList("ZARJPY");
                    FxList("CNHJPY");
                    FxList("EURUSD");
                    FxList("GBPUSD");
                    FxList("AUDUSD");
                    FxList("NZDUSD");
                    FxList("HKDJPY");
                    FxList("EURGBP");
                    FxList("EURAUD");
                    FxList("USDCHF");
                    FxList("EURCHF");
                    FxList("GBPCHF");
                    FxList("AUDCHF");
                    FxList("CADCHF");
                    FxList("USDHKD");
                }
                catch (Exception e)
                {
                    WrLine(
                        T3_Now.GetCompactString() + ",Exception," +
                        e.Message
                        );
                }

                while (TimeData.Now.T < next_t)
                {
                    while (Console.KeyAvailable)
                    {
                        if (Console.ReadKey().KeyChar == 0x1b)                         // ? esc
                        {
                            throw new Exception("プロセス停止");
                        }
                    }
                    Thread.Sleep(100);
                }
            }
        }