Exemplo n.º 1
0
 public MoneyGroup(int num)
 {
     allMoneyBoth = new MoneyBoth[num];
     for (int i = 0; i < allMoneyBoth.Length; i++)
     {
         allMoneyBoth[i] = new MoneyBoth();
     }
 }
Exemplo n.º 2
0
        public void PPP()   //GBPUSD.lmx;L;-12
        {
            try
            {
                foreach (MoneyGroup mgp in DataFiler.basicMoneyGroup)
                {
                    foreach (MoneyBoth mbth in mgp.allMoneyBoth)
                    {
                        mbth.InitPosNum('x', 0);
                    }
                }

                StreamReader sr = new StreamReader("E:/PPP.txt", Encoding.Default);
                string       line;
                //int lineIndex = 0;
                while ((line = sr.ReadLine()) != null)
                {
                    //读取每行前六个字符,找到相应的对象
                    string    bothName = line.Substring(0, 6);
                    MoneyBoth both     = FindMoneyBoth(bothName);
                    //读取part1
                    char pos = char.Parse(line.Substring(11, 1));
                    //读取part2
                    int posNum = int.Parse(line.Substring(13));
                    //将两个部分放到相对应的对象中
                    if (pos == 'L')
                    {
                        both.PosLocation = pos;
                        both.PosNum      = posNum;
                    }
                    else
                    {
                        both.PosLocationR = pos;
                        both.PosNumR      = posNum;
                    }
                }
                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;
                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到PPP.txt*",
                    BasicData.mainUI
                });
                PPP();
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;
                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*盈亏点数有误*",
                    BasicData.mainUI
                });
                PPP();
            }
        }
Exemplo n.º 3
0
        public int CompareTo(object obj)
        {
            int result;

            try
            {
                MoneyBoth info = obj as MoneyBoth;
                if (this.Ordersum < info.Ordersum)
                {
                    result = 0;
                }
                else
                {
                    result = 1;
                }
                return(result);
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
        }
Exemplo n.º 4
0
        public DataFiler()
        {
            basicMoney[0] = new Money("USD");
            basicMoney[1] = new Money("JPY");
            basicMoney[2] = new Money("EUR");
            basicMoney[3] = new Money("GBP");
            basicMoney[4] = new Money("CHF");
            basicMoney[5] = new Money("CAD");
            basicMoney[6] = new Money("AUD");
            basicMoney[7] = new Money("NZD");

            for (int i = 0; i < basicMoneyBoth.Length; i++)
            {
                basicMoneyBoth[i] = new MoneyBoth();
            }
            for (int i = 0; i < basicMoneyGroup.Length; i++)
            {
                basicMoneyGroup[i] = new MoneyGroup(basicMoneyGroup.Length - i);
            }
        }
Exemplo n.º 5
0
        public void jjj()
        {   //2016.01.27 02:20;USDJPY.lmx;10;USDCAD.lmx;13;USDCHF.lmx;9;EURUSD.lmx;12;GBPUSD.lmx;16;AUDUSD.lmx;20;NZDUSD.lmx;15;EURJPY.lmx;6;EURCAD.lmx;1;EURCHF.lmx;-2;EURGBP.lmx;-6;EURAUD.lmx;-8;EURNZD.lmx;9;GBPJPY.lmx;7;CADJPY.lmx;-5;CHFJPY.lmx;3;AUDJPY.lmx;15;NZDJPY.lmx;32;GBPAUD.lmx;9;GBPCAD.lmx;3;GBPCHF.lmx;14;GBPNZD.lmx;4;AUDNZD.lmx;-5;AUDCAD.lmx;-9;AUDCHF.lmx;3;NZDCAD.lmx;2;NZDCHF.lmx;9;CADCHF.lmx;10
            try
            {
                StreamReader sr = new StreamReader(Setup.pathTemp + "/jjj.txt", Encoding.Default);
                string       line;
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                line = sr.ReadLine();
                string[] Data = line.Split(new char[] { ';' });

                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 2; i++)
                {
                    string    name = Data[2 * i - 1].Substring(0, 6);
                    MoneyBoth both = FindMoneyBoth(name);
                    both.PriceChange = Math.Abs(int.Parse(Data[2 * i]));
                }
                lineNum++;

                while ((line = sr.ReadLine()) != null)
                {
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                    if (lineNum == 60)
                    {
                        break;
                    }
                }

                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*价格行程数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到jjj.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*价格行程有误*",
                    BasicData.mainUI
                });
            }
        }
Exemplo n.º 6
0
        public void TTT()   // 2016.01.27 02:20;USDJPY.lmx;82S;USDCHF.lmx;2B;USDCAD.lmx;38B;EURUSD.lmx;37S;........
        {
            try
            {
                StreamReader sr = new StreamReader(Setup.pathTemp + "/TTT.txt", Encoding.Default);
                string       line;
                int          lineNum = 0;
                int          hour1, hour2;
                int          min1, min2;
                line = sr.ReadLine();
                string[] Data = line.Split(new char[] { ';' });
                hour1 = int.Parse(line.Substring(11, 2));
                min1  = int.Parse(line.Substring(14, 2));
                hour2 = hour1;
                min2  = min1;
                for (int i = 1; i <= (Data.Length - 1) / 2; i++)
                {
                    string    name = Data[2 * i - 1].Substring(0, 6);
                    MoneyBoth both = FindMoneyBoth(name);
                    both.BuyOrSellNum = int.Parse(Data[2 * i].Substring(0, Data[2 * i].Length - 1));
                    both.BuyOrSell    = char.Parse(Data[2 * i].Substring(Data[2 * i].Length - 1, 1));
                }
                lineNum++;

                while ((line = sr.ReadLine()) != null)
                {
                    hour2 = int.Parse(line.Substring(11, 2));
                    min2  = int.Parse(line.Substring(14, 2));
                    lineNum++;
                    if (lineNum == 60)
                    {
                        break;
                    }
                }
                MyTime timeDiff    = new MyTime(DateTime.Now.Day, hour1, min1) - new MyTime(DateTime.Now.Day, hour2, min2);
                int    planLineNum = timeDiff.Hour * 60 + timeDiff.Min + 1;
                if (planLineNum > lineNum)
                {
                    Setup.isFoundError = true;

                    BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                        basicFormText + "*进退数据缺失" + (planLineNum - lineNum).ToString() + "条*",
                        BasicData.mainUI
                    });
                }

                sr.Close();
            }
            catch (FileNotFoundException ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*找不到TTT.txt*",
                    BasicData.mainUI
                });
            }
            catch (Exception ex)
            {
                Setup.isFoundError = true;

                BasicData.mainUI.Invoke(BasicData.mainUI.ShowFormText, new object[] {
                    basicFormText + "*进退数据有误*",
                    BasicData.mainUI
                });
            }
        }