Exemplo n.º 1
0
        private void WriteOutput(TabulateData result, string error)
        {
            textBox1.AppendText("\n");
            textBox1.AppendText(string.Format("Error: {0}", error));
            textBox1.AppendText("\n");
            textBox1.AppendText("Result:");

            if (result == null)
            {
                return;
            }

            var columns = result.Columns;

            textBox1.AppendText("\n");
            foreach (var column in columns)
            {
                textBox1.AppendText(string.Format("{0}\t", column));
            }

            textBox1.AppendText("\n");
            foreach (var row in result.Rows)
            {
                foreach (var field in row)
                {
                    textBox1.AppendText(string.Format("{0}\t", field));
                }
            }
        }
Exemplo n.º 2
0
        //static void TestAccountEncryptionDecryption()
        //{
        //    string decryptedAccount = TdxWrapper.DecryptAccount("CAEZBMBJ");

        //    textBox1.AppendText(decryptedAccount);

        //    string encryptedAccount = TdxWrapper.EncryptAccount("13003470");
        //    textBox1.AppendText(encryptedAccount);

        //    string encryptedAccount1 = TdxWrapper.EncryptAccount("42000042387");
        //    textBox1.AppendText(encryptedAccount1);

        //    string decryptedAccount1 = TdxWrapper.DecryptAccount(encryptedAccount1);
        //    textBox1.AppendText(decryptedAccount1);
        //}

        //static void TestCalcLimit()
        //{
        //    float[] prices = new float[] { 21.93F, 77.0F, 13.07F, 7.49F, 101.21F  };

        //    foreach (var price in prices)
        //    {
        //        float upLimit = TradingHelper.CalcUpLimit(price);
        //        float downLimit = TradingHelper.CalcDownLimit(price);

        //        textBox1.AppendText("Price: {0:0.000}, Up limit: {1:0.000}, Down limit: {2:0.000}", price, upLimit, downLimit);
        //    }
        //}

        private void ShowQuote(TabulateData result, DateTime time)
        {
            foreach (var quote in FiveLevelQuote.ExtractFrom(result, time))
            {
                textBox1.AppendText("\n");

                textBox1.AppendText(string.Format("{0} {1} {2} {3:0.000} {4:0.000} {5:0.000}", quote.Timestamp, quote.SecurityCode, quote.SecurityName, quote.YesterdayClosePrice, quote.TodayOpenPrice, quote.CurrentPrice));
                for (int j = quote.SellPrices.Length - 1; j >= 0; --j)
                {
                    textBox1.AppendText("\n");
                    textBox1.AppendText(string.Format("{0:0.000} {1}", quote.SellPrices[j], quote.SellVolumesInHand[j]));
                }

                textBox1.AppendText("\n");
                textBox1.AppendText("-----------------");

                for (int j = 0; j < quote.BuyPrices.Length; ++j)
                {
                    textBox1.AppendText("\n");
                    textBox1.AppendText(string.Format("{0:0.000} {1}", quote.BuyPrices[j], quote.BuyVolumesInHand[j]));
                }
            }
        }